Aller au contenu

Photo

No exit during combat


  • Veuillez vous connecter pour répondre
4 réponses à ce sujet

#1
Anysecondnow

Anysecondnow
  • Members
  • 9 messages
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!!!

#2
Shallina

Shallina
  • Members
  • 1 012 messages
in the area transition script :

if (GetIsInCombat(GetFirstPC(TRUE)){
return;
}

You should use something else for GetFirstPC(TRUE)

Something like oClicker
object oClicker = GetClickingObject();

#3
painofdungeoneternal

painofdungeoneternal
  • Members
  • 1 799 messages
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.

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
Lugaid of the Red Stripes

Lugaid of the Red Stripes
  • Members
  • 955 messages
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).

#5
Anysecondnow

Anysecondnow
  • Members
  • 9 messages
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!