SpartanISW108 Posted October 6, 2014 Share Posted October 6, 2014 I'm looking to make what I think would be a simple mod but I have no idea how to do it exactlyBasically, what I want to do is make the scarf mod, only use one scarf, but when you equip it you get a menu that asks if you'd like it to cover your face, simple yes no question, and then equip the appropriate scarf for your optionI looked into messages, but I can't seem to find a function that'd get me to equip something if one button is pressed Link to comment Share on other sites More sharing options...
Ladez Posted October 7, 2014 Share Posted October 7, 2014 What you need is some scripting. Specifically you need to use an OnEquip block, which will run when the object (scarf) it is attached to is equipped. Use that to show a message, which you should create in the GECK. The message form should have two buttons, "Yes" and "No" I imagine, and the order you place them is important because you need to use GetButtonPressed in the script to determine which one have been pressed. First button have the index 0, second is 1, and so on. Here's an example. ScriptName ScarfScript short bMenu short iButton Begin OnEquip Player ShowMessage ScarfMessage ; Do you want covered version? | Yes | No Set bMenu to 1 End Begin MenuMode 1002 If bMenu Set iButton to GetButtonPressed If iButton == 0 ; Selected "Yes" ElseIf iButton == 1 ; Selected "No" EndIf Set bMenu to 0 EndIf End The MenuMode block runs whenever you're in the inventory section of your Pip-Boy (1002), but notice that the if statement prevents it from doing anything unless you've equipped the scarf first (bMenu variable is set.) This should get you started. You still need to switch out the covered/uncovered version according to the selection and equip it. Link to comment Share on other sites More sharing options...
SpartanISW108 Posted October 7, 2014 Author Share Posted October 7, 2014 (edited) I don't want to clutter up my inventory with multiple objects of the same thing, how would I go about doing this in the script?I have outfitwastelandscarf and outfitwastelandscarf02 (face cover version)Do you think you could write me a script that'd satisfy that?EDIT:This is the current script ScriptName ScarfScript short bMenu short iButton Begin OnEquip Player ShowMessage WastelandScarfMsg ; Cover Face? | Yes | No Set bMenu to 1 End Begin MenuMode 1002 If bMenu Set iButton to GetButtonPressed If iButton == 0 ; Selected "Yes" player.unequipitem outfitwastelandscarf 1 player.unequipitem outfitwastelandscarf02 1 player.removeitem outfitwastelandscarf 1 player.removeitem Outfitwastelandscarf02 1 player.additem OutfitWastelandScarf02 1 player.equipitem OutfitWastelandScarf02 1 ElseIf iButton == 1 ; Selected "No" player.unequipitem outfitwastelandscarf 1 player.unequipitem outfitwastelandscarf02 1 player.removeitem outfitwastelandscarf 1 player.removeitem Outfitwastelandscarf02 1 player.additem OutfitWastelandScarf 1 player.equipitem OutfitWastelandScarf 1 EndIf Set bMenu to 0 EndIf End But it doesn't appear to be working for me Edited October 7, 2014 by ilyasw Link to comment Share on other sites More sharing options...
Ladez Posted October 7, 2014 Share Posted October 7, 2014 Try this. The OnUnequip block will revert you back to the uncovered version when you unequip it. Make sure you attach the script to both versions of the scarf, and make sure that you have a message called WastelandScarfMsg with two buttons. ScriptName ScarfScript short bMenu short iButton Begin OnEquip Player ShowMessage WastelandScarfMsg ; Cover Face? | Yes | No Set bMenu to 1 End Begin OnUnequip Player Player.RemoveItem OutfitWastelandScarf 99 1 Player.RemoveItem OutfitWastelandScarf02 99 1 Player.AddItem OutfitWastelandScarf 1 1 End Begin MenuMode 1002 If bMenu Set iButton to GetButtonPressed Player.RemoveItem OutfitWastelandScarf 99 1 Player.RemoveItem OutfitWastelandScarf02 99 1 If iButton == 0 ; Selected "Yes" Player.AddItem OutfitWastelandScarf02 1 1 Player.EquipItem OutfitWastelandScarf02 0 1 ElseIf iButton == 1 ; Selected "No" Player.AddItem OutfitWastelandScarf 1 1 Player.EquipItem OutfitWastelandScarf 0 1 EndIf Set bMenu to 0 EndIf End Link to comment Share on other sites More sharing options...
SpartanISW108 Posted October 7, 2014 Author Share Posted October 7, 2014 That script causes a CTD for some reason O.o I'm not proficient enough in scripting to see why, it crashes when I first try to equip the scarf Link to comment Share on other sites More sharing options...
Ladez Posted October 7, 2014 Share Posted October 7, 2014 (edited) Yeah I wasn't thinking straight when I wrote that. Here's a new version, tested ingame. ScriptName ScarfScript short bMenu short iButton Begin OnEquip Player ShowMessage WastelandScarfMsg ; Cover Face? | Yes | No Set bMenu to 1 End Begin OnUnequip Player Player.RemoveItem OutfitWastelandScarf 99 1 Player.RemoveItem OutfitWastelandScarf02 99 1 Player.AddItem OutfitWastelandScarf 1 1 End Begin MenuMode 1002 If bMenu Set iButton to GetButtonPressed Player.RemoveItem OutfitWastelandScarf 99 1 Player.RemoveItem OutfitWastelandScarf02 99 1 If iButton == -1 Return ElseIf iButton == 0 Player.AddItem OutfitWastelandScarf02 1 1 Player.EquipItem OutfitWastelandScarf02 0 1 ElseIf iButton == 1 Player.AddItem OutfitWastelandScarf 1 1 Player.EquipItem OutfitWastelandScarf 0 1 EndIf Set bMenu to 0 EndIf End You need to close and reopen your Pip-Boy after equipping/unequipping the scarf though. I can't think of a way to update the inventory otherwise by script. Sorry if that is an inconvenience. Edited October 7, 2014 by Ladez Link to comment Share on other sites More sharing options...
SpartanISW108 Posted October 7, 2014 Author Share Posted October 7, 2014 Still for some reason causes a CTD as soon as I equip the scarf, either of them. Just before what'd normally get me to the menu Link to comment Share on other sites More sharing options...
Ladez Posted October 7, 2014 Share Posted October 7, 2014 (edited) Ugh, that's what happens when you don't sleep and try to write code, you make a general mess of things. NVAC was preventing the crashes for me. :facepalm: After removing it and pounding my head a few times everything became clear. I guess removing the scarf in the middle of everything messed it up (because the script is running ON the scarf.) In this version I add and equip the covered version before removing the uncovered version. Now it also properly updates your Pip-Boy inventory without you having to close and reopen, although why it does it now and didn't before is still a mystery to me. I've divided it into two scripts. Attach this to the uncovered (regular) version: ScriptName ScarfScript short bMenu short iButton Begin OnEquip Player ShowMessage WastelandScarfMsg ; Cover Face? | Yes | No Set bMenu to 1 End Begin MenuMode 1002 If bMenu Set iButton to GetButtonPressed If iButton == -1 Return ElseIf iButton == 0 Player.AddItem OutfitWastelandScarf02 1 1 Player.EquipItem OutfitWastelandScarf02 0 1 RemoveMe EndIf Set bMenu to 0 EndIf End Attach this to the covered version: ScriptName ScarfScript02 Begin OnUnequip Player Player.AddItem OutfitWastelandScarf 1 1 RemoveMe End It's tested (without NVAC this time.) Hope it works out! Edited October 7, 2014 by Ladez Link to comment Share on other sites More sharing options...
SpartanISW108 Posted October 7, 2014 Author Share Posted October 7, 2014 Yes that works thanks so much :) Link to comment Share on other sites More sharing options...
Recommended Posts