Abinath Posted October 20, 2017 Share Posted October 20, 2017 Ok so I'm making a house mod for New Vegas and I'm a noob at scripting (I have some experience with coding but basically none with the GECK). What I am trying to do right now is make a script that when NPCs walk into an area they unequip all their gear then re-equip it when they leave the area. I've been reading a little about it but can't quite figure it out. Any help would be appreciated. Link to comment
Guest Posted October 20, 2017 Share Posted October 20, 2017 First you need to create a simple script for a trigger. For it you can check this links: Blocktypes 1. OnTriggerEnter - http://geck.bethsoft.com/index.php?title=OnTriggerEnter 2. OnTriggerLeave - http://geck.bethsoft.com/index.php?title=OnTriggerLeave 3. OnTrigger - http://geck.bethsoft.com/index.php?title=OnTrigger Commands for getting npc ref id and weapons/clothes 1. GetActionRef - http://geck.bethsoft.com/index.php?title=GetActionRef 2. GetEquippedObject - http://geck.bethsoft.com/index.php?title=GetEquippedObject 3. GetEquipped - http://geck.bethsoft.com/index.php?title=GetEquipped Equip/unequip EquipItem - http://geck.bethsoft.com/index.php?title=EquipItem UnequipItem - http://geck.bethsoft.com/index.php?title=UnequipItem Second, create an new Activator and attach your script to this activator. Third, open location in the Geck and create a new primitive, and after choose your activator. how to create primitives - http://geck.bethsoft.com/index.php?title=Creating_Primitives Simple scripts for trigger. For example GetEquippedObject getting equipped item from upperbody slot. If you will get an error with saving script, try to launch the Geck through nvse_loader with "-editor" flag. For npcs only scn SomeScriptName ref rClothes ref rNPCActor Begin OnTriggerEnter if GetActionRef != player ;all npcs exclude player Set rNPCActor to GetActionRef ;get npc reference that entered in trigger set rClothes to rNPCActor.GetEquippedObject 2 ;get equipped reference from slot 2(upperbody) for npc rNPCActor.UnequipItem rClothes ;unequip item for npc Return endif END Begin OnTriggerLeave if GetActionRef != player Set rNPCActor to GetActionRef ;get npc reference that entered in trigger rNPCActor.equipItem rClothes ;equip item for npc that you unequipped on enter Return endif END For especial npc(s) only scn SomeScriptName ref rClothes ref rNPCActor Begin OnTriggerEnter if GetActionRef == SomeRefName ;only if SomeRefName entered into the trigger Set rNPCActor to GetActionRef set rClothes to rNPCActor.GetEquippedObject 2 rNPCActor.UnequipItem rClothes Return endif END Begin OnTriggerLeave if GetActionRef == SomeRefName Set rNPCActor to GetActionRef rNPCActor.equipItem rClothes Return endif END Link to comment
Abinath Posted October 20, 2017 Author Share Posted October 20, 2017 I knew I needed a primitive and activator. Just didnt know how to write the script. I knew what I needed in the script and it was basically exact what you wrote I just didnt know the way to write it (Correct format and language). Thanks massively that was a big help You are definitely going in the Credits now If I wanted to make the script also unequip other clothes like hats or necklaces would I just need to add more rclothes ref, set, equips and unequips for example scn SomeScriptNameref rClothesref rClothes2ref rNPCActorBegin OnTriggerEnterif GetActionRef != player ;all npcs exclude playerSet rNPCActor to GetActionRef ;get npc reference that entered in triggerset rClothes to rNPCActor.GetEquippedObject 2 ;get equipped reference from slot 2(upperbody) for npcset rClothes2 to rNPCActor.GetEquippedObject 8rNPCActor.UnequipItem rClothes ;unequip item for npcrNPCActor.UnequipItem rClothes2ReturnendifENDBegin OnTriggerLeaveif GetActionRef != playerSet rNPCActor to GetActionRef ;get npc reference that entered in triggerrNPCActor.equipItem rClothes ;equip item for npc that you unequipped on enterrNPCActor.equipItem rClothes2ReturnendifEND or would I need to create different scripts with that function in it? Link to comment
Guest Posted October 21, 2017 Share Posted October 21, 2017 If I wanted to make the script also unequip other clothes like hats or necklaces would I just need to add more rclothes ref, set, equips and unequips...Yeah, just add more things inside the blocks that you need Link to comment
Abinath Posted October 21, 2017 Author Share Posted October 21, 2017 Thats what I thought but as I said I'm not familiar with New Vegas' scripting language. Thanks again it was a HUGE! help Link to comment
Guest Posted October 21, 2017 Share Posted October 21, 2017 You're welcome If you'll need more help with scripting or another technical stuff, just say Link to comment
Abinath Posted October 21, 2017 Author Share Posted October 21, 2017 Thank you very much. It's very much appreciated. I've started work on the quest side of my mod so I may have to take you up on that offer at some point lol Link to comment
Abinath Posted October 26, 2017 Author Share Posted October 26, 2017 Ok so I need a little more help with two things actually. Without any spoilers. I'm trying to make it so the player has to activate some message boxes then choose the option they want then the option does its effects and adds a number to a var. (first problem, I dont know how or where to script in the effects of their choice) Then when the var reaches a certain point it progresses the quest to the next stage. (second problem, I dont know how to make a quest script that checks the var)I think what I need to do is have the script for their message box choice add +1 to the var (which I dont know where to write or apply the script) then have the quest script detect if it equals the needed number then advance the quest. So basically Script on Quest scn QuestScript int StoredVar begin onTrigger if StoredVar == 4 SetStage Quest 2 endif end Script on message box Choice scn MBChoiceScript getInt StoredVar begin onActivate set StoredVar to + 1 end Link to comment
Guest Posted October 26, 2017 Share Posted October 26, 2017 Ok so I need a little more help with two things actually. Without any spoilers. I'm trying to make it so the player has to activate some message boxes then choose the option they want then the option does its effects and adds a number to a var. (first problem, I dont know how or where to script in the effects of their choice) Then when the var reaches a certain point it progresses the quest to the next stage. (second problem, I dont know how to make a quest script that checks the var) I think what I need to do is have the script for their message box choice add +1 to the var (which I dont know where to write or apply the script) then have the quest script detect if it equals the needed number then advance the quest. So basically Script on Quest scn QuestScript int StoredVar begin onTrigger if StoredVar == 4 SetStage Quest 2 endif end Script on message box Choice scn MBChoiceScript getInt StoredVar begin onActivate set StoredVar to + 1 end The first thing about messages it's - how you want to trigger this messages? By trigger or By interacting with some item or by a quest script? It's a bit hard to explain how todo, so, I just drop to you some script examples right down belowSecond, if you want to manupulating with quest vars, check this example: Quest Name - Some name Quest Id - TestQuest123 Var from quest - Somevariabletocheck In the non-quest script you can get/set/do something by this - <Quest Id>.<Var from quest> Example - TestQuest123.Somevariabletocheck Manipulating examples let TestQuest123.Somevariabletocheck := some new value ;changing let NewVar := TestQuest123.Somevariabletocheck ;copying value from this quest var to another if TestQuest123.Somevariabletocheck == some value ;checking/comparing endif Some stuff from geck wiki to check Deep tutorial about custom menus - http://geck.bethsoft.com/index.php?title=Adding_an_Options_Menu NVSE Expressions (operators)- https://geck.bethsoft.com/index.php?title=NVSE_Expressions Creating messages - http://geck.bethsoft.com/index.php?title=Message ShowMessage - http://geck.bethsoft.com/index.php?title=ShowMessage MessageBoxEx - https://geck.bethsoft.com/index.php?title=MessageBoxEx String Variable - https://geck.bethsoft.com/index.php?title=String_Variable String Formatting - https://geck.bethsoft.com/index.php?title=String_Formatting Let instead Set - https://geck.bethsoft.com/index.php?title=Let User Defined Function - https://geck.bethsoft.com/index.php?title=User_Defined_Function Call - https://geck.bethsoft.com/index.php?title=Call GetStage - http://geck.bethsoft.com/index.php?title=GetStage Example Scripts. scn QuestScript int StoredVar int SomeVar1 int SomeVar2 ;more quest vars begin gamemode if StoredVar == somenumber ;do something endif if GetStage Quest == StageId ;do something endif ;example for quest script after as the trigger sent result if GetStage Quest == 2 ;do something ;calling Messagescript for Player call MBChoiceScript player endif end scn SomeTriggerScript begin onTrigger if Quest.StoredVar == 4 SetStage Quest 2 endif ;example for trigger if you don't want to add this in the quest script if Quest.StoredVar == 4 if GetActionRef == player call MBChoiceScript player ensid endif end Message Script that been called scn MBChoiceScript int MenuState int oButton ;// -1=Wait Imput, 0=OptionA, 1=OptionB, ... ref rActor begin function {rActor} Set oButton to -1 If rActor != Player return elseif rActor == Player if MenuState == 0 let MenuState := 1 showmessage MessageID endif endif if MenuState == 1 set oButton to GetButtonPressed if oButton == 0 ; first button ;do something let Quest.StoredVar := some value elseif oButton == 1 ; Second button ;do something more elseif oButton == 2 ; Third button ;if exit return ;elseif ... ;elseif oButton == 7 ; Eight button, up to nine buttons(but i recomend using 8 only) endif let MenuState := 0 endif end Message script by interacting something scn MBChoiceScript int MenuState int iButton ref user begin onActivate let User := GetActionRef If GetActionRef != Player User.Activate return elseif GetActionRef == Player if MenuState == 0 let MenuState := 1 showmessage MessageIDName elseif MenuState == 2 ; for more steps endif endif end begin GameMode if GetInSameCell Player == 0 Return endif if MenuState == 1 let iButton := GetButtonPressed if iButton == 0 ; first button ;do something let InserQuestID.StoredVar += 1 elseif iButton == 1 ; Second button return ;elseif ... endif ;up to nine buttons let MenuState := 0 endif end Link to comment
Abinath Posted October 27, 2017 Author Share Posted October 27, 2017 Thank you so much It's a big help Link to comment
Recommended Posts
Archived
This topic is now archived and is closed to further replies.