Teleport onDeath not working?
Skorum
Member Posts: 4
Hi All
I'm trying to write a script that when the PC dies he is teleported to a waypoint (deadpool)
I've written the script from Lilac Soul's generator and set it to run from OnPlayerDeath
Whilst the visual element plays, the PC is not teleported and to confuse things further, cannot respawn.
/*
* Script generated by LS Script Generator, v.TK.0
*
* For download info, please visit:
* http://nwvault.ign.com/View.php?view=Other.Detail&id=1502
*/
// Put this OnPlayerDeath (module properties).
// Clears all actions and jumps the caller to the provided object.
// (Useful when this needs to be delayed.)
void ClearAndJumpToObject(object oDestination);
void ClearAndJumpToObject(object oDestination)
{
ClearAllActions();
JumpToObject(oDestination);
}
void main()
{
object oParty;
effect eVFX;
object oTarget;
// Get the PC who died.
object oPC = GetLastPlayerDied();
// Find the location to which to teleport.
oTarget = GetWaypointByTag("deadpool");
// Teleport the PC's party.
eVFX = EffectVisualEffect(VFX_IMP_UNSUMMON);
// Loop through the PC's party.
oParty = GetFirstFactionMember(oPC, FALSE);
while ( oParty != OBJECT_INVALID )
{
ApplyEffectToObject(DURATION_TYPE_INSTANT, eVFX, oParty);
DelayCommand(3.0, AssignCommand(oParty, ClearAndJumpToObject(oTarget)));
// Update the loop.
oParty = GetNextFactionMember(oPC, FALSE);
}
}
What am I doing wrong?
I'm trying to write a script that when the PC dies he is teleported to a waypoint (deadpool)
I've written the script from Lilac Soul's generator and set it to run from OnPlayerDeath
Whilst the visual element plays, the PC is not teleported and to confuse things further, cannot respawn.
/*
* Script generated by LS Script Generator, v.TK.0
*
* For download info, please visit:
* http://nwvault.ign.com/View.php?view=Other.Detail&id=1502
*/
// Put this OnPlayerDeath (module properties).
// Clears all actions and jumps the caller to the provided object.
// (Useful when this needs to be delayed.)
void ClearAndJumpToObject(object oDestination);
void ClearAndJumpToObject(object oDestination)
{
ClearAllActions();
JumpToObject(oDestination);
}
void main()
{
object oParty;
effect eVFX;
object oTarget;
// Get the PC who died.
object oPC = GetLastPlayerDied();
// Find the location to which to teleport.
oTarget = GetWaypointByTag("deadpool");
// Teleport the PC's party.
eVFX = EffectVisualEffect(VFX_IMP_UNSUMMON);
// Loop through the PC's party.
oParty = GetFirstFactionMember(oPC, FALSE);
while ( oParty != OBJECT_INVALID )
{
ApplyEffectToObject(DURATION_TYPE_INSTANT, eVFX, oParty);
DelayCommand(3.0, AssignCommand(oParty, ClearAndJumpToObject(oTarget)));
// Update the loop.
oParty = GetNextFactionMember(oPC, FALSE);
}
}
What am I doing wrong?
0
Comments
If you look at the default OnDeath script in module properties, I think you'll find that the PC is resurrected first. Although that script is a little complicated, it's the best starting point for modification.
DelayCommand(2.5, PopUpGUIPanel(oPC, GUI_PANEL_PLAYER_DEATH));
I created a test mod and tried to get the player to port to a specific waypoint and I could not get it to work in the ondeath script.
The only thing I could get to work is doing the port in the OnPlayerRespawn script.
I checked my script, and it restores the player back to full health, removes ill-effects, and then jumps them to the spirit plane.