PeterTran Posted August 8, 2012 Share Posted August 8, 2012 How would you make a script that uses the moveto.player command on your target? Let's say I make a spell, where I cast it on an enemy and it does damage to the enemy (like a concentration spell), but once the enemy dies, it automatically moves the enemy to me via the console command moveto.player. I would appreciate any advice on how I would go about this. Thanks. Link to comment Share on other sites More sharing options...
Ghaunadaur Posted August 8, 2012 Share Posted August 8, 2012 First, this note from the wiki page: MoveTo() should be avoided for placing other actors in sight of the player, as they will suddenly appear in an unrealistic way If you want to use it anyways, you could place this script on the enemy: Scriptname MoveDeadEnemy extends Actor Event OnDeath(Actor akKiller) if(akKiller == Game.GetPlayer()) MoveTo(Game.Getplayer()) endif EndEvent Link to comment Share on other sites More sharing options...
PeterTran Posted August 8, 2012 Author Share Posted August 8, 2012 First, this note from the wiki page: MoveTo() should be avoided for placing other actors in sight of the player, as they will suddenly appear in an unrealistic way If you want to use it anyways, you could place this script on the enemy: Scriptname MoveDeadEnemy extends Actor Event OnDeath(Actor akKiller) if(akKiller == Game.GetPlayer()) MoveTo(Game.Getplayer()) endif EndEvent Thanks, I just needed something that I could work off of, and you gave me just that! Link to comment Share on other sites More sharing options...
steve40 Posted August 10, 2012 Share Posted August 10, 2012 (edited) This version will fade out the dead actor, move it 40 units in front of the player, then fade the dead actor back in. When "akKiller" is the player reference, there's no need to call Game.GetPlayer() again to get the player reference in the MoveTo command. Just call it on akKiller, it's more cpu efficient. I'm not sure if this would work if it is part of a magic effect script, as the effect would normally dispel when the actor dies. you could try ticking the "no death dispel" option in the magic effect. You might then need to call "Dispel()" at the end of the OnDeath() event block. Scriptname MoveDeadEnemy extends Actor {moves a dead actor to 40 units in front of the player} Event OnDeath(Actor akKiller) float aZ If akKiller == Game.GetPlayer() aZ = akKiller.GetAngleZ() Disable(true) ; disable me with fade-out effect MoveTo(akKiller, 40 * Math.Sin(aZ), 40 * Math.Cos(aZ), 0) Enable(true) ; enable me with fade-in effect EndIf EndEvent Edited August 10, 2012 by steve40 Link to comment Share on other sites More sharing options...
gasti89 Posted August 10, 2012 Share Posted August 10, 2012 (edited) Nevermind, you already fixed the typo :) Edited August 10, 2012 by gasti89 Link to comment Share on other sites More sharing options...
Recommended Posts