Jump to content

Help with creating a script for messagebox


Andyno

Recommended Posts

As you can see on this picture...

 

message.jpg

 

... I'm trying to make a simple script for this messagebox. When the player will choose 1st option, he will be teleported to custom XMarkerHeading. When he choose 2nd option, the menu will close and nothing happens.

 

Sounds like an easy task, but I have absolutely no clue how to "attach" these two options to appropriate commands (or scripts, or whatever).

Can someone help with with this, I have no scripting knowledge at all...

Link to comment
Share on other sites

What niston said. It would look something like this:

 

Message Property TZStartVertibirdMessage Auto
ObjectReference Property MyXMarker Auto 
Actor Property PlayerRef auto 

Event SomeEvent(actor akTarget, actor akCaster)

   Int Button = TZStartVertibirdMessage.Show()
   If Button == 0
       PlayerRef.MoveTo(MyXMarker)
   Elseif Button ==  1 
       ;do something else 
   EndIf 
   
EndEvent
Link to comment
Share on other sites

Well basically it all depends on what you'll use it on.

 

If you use it on a Activator/Door (...) use

Event OnActivate(ObjectReference refAction)
        ObjectReference refPlayer = Game.GetPlayer()
;...
EndEvent

So if you have a button you double click on it, choose apply script or create a new one and use the script Dybill provided, albeit with the Event from above. Afterwards fill out the properties.

 

 

If you use the script on a holotape use

Event OnEquipped(Actor akActor)
  if akActor == Game.GetPlayer()
;...
EndEvent

Obviously there are other events for triggerzones, books and whatnot but I think you want one of these

 

 

 

Also you might want to add the "AlwaysPersists" keyword to your teleport marker if you put it into an .esl format just to be on the safe side

Link to comment
Share on other sites

Yes, the vertibird should be an activator. Sorry, I should mention this in the 1st post. This is far as I can get: I click on "Add" in the "Papyrus Scripts" section, and that's it.

 

vertibird.jpg

 

I think I'm missing some very basic things... :sad:

 

So if you have a button you double click on it

What do you mean by this? The player should activate the vertibird as a whole object, not only some button.

Link to comment
Share on other sites

1. Click on new script and give it a name

2. Remove the "Const" tag

3. Make your script, save and compile it

4. Now you close the script and fill out the properties.

 

You can use "Autofill" on PlayerRef

Link the Xmarker in the properites to the Xmarker you have placed in the world. This is your Teleport Location

Link to comment
Share on other sites

1. Don't use "SomeEvent" he/she just typed this as an example. It doesn't exist.

 

 

 

 

 

2. You forgot the "()"

 

PlayerRef.moveto (TZStartVertibirdMarkerRef)

 

 

3.

The full Event Should look like this

(This goes directly after the Properties

Event OnActivate(ObjectReference refAction)
        ObjectReference refPlayer = Game.GetPlayer()

 Int Button = TZStartVertibirdMessage.Show()
   If Button == 0
       PlayerRef.MoveTo(TZStartVertibirdMarkerRef)
Endif 
EndEvent

 


 

Link to comment
Share on other sites

By properties you probably mean those 3 lines below the script name, right? So my final script should look like this?

Scriptname TZStartVertibirdScript extends ObjectReference

Message Property TZStartVertibirdMessage Auto
ObjectReference Property TZStartVertibirdMarkerRef Auto
Actor Property PlayerRef auto

Event OnActivate(ObjectReference refAction)
        ObjectReference refPlayer = Game.GetPlayer()

 Int Button = TZStartVertibirdMessage.Show()
   If Button == 0
       PlayerRef.MoveTo(TZStartVertibirdMarkerRef)
Endif
EndEvent

Now the compilation succeeded. I also clicked on "Auto-Fill All" button in the properties, and the script icon changed to plus symbol with pencil... I have no idea what it means, but I suppose it's correct...?

Link to comment
Share on other sites

  • Recently Browsing   0 members

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