Aller au contenu

Photo

ToH Pit Traps Lagginy Badly After IAdjust Them


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

#1
Sabranic

Sabranic
  • Members
  • 306 messages

Ok, I altered some pit traps in the ToH because, as they are currently implemented, when a PC runs across the area, boom, dumps them in a put trap - perfect.  If an NPC, while being controlled by a player runs across the area, boom, dumps them in a put trap.  If an NPC, while NOT being controlled by a Player runs across the area... boom it dumps the PC in the pit trap... and stabs him with spikes and other assorted unpleasantness - while the NPC who triggered the trap stand above it and snickers at the fate of their leader.

 

Here is the original code: 

void main()
{

	object oPC = GetEnteringObject();

	if (GetLocalInt(OBJECT_SELF, "done") == TRUE) return;

	location lTarget = GetLocation(GetWaypointByTag("wp_fresco_two"));

	object oTarget = GetFirstFactionMember(oPC, FALSE);
	
	if(!ReflexSave(oPC, 55, SAVING_THROW_TYPE_TRAP))
	{
		while (GetIsObjectValid(oTarget) && GetDistanceBetween(GetObjectByTag("wp_climb_two") , oPC) <= 6.5f)
		{
			AssignCommand(oTarget, ClearAllActions());
			
			AssignCommand(oTarget, ActionJumpToLocation(lTarget));	
		}
	}
	SetLocalInt(OBJECT_SELF, "done", TRUE);
}

Here is how I modified it:

void main()
{

	object oPC = GetEnteringObject();

	if (GetLocalInt(OBJECT_SELF, "done") == TRUE) return;

	location lTarget = GetLocation(GetWaypointByTag("wp_fresco_two"));

	object oTarget = GetEnteringObject();
	
	if(!ReflexSave(oPC, 55, SAVING_THROW_TYPE_TRAP))
	{
		while (GetIsObjectValid(oTarget) && GetDistanceBetween(GetObjectByTag("wp_climb_two") , oPC) <= 6.5f)
		{
			AssignCommand(oTarget, ClearAllActions());
			
			AssignCommand(oTarget, ActionJumpToLocation(lTarget));	
		}
	}
	SetLocalInt(OBJECT_SELF, "done", TRUE);
}

It works as I want it to, but when it initially jumps a character, there is a substantial amount of lag.  When I stand on the other side of said trap, and tell the party to "follow me" and they ALL trigger the trap, my game freezes for maybe 30 seconds.  It still dumps them all in the pit and stabs them with poisoned spikes mind you - while leaving my PC un bruised and up-perforated up top. 

 

I am curious if it's just the nature of ActionJumpToLocation to lag and stutter the game some when running, or it it's something I have here that's unnecessary and wogging the client down.



#2
kevL

kevL
  • Members
  • 4 056 messages
possible infinite loop, change while to if

?


btw, oPC and oTarget are both defined as the same object (so, no need for two -- pick one)

bonus pts: move the check for isPCValid above where it's used for the Reflex save.
  • Sabranic aime ceci

#3
Sabranic

Sabranic
  • Members
  • 306 messages

I believe you were right on the loop, changing when to if did away with the lag - now however it only fires once.  Odd.  Beforehand, it would trap people multiple times.

 

Going to try and remove : SetLocalInt(OBJECT_SELF, "done", TRUE); and see what happens.



#4
kevL

kevL
  • Members
  • 4 056 messages
that should work, but there's another peculiarity, present even in the original:

there's no call to GetNextFactionMember() ...




edit, I mean i sorta see how it works due to the GetDistanceBetween() condition
but that way of coding is ... peculiar.
  • Sabranic aime ceci

#5
Sabranic

Sabranic
  • Members
  • 306 messages

Yup that worked~!



#6
Sabranic

Sabranic
  • Members
  • 306 messages

that should work, but there's another peculiarity, present even in the original:

there's no call to GetNextFactionMember() ...

 

 

That's odd.  Well... on one hand...  I didn't write the original code.  On the other hand... I'd be lying if I said I could output better :X



#7
Sabranic

Sabranic
  • Members
  • 306 messages
void main()
{

	object oPC = GetEnteringObject();

	if (GetLocalInt(OBJECT_SELF, "done") == TRUE) return;

	location lTarget = GetLocation(GetWaypointByTag("wp_fresco_two"));

	
	
	if(!ReflexSave(oPC, 55, SAVING_THROW_TYPE_TRAP))
	{
		if (GetIsObjectValid(oPC) && GetDistanceBetween(GetObjectByTag("wp_climb_two") , oPC) <= 6.5f)
		{
			AssignCommand(oPC, ClearAllActions());
			
			AssignCommand(oPC, ActionJumpToLocation(lTarget));	
		}
	}
}

That work for bonus points?

 

Intent is to take whoever steps into the pit trap area and dumps then all alone in a hole.  There is a climb point they can use a rope for, or a dialog for someone not in the hole to lower them a rope to get out.



#8
kevL

kevL
  • Members
  • 4 056 messages
is there any need for the GetDistanceBetween() check? I could see it for the while() loop, but when tossing characters in one at a time I'm guessing it can be left out. have a look at this
 
void main()
{
	// use this to disable pitfall from some other event
	if (GetLocalInt(OBJECT_SELF, "done") == TRUE) return;


	object oPC = GetEnteringObject();

	// NOTE: Bypassing check for isPartyMember - anyone goes if their save is failed.
	if (GetIsObjectValid(oPC)
		&& !ReflexSave(oPC, 55, SAVING_THROW_TYPE_TRAP))
	{
		AssignCommand(oPC, ClearAllActions());

		location lTarget = GetLocation(GetWaypointByTag("wp_fresco_two"));
		AssignCommand(oPC, JumpToLocation(lTarget));
	}
}

  • Sabranic aime ceci

#9
Sabranic

Sabranic
  • Members
  • 306 messages

I don't even know what the distance check supposed to be doing or why it's there.  Fresco_two is the waypoint it zaps you to when you climb out of the pit.  Perhaps, (and this is purely conjecture on my part), it's to keep you from accidentally backing into the trap a second time immediately after climbing out? 

 

But frankly, IMHO... if you do that... you deserve to fall in again!  This is the tomb of horrors!  Not the "tomb of coddle the players who walk right back over the pit trap they just clawed free of!"

 

:D



#10
ArtemisJ

ArtemisJ
  • Members
  • 127 messages
Fresco_two is the waypoint it zaps you to when you climb out of the pit.

 

Why am I teleported to safety for (!ReflexSave)  ? :wacko:


  • Sabranic aime ceci

#11
Sabranic

Sabranic
  • Members
  • 306 messages

Hrm... I suspect the idea was to give you a saving throw to avoid falling in if you triggered it?  I was not the original author of much of the scripting here, so I cannot speak for Morbane's intent.



#12
ArtemisJ

ArtemisJ
  • Members
  • 127 messages

The fact that you failed the save makes me think the fresco waypoint should be where you end up if you fall in the trap..

 

But maybe I am misunderstanding the issue. :)


  • Sabranic aime ceci

#13
Sabranic

Sabranic
  • Members
  • 306 messages

No you're probably not.  If I am not making sense it's probably because I don't know what I am talking about.

 

:D