Is there a way to do damage

As I told you previously… first of all you need to know what you’re gonna write, then write.

I can show you how to do it, but not do it for you (it’s much more better to have a new scripter in the community)

Seriously, Lexicon is not the rosetta stone, and I will help.

Yup the script works except the string of words don’t pop up like they should.

Also, I would need to change the timing as it happens too often. It would be nice if the damage was like every 5 min real time. I like how the damage increases more and more. I wish there was another damage we could add that is not part of the current damages. I wonder if “monster damage” would work. Also would be nice like DM_Wise said about doing Constitution damage as well. Say every 10 min real time they are in the desert in addition to damage…to reset the point damage there should be the ability to drink water from a canteen or from a water source (trigger drawn around an oasis to simulate drinking water at the edge of the pool or refilling the canteen).

I say each canteen can reset back to original damage start. The heat scripting that Vivienne suggested sounds like a great system but it is hard for me to implement into my module event script so I would like to only make the “area” event script “OnEnter” the only place to make this work.

Also, would be good if the PC strips down naked to alleviate heatstroke (if no clothing then reduce damage by 5 each time damages is done) not sure if this is possible. I have a similar script for cold damage in cold areas where each item of clothing protects the PC from cold damage. See below:

////////////////////////////////////////////////////////////////////////////////
//                             Cold of Winter                                 //
//                            sl_winter_onente                                //
//                 Author :sly777 for Land of Cheshire                        //
//               special thanks to xanas our lead scripter                    //
//                   for helping  make this cleaner :)                        //
////////////////////////////////////////////////////////////////////////////////

//put on enter area you want winter effect //
void coldofwinter(object oPC,object oArea);


void main()
{
    object oPC=GetEnteringObject();
    if(!GetIsPC(oPC)) return;
    object oArea=OBJECT_SELF;
    int nIntensity = GetLocalInt(oArea, "Intensity");
    if(nIntensity == 0) return;

    SetLocalInt(oPC,"Intensity", nIntensity);
    SendMessageToPC(oPC, "Its very cold and windy ");
    DelayCommand(20.0,coldofwinter(oPC,oArea));
}


void coldofwinter(object oPC,object oArea)
{
    int nInventorySlot;
    int nTotalIntensity;
    int AC;
    effect eDmg;
    effect slow;
    object oItem;
    string sTag;
    float fDist;
    if (GetArea(oPC)==oArea)
    {
        nTotalIntensity=GetLocalInt(oPC,"Intensity");
        if (GetIsNight()==TRUE) nTotalIntensity+=3;// colder at night
        if (GetIsDay()==TRUE) nTotalIntensity-=4;// warmer in the day
        if (GetWeather(oArea)==WEATHER_SNOW) nTotalIntensity-=2;//warmer if its snowing
        if (GetWeather(oArea)==WEATHER_RAIN) nTotalIntensity+=4;//colder if its raining

        oItem =GetItemInSlot(INVENTORY_SLOT_BOOTS,oPC);//check for special boots
        sTag=GetTag(oItem) ;
        if (sTag=="warmboots") nTotalIntensity-=2;
        if (sTag=="winterboots") nTotalIntensity-=4;

        oItem =GetItemInSlot(INVENTORY_SLOT_ARMS,oPC);//check for special gloves
        sTag=GetTag(oItem) ;
        if (sTag=="warmgloves") nTotalIntensity-=2;
        if (sTag=="wintergloves") nTotalIntensity-=4;

        oItem =GetItemInSlot(INVENTORY_SLOT_HEAD,oPC);//check for special headgear
        sTag=GetTag(oItem) ;
        if (sTag=="warmhat") nTotalIntensity-=2;
        if (sTag=="winterhat") nTotalIntensity-=4;


        oItem=GetItemInSlot(INVENTORY_SLOT_CHEST,oPC);//check if pc wear something or heavy armor
        AC=GetItemACValue(oItem);
        nInventorySlot=(GetIsObjectValid(oItem));
        if (AC >= 4) nTotalIntensity+=2;
        else if (nInventorySlot=1) nTotalIntensity+=4;

        {
            oItem=GetItemInSlot(INVENTORY_SLOT_CLOAK,oPC);//check for special cloaks
            sTag=GetTag(oItem);
            if (sTag=="warmcloak") nTotalIntensity-=2;
            else if (sTag=="wintercloak") nTotalIntensity-=4;
        }
        oItem=GetNearestObjectByTag("Campfire",oPC,1);//check for fire nearby
        if (oItem!=OBJECT_INVALID)
        {
            SendMessageToPC(oPC, "The fire seems to make you warmer but you still risk freezing being exposed out here as you are.");
            fDist=GetDistanceBetween(oItem,oPC);
            if (fDist<1.0) nTotalIntensity-=8;
            else if (fDist<3.0) nTotalIntensity-=3;
            else if (fDist<5.0) nTotalIntensity-=2;
            SetLocalInt(oPC, "nsavethrow", 0);

        }
        SetLocalInt (oPC,"nsavethrow",GetLocalInt(oPC, "nsavethrow")+1);//get the saving throw harder with time
        int time = 15 + GetLocalInt(oPC,"nsavethrow");//saving throw vs cold (fortitude save)
        if (FortitudeSave(oPC, time, SAVING_THROW_TYPE_COLD ))
        {
        }

        else
        {
            slow=EffectMovementSpeedDecrease(25);
            eDmg=EffectDamage(nTotalIntensity,DAMAGE_TYPE_COLD);
            if (nTotalIntensity <= 6)ApplyEffectToObject(DURATION_TYPE_TEMPORARY,slow,oPC,30.1f);
            else if (nTotalIntensity >= 7)ApplyEffectToObject(DURATION_TYPE_INSTANT,eDmg,oPC,1.0);
            SendMessageToPC(oPC,"This environment is very cold.");
           } // do cold damage or speed decrease
           DelayCommand(30.0,coldofwinter(oPC,oArea));
      } // end areaofpc = area
  }

I can’t script from scratch Bairsewolf…I manage to copy other scripts and change them around ok enough, but what you suggest although logical (the planning out the sequence)…I am not able to do that. I depend upon the generosity of you scripters. I will contribute by making spells (do everything, but hard scripting). I did manage to splice together the “unseen servant” spell on my own…I did manage to start the illusionary wall script (which you fine-tuned). I did make the “Puke cantrip” too by splicing two scripts together…and andgalf helped in that too to fine tune it.

Holy cow…That script impacts all my areas my PC goes into…even though it is only used on the OnHeartbeat event of that one desert area.

I entered into my module with several characters into the start area (not the desert area I put that script in) and right away it does the damage to the PC…how weird is that?

That sounds really odd. Let me see if I can edit it a bit.

Ok, try this. Now the damage increases about every 300 seconds (5 min), and it should only affect the area it is posted in. I haven’t added stuff for stopping the whole thing. Odd that you don’t get the message “Whew…It’s so hot and…”. I get that when I test in NWN2.

You need to also change the “areatag” to the tag of your area.

EDIT: Here’s a new version of the script:

void Pseudoheartbeat()
{
	object oPC = GetFirstPC();
	object oArea = GetObjectByTag("areatag");
	
	if(GetArea(oPC) != oArea) return;
	if(GetLocalInt(oPC,"drankwater")) return;
	
	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));	
	
	}
	
	DelayCommand(300.0, Pseudoheartbeat());
		
}


void main()
{
	object oPC = GetFirstPC();
	object oArea = GetObjectByTag("areatag");
	
	if(GetLocalInt(oPC,"drankwater")) return;	
	if(GetArea(oPC) != oArea) return;

	Pseudoheartbeat();
}

And here’s a healing script to place on the water placeable, or whatever you use, to heal the PC. Code “stolen” from ga_heal in NWN2.

void main()
{
		object oPC = GetFirstPC();
	
		int nHealPercent = 100;
		int nCurrentHP = GetCurrentHitPoints(oPC);
		int nHP = FloatToInt(IntToFloat(GetMaxHitPoints(oPC)) * IntToFloat(nHealPercent) / 100) - nCurrentHP;
		effect eHeal = EffectHeal(nHP);
		ApplyEffectToObject(DURATION_TYPE_INSTANT, eHeal, oPC);
		SetLocalInt(oPC,"drankwater",1);
	

}

Uugh, that’s way too complicated and too much work for someone like me who only knows basic scripting, I’m afraid.

EDIT: I tried with a new version of the script (but try the other one FIRST) with contitution meddling. Not sure if this one is scripted right:

void Pseudoheartbeat()
{
	object oPC = GetFirstPC();
	object oArea = GetObjectByTag("areatag");
	
	if(GetArea(oPC) != oArea) return;
	if(GetLocalInt(oPC,"drankwater")) return;
	
	int nConstitution = GetAbilityScore(oPC,ABILITY_CONSTITUTION);
	SetLocalInt(oPC,"pcconstitution",nConstitution);

	ApplyEffectToObject(DURATION_TYPE_INSTANT, EffectAbilityDecrease(ABILITY_CONSTITUTION, 2), 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));	
	
	}
	
	DelayCommand(300.0, Pseudoheartbeat());
	
	
}


void main()
{

	object oPC = GetFirstPC();
	object oArea = GetObjectByTag("areatag");
	
	if(GetLocalInt(oPC,"drankwater")) return;	
	if(GetArea(oPC) != oArea) return;

	Pseudoheartbeat();

	

	
}

And here’s a script for when drinking water. It’s supposed to reset the constitution to the maximum normal constitution for the PC. Not sure if this is scripted right either:

void main()
{
		object oPC = GetFirstPC();
	
		int nRealConstitution = GetLocalInt(oPC,"pcconstitution");
		int nCurrentContitution = GetAbilityScore(oPC,ABILITY_CONSTITUTION);
		
		int nIncrease = nRealConstitution - nCurrentContitution;
		
		effect eAbility = EffectAbilityIncrease(ABILITY_CONSTITUTION,nIncrease);
		
		ApplyEffectToObject(DURATION_TYPE_INSTANT,eAbility,oPC);
	

}

Again, try the other script in the post above first. It’s much more reliable and probable to work.

It sounds like you may already have what you are looking for, but if not, just let me know. I use a pseudo-heartbeat for each area, with an OnEnter and OnExit event, governed by constants in an include. This allows the system to track the oPC across multiple desert areas, and then to reduce the fatigue/thirst when they get back into non-desert areas.

Maybe post here your scripts and we can look at it too. :slight_smile:

Not sure what you mean by “area tag”?

Instead of a “water placeable” to heal. Is it possible to do this on a trigger? So I can outline the oasis with this trigger?

EDIT: Also, is it possible too to add damage too on top like you did in your first one in addition to constitution reduction. I want my PCs to suffer in the desert.

Would be funny if they died that a bones placeable shows up and a vulture is summoned to pick at the skeleton too…but hey…that’s extra fun…lol

Can you also post your scripts here too.

I think we can blend scripts to make an awesome one for everyone.

I’m not sure my last scripts work at all to be honest. Have you tried them?

Nope…just tried the one before that. Was testing it.

I will test the last one now.

What tag do you have for the area where you want the fatigue, damage and all that to take effect? You replace my “areatag” with the tag for that area.

In NWN:EE we don’t have our areas “tagged”.

Also, I can’t seem to find a decent desert tileset on the vault with dunes. Anyone know of a good NWN:EE tileset with dunes?

CEP 2 Desert has a slope crosser for raised sand, so you can make medium to large dunes. There’s also a terrain for small mounds. Fully tested for EE.

1 Like

Huh? Then how can you grab different areas and check/do things to them?
Maybe check under the Advanced tab? How do you know if the PC is in a certain area? There must be some code for that…

I tried testing my last scripts. The one decreasing the constitution works (in NWN2) but reseting the constitution doesn’t for some reason. I think my code is correct but…it appears it’s not.

Nope…not in the advanced.

I guess it is different from NWN 2

See below: