Here is a scripting mystery - how to heal a door?

A place for players to discuss building content (toolset Q&A etc.)
User avatar
Jay Four
Lord of The Realms
Posts: 386
Joined: Fri Sep 22, 2006 4:40 pm
Location: Elysium

Here is a scripting mystery - how to heal a door?

Post by Jay Four »

If anyone is interested in investigating :)

I am trying to figure out how to heal a door. I used to do this in NWN1:

Code: Select all

effect eHeal = EffectHeal( damage );
ApplyEffectToObject(DURATION_TYPE_INSTANT, eHeal, oDoor);
However, this doesn't seem to work in NWN2. Interestingly, EffectDamage works just fine. It's almost like EffectHeal() doesn't work if the target is a door. I'm not sure if it is a bug or not.

If anyone knows a way to do get a door healthy again, I'd love to hear about it!
BeyondRedemption
Dasarian Scout
Posts: 409
Joined: Tue Oct 17, 2006 10:47 am
Location: Santa Cruz, CA

Post by BeyondRedemption »

Can you effect damage with a negative number?
LoFang
Lord of The Realms
Posts: 56
Joined: Sat Sep 23, 2006 5:48 am
Location: Santa Rosa, California
Contact:

Post by LoFang »

Heh, was going to ask the same thing
LoFang, the Gnoll Lord
Image
User avatar
Jay Four
Lord of The Realms
Posts: 386
Joined: Fri Sep 22, 2006 4:40 pm
Location: Elysium

Post by Jay Four »

It was worth a try, but negative damage it didn't work.

I also tried:

Code: Select all

AssignCommand( GetModule(), 
  ApplyEffectToObject(DURATION_TYPE_INSTANT, eHeal, oDoor); 
  );

Code: Select all

AssignCommand( oDoor, 
  ApplyEffectToObject(DURATION_TYPE_INSTANT, eHeal, oDoor); 
  );
None of those worked either.
BeyondRedemption
Dasarian Scout
Posts: 409
Joined: Tue Oct 17, 2006 10:47 am
Location: Santa Cruz, CA

Post by BeyondRedemption »

Is there some sort of adjust hit points function? Maybe add more constitution to make it beefier?
Zephis
Dasarian Scout
Posts: 408
Joined: Wed Nov 15, 2006 4:24 pm

Post by Zephis »

Try thinking form a different angle..
Is their a command to say.. SET HIT POINTS ON OBJECT = X ?
User avatar
Jay Four
Lord of The Realms
Posts: 386
Joined: Fri Sep 22, 2006 4:40 pm
Location: Elysium

Post by Jay Four »

I don't know of any function like that, if you do, I'd love to hear about it.
Zephis
Dasarian Scout
Posts: 408
Joined: Wed Nov 15, 2006 4:24 pm

Post by Zephis »

*nods* Well i don't either.. it was just something i was suggesting.. sadly I'm no scripter :(
thedork
Dasarian Scout
Posts: 237
Joined: Thu Nov 16, 2006 7:43 am

Post by thedork »

Code: Select all

//put under OnDamaged, OnDisturbed, OnSpellCastAt

void main()
{

//if pc does a hostile action against owner of script

object oPC = GetLastHostileActor();

if (!GetIsPC(oPC)) return;

object oTarget;
oTarget = OBJECT_SELF;

//the 11 is how much. 3 is the interval.
//effect is regenerate, regenerates 11 hp every 3 seconds

effect eEffect;
eEffect = EffectRegenerate(11, 3.0f);

ApplyEffectToObject(DURATION_TYPE_TEMPORARY, eEffect, oTarget, 60.0f);

}
dunno if it will work just give it a try i guess, gl
------------------------------------------------------
Swing a little more on the Devil's Dance Floor.
Evelond Formos

Post by Evelond Formos »

How about making the door a plot object, and recording the damage it -would- take every time it was hit in a local variable? Then when you wanted to heal it you'd decrement this variable. When the variable reaches the door's hit points, destroy the door by setting the plot flag to FALSE and destroying the object.
User avatar
Jay Four
Lord of The Realms
Posts: 386
Joined: Fri Sep 22, 2006 4:40 pm
Location: Elysium

Post by Jay Four »

Regeneration didn't work either. :/

I don't know any way to get the amount of damage done to a plotted door. If you do, I've love to know about it!
Evelond Formos

Post by Evelond Formos »

Jay Four wrote:Regeneration didn't work either. :/

I don't know any way to get the amount of damage done to a plotted door. If you do, I've love to know about it!
Just use the d#() functions to do the dice rolls in the OnPhysicalAttacked or whatever the equivilant is for a door, and store the damage results in a local variable on the door. Every time the script is run, check to see if the ammount of damage is greater than or equal to the door's hit points. If it is, destroy the door.

Then just decrease the variable whenever you want to heal it.

EDIT- to destroy the door, first make sure you set the plot flag to FALSE. :P
User avatar
Jay Four
Lord of The Realms
Posts: 386
Joined: Fri Sep 22, 2006 4:40 pm
Location: Elysium

Post by Jay Four »

Heh. Actually... that might work. But it is getting pretty ugly. I'm not sure if I am that desperate yet.
Evelond Formos

Post by Evelond Formos »

Jay Four wrote:Heh. Actually... that might work. But it is getting pretty ugly. I'm not sure if I am that desperate yet.
When I got bored in the days of NwN, I saw this implemented on quite a few PvP servers. It might cause lag on Das II, though . . . :?
Rob
Forum Troll
Posts: 3146
Joined: Fri Sep 22, 2006 9:39 pm
Other PCs: Amir Ma'fir, Darius Aylomen, Dewey Scoville, Jack Red-Eyes, Jørann, Kale, Leopold von Bruhl, Modelo Del Mar & Quintus d'Cerevallia
Bioware Username: robertharris
Location: Dallas, TX

Post by Rob »

Slated for 1.06

EffectHeal() now works on doors and placeables.
Post Reply

Return to “The Carpenter's Hall”