Jump to content

Fallout 4 scripting help


zax141

Recommended Posts

Hi, I'm trying to make it so you can restock a fridge on activate.

Everything works about from if you take the items then restock they don't reappear.

Scriptname RestockColaCaravanZanda extends ObjectReference
ObjectReference Property restockxmarker Auto
MiscObject  Property Caps001 Auto

Event OnActivate(ObjectReference akActionRef)

	If (Game.GetPlayer().GetItemCount(Caps001) >= 2500)
		Game.GetPlayer().RemoveItem(Caps001, 2500)
		restockxmarker.disable()
		restockxmarker.enable()
	Else
		Debug.MessageBox("Not enough caps")
	EndIf
EndEvent 
Link to comment
Share on other sites

 

Can you give some more info on what is the fridge and what script is supposed to spawn items? Does the fridge have other scripts attached to it ? I don`t see any functions that can spawn anything in this script.

 

 

The script is referencing a xmarker which is an enable parent for some nuka-cola.

I want to be able to respawn that nuka cola everytime the script is activated.

 

This is setup in a exterior cell so I'm not able to call a cell reset.

Also, I understand I can do what I want to do with PlaceAtMe But It would take considerably longer to reset everything up to use the placeatme func.

Link to comment
Share on other sites

I have alot of items set up in the fridge.

It would take me at least a few hours to marker the current spots, set rotations, then edit my script.

I also have 3 other shelves set up full of items setup the same way as I have the fridge.

 

I was hoping I was missing something and could use restockxmarker.reset or something of the like.

But From testing I couldn't figure it out, which is why I made this post.

Guess I'm going to have to do placeatme anyway.

Link to comment
Share on other sites

On reset things go to their default state. It makes containers get filled, scripts reset. But marker has no default "filled" state. I don`t think it can work this way even if it`s a parent. It can disable /enable children when it`s disabled/enabled itself. If you use nifskope you can create an alternative version of the fridge with nodes for all your items and use "movetonode" function. The Pickmeup station from the Nuka world dlc is getting reset manually by a script that adds items . Though it`s a container, so it`s easier.

Edited by kitcat81
Link to comment
Share on other sites

You can the MoveTo script to position everything at an offset from the fridge instead of placing markers (and can match rotation to the orientation of the fridge). You can use Excel/Google Sheets to sort of automate the process of making the script:

Place/Move Automation

Alternatively, you could use PlaceAtNode, and add the nodes to the Mesh. The nodes would need to be empty NiNodes with unique names (attached as children to the base node). It would be easier to position things, you wouldn't have to guess positioning. And I think you could control orientation using rotation of the NiNode.

Link to comment
Share on other sites

On reset things go to their default state. It makes containers get filled, scripts reset. But marker has no default "filled" state. I don`t think it can work this way even if it`s a parent. It can disable /enable children when it`s disabled/enabled itself. If you use nifskope you can create an alternative version of the fridge with nodes for all your items and use "movetonode" function. The Pickmeup station from the Nuka world dlc is getting reset manually by a script that adds items . Though it`s a container, so it`s easier.

Yeah, thanks.

I'm new to python, I've only ever touched HTML, CSS, Java, and Lua.

So this is my first venture, You've explained the functions well enough to the point where I see what I wanted would never work in the context I wanted it to work in.

 

 

Consider this matter resolved

 

You can the MoveTo script to position everything at an offset from the fridge instead of placing markers (and can match rotation to the orientation of the fridge). You can use Excel/Google Sheets to sort of automate the process of making the script:

 

Place/Move Automation

 

Alternatively, you could use PlaceAtNode, and add the nodes to the Mesh. The nodes would need to be empty NiNodes with unique names (attached as children to the base node). It would be easier to position things, you wouldn't have to guess positioning. And I think you could control orientation using rotation of the NiNode.

 

I took a look at both of those methods, currently writing something like this.

Event OnItemAdded(ObjectReference akSourceContainer)
	if CaravanContainerFridge.GetItemCount(steakDog) >= 1)
		CaraDogSteak.enable()
else
		CaraDogSteak.disable()
	endIf
EndEvent

Link to comment
Share on other sites

  • Recently Browsing   0 members

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