Jump to content

Need help learning script


Recommended Posts

Hello everyone. I'm new to scripts and need a solid tutorial series or mentor that will show me the basics. Everything I've seen so far either shows me the wrong subject or is using advanced techniques without showing how to do them.

 

If anyone can point me in the right direction, it would be a god send.

 

 

The reason I need scripts is because I'm trying to make a fast travel mod (yes I know mods exist already but none felt right for me).

 

I need to make an object that upon activation creates a menu

  • Commonwealth
  • Far Harbor
  • Nuka World

Under which there will be a list of settlements to fast travel to once discovered.

Link to comment
Share on other sites

If you're looking to have your Papyrus syntax highlighted in Notepad++ you can follow this tutorial. It takes all of 2 minutes to set up. I would have spent hundreds of hours staring at Notepad++ without any syntax highlighting, and it's definitely a noticeable quality of life improvement.

 

Keep in mind that this is specific to Fallout 4 Papyrus syntax, which is slightly different to previous titles such as Skyrim.

Link to comment
Share on other sites

ok so I'm chugging along but I've hit a snag. I'm following this tutorial [x] but my code isn't being recognized and I can't seem to find the problem.

int Count

Message Poperty aaafastbellm Auto
Message Poperty aaafastbellm2 Auto
Message Poperty aaafastbellm3 Auto

Event OnActivate(ObjectReference aaafastbell)
	Count = Count + 1
	If Count == 1
		aaafastbellm.show()
	ElseIf Count == 2
		aaafastbellm2.show()
	ElseIf Count == 3
		aaafastbellm3.show()
	Else
		debug.notification("stahp")
	EndIf
EndEvent

The common error messages are below. Any instruction on what I'm doing wrong wold be most apreciated

  1. auto flag not allowed
  2. unknown user flag aaafastbellm (id for a message box)
  3. script variable property already defined
Link to comment
Share on other sites

I'm guessing that you want to keep those properties constant? That is, you don't want to change them via script at any point. Add the Const flag after each of the properties. You're unable to omit the Const flag if the script itself is flagged as Const. I also add the Mandatory flag to Auto Const properties, so that it will notify me if they're undefined.

 

You'll want to define the properties as such:

Message Property aaafastbellm Auto Const Mandatory
Message Property aaafastbellm2 Auto Const Mandatory
Message Property aaafastbellm3 Auto Const Mandatory

If that either isn't the case or doesn't solve it, then you'll also notice that you've got a typo in the word "Poperty". Fix that up and that might solve things if your script doesn't have the Const flag.

Link to comment
Share on other sites

Message forms can't be passed as an objectreference, which I think is what lead to error #2.

 

So instead:

Event OnActivate(ObjectReference akActionRef)
          ; where akActionRef is the object that activated this object
          if akActionRef == < insert expected object here >
                ; code
          endif
EndEvent

And for your count variable, it only needs to be:

count += 1

No need to assign the variable to itself in order to increment or deincrement.

 

Yeah the auto flag not allowed error sounds like your script is tagged to be const, which isn't allowed unless the properties are also const.

Edited by TheDungeonDweller
Link to comment
Share on other sites

your script won't work that way. You need one main message which will contain that three locations as menu items. Messages have a very good feature. They return clicked menu item as int so you can use that for your task. So your script should look like this:

Message Property MainMessageProperty Auto
Message Property aaafastbellm Auto
Message Property aaafastbellm2 Auto
Message Property aaafastbellm3 Auto

Event OnActivate(ObjectReference akActionRef)
 if akActionRef == Game.getplayer()
  int ibutton = MainMessageProperty.Show()
  if ibutton == 0 ;first menu item clicked in main message
   aaafastbellm.show()
  ElseIf ibutton == 1 ;second menu item clicked in main message
   aaafastbellm2.show()
  ElseIf ibutton == 2 ;third menu item clicked in main message
   aaafastbellm3.show()
  Else ;exit, fourth or any other than previous items clicked 
   debug.notification("stahp")
  EndIf
 endif
EndEvent

If your properties never change their initial values then you should add Const flag to them as KernallsEgg suggested

Edited by shavkacagarikia
Link to comment
Share on other sites

I'm not trying to achieve a menu yet. The goal of the tutorial was to have 3 different messages appear by activating an object 3 different times.

 

so in my instance I have an altered settler bell which in my first two script exercises said a message upon activation.

  • activation 1 "test1"
  • activation 2 "test 2"
  • activation 3 "test 3"
  • activation >3 "stahp"

the first tutorials worked just fine its unfortunate that fallout4's scripts is so much different to skyrim :T

Link to comment
Share on other sites

  • Recently Browsing   0 members

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