Jump to content

Script help


Bennytheowl

Recommended Posts

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 by Bennytheowl
Link to comment
Share on other sites

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

end

Then in-game make a script

PlayerRef.additem MyItem 1 

And you will see the message.

Link to comment
Share on other sites

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

end

Then 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

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

 

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 by Bennytheowl
Link to comment
Share on other sites

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 by Bennytheowl
Link to comment
Share on other sites

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...