Difference between revisions of "Talk:MoveTo"

1,139 bytes added ,  11:36, 22 February 2009
Player.MoveTo in OnEquip/OnAdd blocks
imported>Shademe
imported>QQuix
(Player.MoveTo in OnEquip/OnAdd blocks)
Line 86: Line 86:


:: oh.. fine ! Thanks :) But a separate persistent skele ref. is not practically possible. so placeatme should work fine, I guess ! -- [[User:Shademe|shademe]] 00:54, 15 September 2008 (EDT)
:: oh.. fine ! Thanks :) But a separate persistent skele ref. is not practically possible. so placeatme should work fine, I guess ! -- [[User:Shademe|shademe]] 00:54, 15 September 2008 (EDT)
==Player.MoveTo in OnEquip/OnAdd blocks==
Moving the player with MoveTo within an OnEquip or OnAdd block causes an infinite loop: the Player is MoveTo'd every frame thereafter.
It seems that instead of "acting as a return" the MoveTo function crashes the script AFTER moving the player or, somehow, prevents the script from complete successfully. The game engine seems to notice that the block did not complete successfully and tries to run it again the next frame. The Player will be moved again. The script will crash again, etc, etc. Final result: the player is moved to the same spot every frame - cannot move from there. This crash effect may be related to the fact that the scripted object is moved with the player as it does not occur in an OnDrop block or if the object is added to an NPC/container (in both cases, the object stays behind and is not moved with the player)
Workarounds: (1) add controls to prevent the MoveTo function to run two frames in a row or (2) Move the Moveto function to another block or another script.
Obs: PositionCell does not have this problem.  [[User:QQuix|QQuix]] 11:36, 22 February 2009 (EST)
Anonymous user