Jump to content

Need help with salvage script for FO4 location clearing


Recommended Posts

I'm attempting to alter the "defaultclearlocationontriggerscript" so that a formlist of shipment items is given to the player when a location is cleared. This is what I've added:

....

SalvageCleared

Endif

EndEvent

Function SalvageCleared

Game.GetPlayer().AddItem(1sp_Shipment_FLST, 1, true)

Notification("Salvage complete")

EndFunction

 

I get several errors trying to compile:

 

extraneous input ' 1' expecting ID

mismatched input '\\r\\n' expecting LPAREN

Object reference not set to an instance of an object

 

Any help would be much appreciated

Link to comment
Share on other sites

I think it`s not a good idea to alter scripts, it`s better to attach another script. And I`m not sure what you are trying to achieve and if this is going to work but the compiler does not like your syntax. You can always check syntax in the Fallout 4 wiki. It also has some simple examples for any function.

 

Function SalvageCleared() ; it was missing brackets. You also need to add them anywhere you call this function.

 

Game.GetPlayer().AddItem(sp_Shipment_FLST, 1, true) ; the first thing in brackets must be the ID that you use in properties . The name of your property looks a bit weird. If it`s a formlist you need to tell the game the index of the intem. For example, Game.GetPlayer().AddItem(MyFormlist.GetAt(2)), 1, true) - give player an item that is index 2 in MyFormlist

 

Debug.Notification("Salvage Complete")

EndFunction

 

PS My apologies, I meant the Creation kit wiki, not Fallout 4.

Edited by kitcat81
Link to comment
Share on other sites

Thank you. I think I will take your advice though and change tactics. I was never very good at scripting skyrim and I've obviously forgotten what little I knew. I am adding a leveled list of resource shipments to boss chests instead, will accomplish more or less same thing. Your help and advice are much appreciated.

Link to comment
Share on other sites

I'm attempting to alter the "defaultclearlocationontriggerscript" so that a formlist of shipment items is given to the player when a location is cleared. This is what I've added:

....

SalvageCleared

Endif

EndEvent

Function SalvageCleared

Game.GetPlayer().AddItem(1sp_Shipment_FLST, 1, true)

Notification("Salvage complete")

EndFunction

 

I get several errors trying to compile:

 

extraneous input ' 1' expecting ID

mismatched input '\\r\\n' expecting LPAREN

Object reference not set to an instance of an object

 

Any help would be much appreciated

 

Following what kitkat81 said I'd agree not to modify vanilla scripts.

 

Relating to your original question though the reason you get compile errors is that you're calling and defining the SlavageCleared function incorrectly. You need the parenthesis on it. Also not sure if that script has import debug or not. If not then your notification line needs to be changed. Though you should use a Message and display it with .Show() instead

Message Property msgSalvageComplete auto const mandatory
 
SalvageCleared() ; call the function
 
Function SalvageCleared() ; define the function
    Game.GetPlayer().AddItem(1sp_Shipment_FLST, 1, true)
    Debug.Notification("Salvage complete") ; unless you have import debug in the script then the debug can be omitted.
    msgSalvageComplete.Show() ; get rid of the notification line and create a message then fill the property
EndFunction
Edited by BigAndFlabby
Link to comment
Share on other sites

Your help also much appreciated! I went with a non-script version which still has basically zero vanilla footprint, no mod conflicts likely (I hope), and more or less gets the same thing done. God, when I started this, I planned on quest aliases for each location with unique resource rewards upon clearing them. And then I realized I really don't remember any of the little scripting I used to know, and that there are some differences with skyrim ck on top of that. Anyway, thank you for your advice and instruction.

Link to comment
Share on other sites

  • Recently Browsing   0 members

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