Aller au contenu

Photo

Teleportscript doesn``t work


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

#1
mihlena

mihlena
  • Members
  • 141 messages
Can anybody say, why this script doesn`t work:






#include "events_h"
#include "utility_h"
#include "wrappers_h"
#include "log_h"
#include "plot_h"


const int MATTE_GLOW_VFX= 5021;


void main ()
{
object oPC = GetHero();
object oParty = GetParty( oPC );
object oWP = GetObjectByTag("wp_basis");
float fWait = 2.5;
event ev = GetCurrentEvent();
object oCreator = GetEventCreator(ev);
int nEventType = GetEventType(ev);
int nEventHandled = FALSE;
Log_Events ("",ev);
switch (nEventType)

{
case EVENT_TYPE_ENTER:
{

if(oCreator == oPC || IsFollower(oCreator) == TRUE)
{
object oTarget = UT_GetNearestObjectByTag(oPC, "u_objekt");
ApplyEffectVisualEffect(OBJECT_SELF, oTarget, MATTE_GLOW_VFX, EFFECT_DURATION_TYPE_TEMPORARY,3.0);
DelayEvent(2.0, OBJECT_SELF, Event(EVENT_TYPE_CUSTOM_EVENT_01));
}
}

case EVENT_TYPE_CUSTOM_EVENT_01:
{
UT_PCJumpOrAreaTransition("basis","wp_basis");

break;
}

}

if (!nEventHandled)
{
HandleEvent(ev, RESOURCE_SCRIPT_TRIGGER_CORE);
}
}


The script is in a Trigger. I want, that only the PC (or his hench)can make it work, but in fact every ramdomwalk-NSC, who enters the triggers, start the teleport of the SC.

#2
Sunjammer

Sunjammer
  • Members
  • 926 messages
You're missing a break statement from the end of your first case. Consequently anything that enters (including a hero/follower) falls through to the custom event case and executes that immediately (meaning a hero/follower will execute it twice: immediately and again after 2 seconds).

#3
mihlena

mihlena
  • Members
  • 141 messages
Thank you very much for your answer, I will try it with a break after my first case :)!