Is there a way to do damage

Is there a way to do damage to a PC who walks into an area that is not part of the normal damage like piercing, bludgeoning, slashing, elemental damages, etc…

If they are protected from most damages…is there a way to damage them?

i.e. I have a desert and when they enter the desert they take heat damage (fire). But if they have 100% damage resistance to fire…how else can I simulate “heat, being tired from thirst, etc” as one who would walk a long distances in a desert?

I can’t incorporate the hunger/thirst systems into my module…too complicated for me to script in…I don’t have that skill…just something I can damage them with to make them say in the area they enter: “You get more thirsty and tired as you trudge forward” say every turn and take 2 points of damage that gets worse over time… a damage of sorts to represent this that is not fire damage.

In NWN2 (and I would guess NWN:EE too?) there are quite many types of damages:

Bludgeoning
Cold
Acid
Divine
Electrical
Fire
Magical
Negative
Piercing
Positive
Slashing
Sonic

Can’t you use any of them you mean? What about Magical or Divine? Or do you think the player would be immune to that?

EDIT: There’s a function called EffectDamage (at least in NWN2) that can ignore resistances. Maybe that’s what you should use.
EDIT2: In the NWN Lexicon it says about EffectDamage: “With the patch/HotU release, 1.59, you can add all damage types (even magical, stupidly) to items as properties. Big note: This is for NPC’s only, and PC’s should never be able to resist divine or magical damage!”

Here’s a simple script you could try. Place it on the OnHeartbeat of the area (you do have things like that in NWN:EE I hope?):

void main()
{

	object oPC = GetFirstPC();

	ApplyEffectToObject(DURATION_TYPE_INSTANT, EffectDamage(Random(8) + 1, DAMAGE_TYPE_DIVINE), oPC);
	//ApplyEffectToObject(DURATION_TYPE_INSTANT, EffectNWN2SpecialEffectFile("sp_fire_hit"), oPC);

	
	
}

Thanks andgalf

Yeah…I need to have damage done outside of those normal damages listed. I thought there might be a hidden damage not included in the normal damages. I don’t know much about “monster damage” but it seems like there is no protection against it.

I will use your sample script above for starters to do “a” damage of sorts I need to determine. :slight_smile:

My script just deals random damage though. Would have to tweak the script for increasing the damage.

Is there a way to put in the script to have the PC being damaged to speak a string like: “Whew…it’s so hot and I’m thirsty and tired”

Yes, there is. I’m trying to look into how to increase the damage over time. I had some similar script in my soon to be released module. Gotta look how it was done there.

EDIT:Gotta go away for an hour, but I’ll continue to work on the script then. It’s almost finished, I think.

1 Like

If for some reason the PC does have divine or magical damage resistances (shouldn’t really…) then you can use SetCurrentHitPoints and just provide a feedback string along the lines of damage happening.

You will lose some reaction animations that’s all. And if you want to kill them you’ll need to use EffectDeath if you want them to go under 1HP.

1 Like

Thanks Jasperre

How would you write that script for a PC going into an area. OnEnter Event script going into an area.

I don’t know if this script would work, but you could maybe try it? Place it on the OnHeartbeat slot of the area.

void main()
{

	object oPC = GetFirstPC();
	object oArea = GetArea(oPC);
	int nDamage = GetLocalInt(oArea, "damage");

	nDamage = nDamage + 2;

	SetLocalInt(oArea, "damage", nDamage);
	ApplyEffectToObject(DURATION_TYPE_INSTANT, EffectDamage(nDamage, DAMAGE_TYPE_DIVINE), oPC);
	
	if(!GetLocalInt(OBJECT_SELF,"FirstTime"))
	{
		
		SetLocalInt(OBJECT_SELF,"FirstTime",1);
		string sThirsty = "Whew…it’s so hot and I’m thirsty and tired.";
		AssignCommand(oPC, ActionSpeakString(sThirsty));	
	
	}
	
}	

The SetCurrentHitPoints approach would require that you know how many hitpoints the PC have at this particular instant, which is why I wouldn’t use that.

EDIT: Ok, maybe one could use GetCurrentHitPoints first and then use SetCurrentHitPoints. We don’t have the SetCurrentHitPoints in NWN2 though so I can’t check and compile it there.
EDIT2: Ok, maybe not. The Lexicon says this: “It also does nothing to temporary hit points effects - thusly GetCurrentHitPoints may return an odd value after using this. If you know there are no temporary hit point effects available you can safely use this with GetCurrentHitPoints.”

EDIT3: We should probably incorporate something in my script that ends the heartbeat script I guess…but that’s for you to decide.

1 Like

Maybe one could use a script like this too? Untested. Requires NWN:EE. Tried to compile it with the NWN1 toolset but it doesn’t contain the SetCurrentHitPoints function:

void main()
{

 	object oPC = GetFirstPC();

	if(!GetLocalInt(OBJECT_SELF,"FirstTime"))
 	{

	   	SetLocalInt(OBJECT_SELF,"FirstTime",1);
		string sThirsty = "Whew…it’s so hot and I’m thirsty and tired.";
		AssignCommand(oPC, ActionSpeakString(sThirsty));
     	int i = GetMaxHitPoints(oPC);
     	int iDamage = SetCurrentHitPoints(oPC,i-2);

  	}
	
  	else
  	{

     	int i = GetCurrentHitPoints(oPC);
     	int iDamage = SetCurrentHitPoints(oPC,i-2);

  	}

}

Yup, did not compile as you said for this reason:

Have you tried this:
https://neverwintervault.org/project/nwn1/script/desert-heat-242
I’m making a desert module myself and have just imported this system… it’s plug and play without me having to write scripts myself.
There are other scripts by this author, Deva Bryson Winblood, that are awesome too like NPC activities
https://neverwintervault.org/project/nwn1/script/npc-activities-61
that totally bring a module alive.

1 Like

hey thanks…this may work for me. I hope I can implement it with my module event script.

Thanks very much :slight_smile:

1 Like

You never tried my second script? In that case why?

void main()
{

	object oPC = GetFirstPC();
	object oArea = GetArea(oPC);
	int nDamage = GetLocalInt(oArea, "damage");

	nDamage = nDamage + 2;

	SetLocalInt(oArea, "damage", nDamage);
	ApplyEffectToObject(DURATION_TYPE_INSTANT, EffectDamage(nDamage, DAMAGE_TYPE_DIVINE), oPC);
	
	if(!GetLocalInt(OBJECT_SELF,"FirstTime"))
	{
		
		SetLocalInt(OBJECT_SELF,"FirstTime",1);
		string sThirsty = "Whew…it’s so hot and I’m thirsty and tired.";
		AssignCommand(oPC, ActionSpeakString(sThirsty));	
	
	}
	
}

The second script that you tried was just a guess. This one compiles and should work.

EDIT: I’ve even tested this now in NWN2 and it works like a charm, and it should be no different in NWN1, but sure if you don’t like it…

The way I accomplish this in my desert areas is by taxing the PC’s constitution rather than traditional damage. The higher the Constitution, the further you can travel. There’s feedback, obviously, letting the PC know they are thirsty and hot and such, ad if the Constitution reaches 3, then we all know what happens.

Of course, to remove the effects one simply needs to drink from their canteen (2 swigs at most) which may be filled at hidden oasises (oasi?), or from an oasis directly.

Anyway, just another way to go about it. It doesn’t always have to be damage.

Cheers!

What would I do…

https://www.d20srd.org/srd/environment.htm

As rules say it should do non lethal damage. But as there is no NLD in nwn, I would run a script from the module onEnter script that do the following

Check if área has variable (isDesert)
If isDesert and isDay make fortitude save
If save fails take 1 CON damage (only if CON > 3)
Delay for 1 game hour (not real hour) and run again.

I would pack this function and others that must run once a game hour in only one pseudo heartbeat (hourly based)

Ok I will try it andgalf :slight_smile:

Thanks DM_Wise

Sounds good. Maybe I can do both some damage and your constitution reduction. Do you have the script I can look at?

Wow…went to that link…pretty cool stuff…but no scripts for me to use :frowning: