So ActionJumpToLocation (via assigncommand) doesn’t work, I know the OnEnter trigger works because the creature speaks the line I assigned it to speak: AssignCommand(oBeetle, SpeakString(“Yahoo!”));
I also know the object I want the creature to jump to exists because I used GetTag on the object and then used the SpeakString command again and the creature verified that the object exists (I currently removed it from the script).
I did exactly as ActionJumpToLocation told me to do, what could I possibly be missing?
Oh and please note I have improved my scripting habits
// Get the creature who triggered this event.
object oBeetle = GetEnteringObject();
// Only fire for creatures.
// Only fire for creatures tagged 'Beetle'.
if (GetTag(oBeetle) == "Beetle")
//Speak Yahoo as a debugging method
//Get Object to teleport to
object oHole = GetNearestObjectByTag("Hole");
//Teleports Beetle to 'Hole' object
First off thanks for the feedback, ClearAllActions did the trick. Without it, nothing worked. I removed the barriers, no change. I added FALSE is the second parameter, no change. Also ActionJumpToLocation didn’t work. But yea, ClearAllActions before the jump did the trick. Thank you!
I read the SetCommandable but not exactly sure how it’s related to this specific situation, it was also confusing in the example where it’s written
assigns them an animation to play.
then, to insure that they do not just
click to move away and cancel the animation,
I imagine the person who wrote the example made a mistake there as NPC’s don’t click to move away under normal circumstances. Sorry to nitpick but it got me confused.
What you need to do, as shown in the example, is to SetCommandable(FALSE) to prevent AI from cancelling your actions until they’re finished. The final action has to be a command to SetCommandable(TRUE), which enables AI again.
SetCommandable() controls whether action queue of a creature can be modified, either by itself or by scripts (which - in my opinion - should have a separate argument).
This is good advice, but I think it is worth mentioning that SetCommandable(TRUE) has to be scheduled as a final action right before a non-action call to SetCommandable(FALSE), which should go last:
AssignCommand(oBeetle, ClearAllActions()); // not an action
AssignCommand(oBettle, SetCommandable(FALSE)); // not an action
Otherwise the creature will deadlock.
I also think that while @Proleric is on point about use of SetCommandable, making a non-patrolling creature jump to a point usually shouldn’t require it (since it’s instant). It’s definitely useful for complex actions where it can be used to prevent the PC from breaking the chain by talking to the creature or when there are nearby enemies.
It doesn’t really cancel your action, but it may make another call to ClearAllActions(), which cancels all actions (hence the name). This function is used whenever something has stop what it was doing and do something else now, i.e. spotted an enemy -> ClearAllActions() (cancel movement, etc) -> DetermineCombatRound().
Not using ClearAllActions() in your beetle script schedules the jump after what it was doing, but in the meantime many things many happen to disturb the action queue.