Hi, I would like to prevent the party to be able to exit an area as long as they are in combat. Could anyone please help with a script? It should work for an area transition trigger as well as for doors. Thanks a lot!!!
No exit during combat
Débuté par
Anysecondnow
, juil. 01 2011 06:41
#1
Posté 01 juillet 2011 - 06:41
#2
Posté 01 juillet 2011 - 08:23
in the area transition script :
if (GetIsInCombat(GetFirstPC(TRUE)){
return;
}
You should use something else for GetFirstPC(TRUE)
Something like oClicker
object oClicker = GetClickingObject();
if (GetIsInCombat(GetFirstPC(TRUE)){
return;
}
You should use something else for GetFirstPC(TRUE)
Something like oClicker
object oClicker = GetClickingObject();
#3
Posté 01 juillet 2011 - 08:32
this is snippets of my nw_g0_transition.nss
That is the real area transistion script you use on area transitions, but can be used for other things. Doors you have to close the door when it's opened via a script put in the doors onopened event.
The IsTransAllowed returns true or false, which does the logic if it is allowed, you'd replace that with tests for the area name and if the player is in combat.
That is the real area transistion script you use on area transitions, but can be used for other things. Doors you have to close the door when it's opened via a script put in the doors onopened event.
The IsTransAllowed returns true or false, which does the logic if it is allowed, you'd replace that with tests for the area name and if the player is in combat.
void main()
{
object oPC = GetClickingObject();
object oTarget = GetTransitionTarget(OBJECT_SELF);
object oArea = GetArea(oTarget);
if (!IsTransAllowed(oPC, oTarget))
{
return;
}
SetAreaTransitionBMP(AREA_TRANSITION_RANDOM);
SetLocalInt(oPC, "TRANSING", TRUE );
AssignCommand(oPC, JumpToObject(oTarget));
}
Modifié par painofdungeoneternal, 01 juillet 2011 - 08:32 .
#4
Posté 01 juillet 2011 - 04:42
Depending on your situation, a simple check of whether or not they're in combat might not be enough. If they're running away with an enemy close at their heels, but not actively attacking them at that precise moment, they would register as being out of combat.
If you have an important plot battle that you don't want them to flee from, you might be better off blocking the exits with collision boxes until the combat it resolved. Alternatively, if you just don't want them to be able to unrealistically escape pursuing enemies, you might use triggers that run some sort of check and push the PC back if they fail (i.e. do a spot&listen check for any enemies within 10m).
If you have an important plot battle that you don't want them to flee from, you might be better off blocking the exits with collision boxes until the combat it resolved. Alternatively, if you just don't want them to be able to unrealistically escape pursuing enemies, you might use triggers that run some sort of check and push the PC back if they fail (i.e. do a spot&listen check for any enemies within 10m).
#5
Posté 01 juillet 2011 - 08:08
Thanks for all your advice. Could you be so kind to just post a full script for a door and/or trigger which prevents a party from exiting while in combat? It would be ok if they are able to exit although they are being followed. Thanks a lot again!





Retour en haut






