alonsomartinez Posted October 10, 2009 Share Posted October 10, 2009 So im trying to make an amulet that teleports you directely into a cell i have the whole move to marker and everything down but when i get in the cell it glitches and i cant move im running but not moving. i took off the amulet but im still stuck did i do something wrong ? help Link to comment Share on other sites More sharing options...
paladicprince Posted October 10, 2009 Share Posted October 10, 2009 Since it's not working as intended I can only assume that yes you did do something wrong. But without seeing your script or getting some more details I can't tell you what. :) Link to comment Share on other sites More sharing options...
Pronam Posted October 10, 2009 Share Posted October 10, 2009 Indeed...posting the script would allow us to help you better.My best guess is that you didn't us a variable in a block for a 'doonce' kind of action and it is constantly teleporting the player to the marker, making you unable to move. Link to comment Share on other sites More sharing options...
paladicprince Posted October 10, 2009 Share Posted October 10, 2009 The OP PMed me the script he attached to the object. For reference here it is: scn teleport begin onequip player player.moveto mymarker end It may or may not work but adding a doonce variable is worth a try (I thought onequip blocks only ran on the frame the object was actually equipped - please correct me if I'm wrong). To add a doonce it would look like this: scn teleport Short DoOnce begin onequip player If (DoOnce == 0) player.moveto mymarker EndIf end Link to comment Share on other sites More sharing options...
Pronam Posted October 10, 2009 Share Posted October 10, 2009 It is a run-once begin block so it shouldn't matter indeed...MoveTo's cancel the block immediately (return) so it could not work at all.MoveTo is a difficult function to work with and has a lot of unpredicted results: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 from running two frames in a row or (2) Move the Moveto function to another block or another script....try to tackle it with this:scn teleport Short DoOnce begin onequip player If (DoOnce == 0) set DoOnce to 1 message "Teleporting", 5 if DoOnce == 0 player.moveto mymarker endif EndIfTrying to get rid of the 0 at all could help too, as the return/cancel do a LOT of unexpected things:scn teleport Short DoOnce Short DoEnd begin onequip player If (DoOnce == 0) set DoOnce to 1 set DoEnd to 1 EndIf Begin Gamemode if DoEnd == 1 set DoEnd to 2 set DoOnce to 2 if DoOnce == 1 player.moveto mymarker endif endif endif Link to comment Share on other sites More sharing options...
paladicprince Posted October 10, 2009 Share Posted October 10, 2009 Thanks for linking that bug information I'll need to remember it. Personally I'd use the second script pronam posted and it should work. :) Link to comment Share on other sites More sharing options...
David Brasher Posted October 11, 2009 Share Posted October 11, 2009 That script would make a one-time use teleportation amulet wouldn't it? Would this work for a reusable amulet? scn teleport Short DoOnce Short DoEnd begin onequip player If (DoOnce == 0) set DoOnce to 1 set DoEnd to 1 EndIf Begin Gamemode if DoEnd == 1 set DoEnd to 2 set DoOnce to 2 if DoOnce == 1 player.moveto mymarker endif endif endif Begin OnUnequip Set DoOnce to 0 Set DoEnd to 0 End Link to comment Share on other sites More sharing options...
paladicprince Posted October 11, 2009 Share Posted October 11, 2009 That script would make a one-time use teleportation amulet wouldn't it? Would this work for a reusable amulet? scn teleport Short DoOnce Short DoEnd begin onequip player If (DoOnce == 0) set DoOnce to 1 EndIf Begin Gamemode if (DoOnce == 1) set DoOnce to 0 player.moveto mymarker endif That would work. It's also not hard to make an amulet that would teleport you back to where you were when you put it on once you took it off. I'm not gunna write the code but I think the command you'd need is getplayercell, save that function to a raf variable and in the unequip block set doonce to 2 which will run a script just like the one above except it will use the stored reference cell to teleport to. Link to comment Share on other sites More sharing options...
Recommended Posts