Bennytheowl Posted January 20, 2016 Share Posted January 20, 2016 (edited) I'm fairly new to scripting so i'm really at a loss here but can anyone provide me with a script I can use for teleportation, and describe it please? My scenario is that I want to display a message box with the option to stay in the Mojave or travel onwards to a new location, picking stay will close the box until you decide you want to leave and leaving the mojave will close it. I've tried with multiple different guides and scripts but it just doesnt save or work. Not sure if this is that right place to post this but help would be greatly appreciated. EDIT: I thought i'd mention that i've tried taking existing scripts and just changing them but they're too complicated or different from what i'm trying to do that they're lost on me. Edited January 21, 2016 by Bennytheowl Link to comment Share on other sites More sharing options...
TommInfinite Posted January 20, 2016 Share Posted January 20, 2016 Create a misc item (MyItem). Attach an object script to it. (MyItemScript) scriptname MyItemScript int iButton begin OnAdd PlayerRef showmessage MyMessage ; message should contain buttons! they correspond with conditionds below. endif begin menumode set iButton to GetButtonPressed if iButton == 0 ; if player pushes button#0 PlayerRef.Moveto MyMarkerRef ; player gets teleported to marker PlayerRef.RemoveItem MyItem 1 ; don't forget to remove item from player's inventory elseif iButton == 1 PlayerRef.Moveto MyMarker2Ref ; player gets teleported to another marker PlayerRef.RemoveItem MyItem 1 endif endThen in-game make a script PlayerRef.additem MyItem 1 And you will see the message. Link to comment Share on other sites More sharing options...
Bennytheowl Posted January 20, 2016 Author Share Posted January 20, 2016 Create a misc item (MyItem). Attach an object script to it. (MyItemScript) scriptname MyItemScript int iButton begin OnAdd PlayerRef showmessage MyMessage ; message should contain buttons! they correspond with conditionds below. endif begin menumode set iButton to GetButtonPressed if iButton == 0 ; if player pushes button#0 PlayerRef.Moveto MyMarkerRef ; player gets teleported to marker PlayerRef.RemoveItem MyItem 1 ; don't forget to remove item from player's inventory elseif iButton == 1 PlayerRef.Moveto MyMarker2Ref ; player gets teleported to another marker PlayerRef.RemoveItem MyItem 1 endif endThen in-game make a script PlayerRef.additem MyItem 1 And you will see the message. Sorry if i'm being completely stupid, maybe I should explain better. Example; In Old world blues you can activate the crashed object at the drive in, you get a message box that asks if you want to observe or walk away. Observing takes you to the big empty, walking away closes the box, to which you can activate again later. Basically I need it to work as an activator. I have child like knowledge so forgive me if you covered it in your script. Link to comment Share on other sites More sharing options...
Ladez Posted January 20, 2016 Share Posted January 20, 2016 Use an OnActivate event then. If one on the buttons should make you stay where you are, simply have no code run for that button index. Modified version of Tomms script, attach it to your activator: scriptname MyActivatorScript int iButton begin OnActivate if IsActionRef Player ; only run if activated by the player showmessage MyMessage ; message should contain buttons! they correspond with conditionds below. endif endif begin menumode set iButton to GetButtonPressed if iButton == 0 ; if player pushes button#0 PlayerRef.Moveto MyMarkerRef ; player gets teleported to marker endif end Link to comment Share on other sites More sharing options...
Bennytheowl Posted January 20, 2016 Author Share Posted January 20, 2016 (edited) Use an OnActivate event then. If one on the buttons should make you stay where you are, simply have no code run for that button index. Modified version of Tomms script, attach it to your activator: scriptname MyActivatorScript int iButton begin OnActivate if IsActionRef Player ; only run if activated by the player showmessage MyMessage ; message should contain buttons! they correspond with conditionds below. endif endif begin menumode set iButton to GetButtonPressed if iButton == 0 ; if player pushes button#0 PlayerRef.Moveto MyMarkerRef ; player gets teleported to marker endif end Thank you very much, both of you. I find it very hard to understand the official guides so I really appreciate the help. Edited January 20, 2016 by Bennytheowl Link to comment Share on other sites More sharing options...
Bennytheowl Posted January 20, 2016 Author Share Posted January 20, 2016 Damn, now i'm having issues with it saving. The script will just asked me if I want to save everytime I try and close it. Link to comment Share on other sites More sharing options...
Hallgarth Posted January 21, 2016 Share Posted January 21, 2016 That means there's a problem with the script and it can't save it. Link to comment Share on other sites More sharing options...
TommInfinite Posted January 21, 2016 Share Posted January 21, 2016 It means there is a mistake in the script. You need to isr GECK PowerUP. Find it here on Nexus. Link to comment Share on other sites More sharing options...
Bennytheowl Posted January 21, 2016 Author Share Posted January 21, 2016 (edited) I installed powerup, but my scripts are STILL getting errors. I don't know what i'm doing wrong. Even just changing something simple like "Scn OTWACtravelscript" and then leaving all the script provided the same will yield a "SCRIPT: Script 'OTWACtravelscript' line 11: nested begin/end blocks are not allowed" warning, which s gibberish to me.Sorry if this is somewhat irritating to those trying to help, i'm VERY new to scripting. Edited January 21, 2016 by Bennytheowl Link to comment Share on other sites More sharing options...
TommInfinite Posted January 21, 2016 Share Posted January 21, 2016 You put "begin-end" inside begin-end block. This is not giberish. Just post the script and I or someone else will take a look . Link to comment Share on other sites More sharing options...
Recommended Posts