Jump to content

How do i use fo4 edit to create a chem item that adds items to inventory?


Deleted4463020User

Recommended Posts

I want to create a craftable ammo box that when activated in the inventory it adds the respective ammo, for instance a box of shells could take 15 shells to create but add 15 shells back into my inventory when activated. I already have a good understanding of xedit however i cant seem to figure this out myself, any help would be brilliant.

Link to comment
Share on other sites

I'm pretty sure bullets and care packages would be handled the same way. Check out the Nuka Cola bottle comment here: http://forums.nexusmods.com/index.php?/topic/3777150-add-multiple-effects-in-fo4edit/?p=34443330

 

Edit: Comment #7 there discusses getting bottle cap after drinking Nuka Cola. That effect can be copied as a new ANYTHING that creates ITEM when consumed (selected). Immensely useful.

Link to comment
Share on other sites

Unless you created a new script called ".50AmmoAddScript" you need to change the script name back, as well as the other info. Only thing that should be changed is the FormID for the Cap reference at the end.

Also realize that unless you copy and edit the script, by default you'll only get 1 round each time the script activates as the amount given after use is controlled in the script itself.

Edited by lilkandeekid
Link to comment
Share on other sites

I'm running in circles with the same error. I tried to change only the object like you said (see screenshot), but FO4Edit forced me to change the formID name when copying as new item. The end result is a magic effect that does nothing when the item is consumed.

 

I wonder if this is because the "file name" and the script name are no longer identical (?). Is the only working option to edit my own script, then recompile and reference the edit?

 

Here's the decompiled version without any edits:

 

;/ Decompiled by Champollion V1.0.5

PEX format v3.9 GameID: 2

Source : g:\_F4\Art\Raw\Scripts\NukaColaBottleCapAdderSCRIPT.psc

Modified : 2013-10-14 09:52:48

Compiled : 2015-12-11 13:01:15

User : builds

Computer : RKVBGSBUILD05

/;

const ScriptName NukaColaBottleCapAdderSCRIPT extends ActiveMagicEffect

{ This script causes nuka products to add one bottlecap to the actor who consumes the drink. }

 

;-- Properties --------------------------------------

MiscObject Property Caps001 Auto

 

;-- Variables ---------------------------------------

 

;-- Functions ---------------------------------------

 

Function OnEffectStart(Actor akTarget, Actor akCaster)

akCaster.additem(Caps001 as Form, 1, False)

EndFunction

 

 

 

Link to comment
Share on other sites

;-- Properties --------------------------------------

MiscObject Property Caps001 Auto

 

Not sure if that may have something to do with it. So far all my items have been MISC so could be luck for me.

Also if youd like to test if your setup is working, try changing the item reference back to caps (or any misc object) to test :wink:

Edited by lilkandeekid
Link to comment
Share on other sites

Lots of testing last night/this morning confirms you are exactly right. Only MISC items are created by NukaColaBottleCapAdderSCRIPT. I created a bottlecap in one test, an Eyebot model in another test. Changing the new item to a noodle cup failed. It seems like NukaColaBottleCapAdderSCRIPT only needs to be edited and recompiled as a different script if the modder wants more than ONE item, or wants the consumed item to create something other than a MISC.

 

I'm reading through the Papyrus docs now to find the right syntax. My immediate goal is to get this working with a non-MISC. Beyond that, a more generic ConsumedAddsItem script would be nice. If there's a way to let the modder set NewItem/NumItem/SilentMsgFlag in FO4Edit instead of hard coding those values into the script (Caps001 as Form, 1, False), I'd like to find it. But my Papyrus skills aren't there yet. Lots of tinker, test, rinse, repeat going on.

Link to comment
Share on other sites

*** SNOOPY DANCE ***

 

NoodleCupStack "Noodle Cups" [ACTI:000D6E56]

 

;/ Decompiled by Champollion V1.0.5

PEX format v3.9 GameID: 2

Source : g:\_F4\Art\Raw\Scripts\DefaultAddItemOnActivate.psc

Modified : 2015-02-06 17:30:12

Compiled : 2015-12-11 12:53:21

User : builds

Computer : RKVBGSBUILD05

/;

ScriptName DefaultAddItemOnActivate extends ObjectReference

{ Give the player an item when they activate this reference. }

 

;-- Properties --------------------------------------

Form Property ItemToGive Auto

{ The Item to give to the player when this references is activated. }

int Property iNumberToGiveMin = 1 Auto

{ How many of the item are given? If always the same, Min and Max should be equal. Otherwise it's a random value between min/max }

int Property iNumberToGiveMax = 1 Auto

{ If Greater than the Min, the number given will be randomized between that value and this one. }

bool Property bDisableWhenDone = False Auto

{ Should this object disable when clicked? False by default. }

 

;-- Variables ---------------------------------------

 

;-- State -------------------------------------------

State done

 

Function OnActivate(ObjectReference akActionRef)

; Empty function

EndFunction

EndState

 

;-- State -------------------------------------------

Auto State Initial

 

Function OnActivate(ObjectReference akActionRef)

int iNumberToGive = 0

If (iNumberToGiveMin >= iNumberToGiveMax)

iNumberToGive = iNumberToGiveMin

Else

iNumberToGive = Utility.randomInt(iNumberToGiveMin, iNumberToGiveMax)

EndIf

akActionRef.AddItem(ItemToGive, iNumberToGive, False)

If (bDisableWhenDone)

Self.disable(False)

Else

Self.GoToState("done")

EndIf

EndFunction

EndState

 

 

 

Link to comment
Share on other sites

I suspect the Noodle Cup Stack can't be held in inventory... I think the stack is on a table and places 4 noodle cups into inventory when activated. Build Reference Info says there are 14 instances of the noodle stack in the game, but I can't get one to add in console. So I'm wandering around Diamond City Security now trying to find one of the instances :-D

 

Edit: Three stacks are on the counters at Power Noodles in Diamond City. The stack does not go into inventory... it creates 4 noodle cups in inventory as expected. Wish me luck as I run away from the guards with armloads of stolen noodles waving in the breeze.

 

I'm going to call that script from inside an object and see what happens.

 

Screenshots:

 

Noodle Cup Stack - http://steamcommunity.com/sharedfiles/filedetails/?id=626437859

Four Noodle Cups - http://steamcommunity.com/sharedfiles/filedetails/?id=626438144

Link to comment
Share on other sites

  • Recently Browsing   0 members

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