ghostfc3s Posted September 21, 2019 Share Posted September 21, 2019 (edited) I am curious on how these items work, like Aft command item, or the gas mask clean item. They are defined as consumables but return to, or I am assuming a new version is placed in the players inventory. Anyone have a tutorial on how those items work? Edited September 21, 2019 by ghostfc3s Link to comment Share on other sites More sharing options...
niston Posted September 21, 2019 Share Posted September 21, 2019 You can use the OnActivate event on a consumable to re-add the consumable to player's inventory and call some custom script procedure that does whatever activating the item should do. Link to comment Share on other sites More sharing options...
icestormng Posted September 21, 2019 Share Posted September 21, 2019 Use a potion and attach a magic effect to it. The magic effect has a script attached. Use the OnEffectStart event and re-add the potion to the players inventory first. Then do the stuff you want to do with the toggle. Ideally check first whether the actor consuming the activator is the player just to be sure nothing weird happens when someone else got their hands on the toggle. An example script for your magic effect. Scriptname YourToggleMagicEffect extends ActiveMagicEffect {Does some stuff and gives the used potion back to the player} Potion Property TheToggleItem Auto Const Mandatory {The potion to give back to the player} ; =========================================================================================================================== ; Check whether the player used the item and give a potion back to his/her inventory. ; =========================================================================================================================== Event OnEffectStart( Actor akTarget, Actor akCaster ) If( Game.GetPlayer() != akTarget ) return EndIf Game.GetPlayer().AddItem(TheToggleItem , 1, True) ;Do your stuff here... EndEvent Link to comment Share on other sites More sharing options...
ghostfc3s Posted September 22, 2019 Author Share Posted September 22, 2019 Thank you very much! Link to comment Share on other sites More sharing options...
ghostfc3s Posted September 24, 2019 Author Share Posted September 24, 2019 (edited) I added the item, added the construction receipt so I can craft it. When activating it item does what I want however the activator still wont return to the player. The script is identical to your script just the item name is changed. Event OnEffectStart( Actor akTarget, Actor akCaster ) If( Game.GetPlayer() != akTarget ) return EndIf Game.GetPlayer().AddItem(DontbeaPyscho , 1, True) EndEvent The script is attached to the magic effect named Taunt Property name = playerconsumetaunttype = keywordValue = playerconsumetaunt That's is the same setup as the psycho Not sure what I'm doing wrong here. Edited September 24, 2019 by ghostfc3s Link to comment Share on other sites More sharing options...
icestormng Posted September 24, 2019 Share Posted September 24, 2019 You also need to fill in the properties in CK for that script in your magic effect. This is needed to tell the game which Form you actually mean with "DontbeaPyscho". The name in your script doesn't need to be equal to the name of the object. Link to comment Share on other sites More sharing options...
ghostfc3s Posted September 24, 2019 Author Share Posted September 24, 2019 Under magic effect, right hand lower is script name, included is Taunt, click on that opens up properties for script taunt attached I click add properties and I get a whole wack of options, Using AFT as an example I attempted type Potion flag const name taunt in documentation included the script I received error mismatched "event" expecting script name And error script taunt:object reference not set to an instance of an object. I dont do any coding so this all chinese to me. Link to comment Share on other sites More sharing options...
icestormng Posted September 24, 2019 Share Posted September 24, 2019 No. there should be a list of properties. You have to click on the property with the name "DontbeaPyscho" and on the right, you have to select the item you want to assign to this property. In this case it's the toggle item. You don't want to create a new property. Link to comment Share on other sites More sharing options...
ghostfc3s Posted September 24, 2019 Author Share Posted September 24, 2019 (edited) When I add the script if I do not create a new property all of the options are grayed out https://www.nexusmods.com/fallout4/images/159949 Edited September 24, 2019 by ghostfc3s Link to comment Share on other sites More sharing options...
icestormng Posted September 24, 2019 Share Posted September 24, 2019 You forgot a part of my script. The like that stars with âžPropertyâ this declares it. You have to declare properties before you can use them. Your script also shouldnât compile without. Link to comment Share on other sites More sharing options...
Recommended Posts