The reason it's doing it in all areas is because you changed the script and saved it.If you open your other areas, you'll see that they call the same script.I think most people do something like Failed Bard did.
However, here are a couple of other choices:
1: Open the area properties and add a variable to the area. Type INT. Name "Underwater". Set it to 1.Use this code:
void main()
{
object oPC = GetEnteringObject();
if (GetLocalInt(OBJECT_SELF, "Underwater"))
{
effect eEffect; eEffect = EffectDamage(2, DAMAGE_TYPE_NEGATIVE, DAMAGE_POWER_NORMAL);
ApplyEffectToObject(DURATION_TYPE_INSTANT, eEffect, oPC);
}
}
This will only run the code block on the area with the underwater variable.
The other way would be to open your script and hit the "Save As" button instead of save. Choose a new name such as "are_hb_unwtr". Use that script on your underwater areas hb.
Delete that block of code from your other script since your other areas use it.
If you're already doing that and it's still running in all areas, there is an odd problem somewhere.
EDIT:
It looks like Failed Bards code also needs to use one of my sugestions along with it. Otherwise it'll always run.
GetArea(OBJECT_SELF) will always be the same as GetArea(oPC) in any areas hb. You need to make sure that you only run it in underwater areas by using either a variable or a unique script. That way, the pseudo hb will end when they go to a new area.
Also, in this block of code from Failed Bard:
// If a PC is in the area, repeat the pseudo HB again in 6 seconds.
// Else, end it, and remove the variable to get it ready for the next entering PC.
if (nActive)
{
DelayCommand (6.0, DrownHB() );
}
We need to make sure that it passes the same area back in to the function call. Otherwise, it'll grab the current area that the PC is in and it may never stop unless it tries to check while the PC is loading a new area.
// If a PC is in the area, repeat the pseudo HB again in 6 seconds.
// Else, end it, and remove the variable to get it ready for the next entering PC.
if (nActive)
{
// Passing in the same area
DelayCommand (6.0, DrownHB(oArea) );
}
Modifié par wyldhunt1, 11 décembre 2011 - 08:59 .