panzersharkcat Posted March 4, 2016 Share Posted March 4, 2016 (edited) scn 00MSWADornanScript short HasBeenHiredshort TSCBaseshort Relaxshort DoTSCOnce int CombatStyleRangedint CombatStyleMeleeint IsFollowingDefaultint IsFollowingLongint FollowerSwitchAggressiveint Waiting ref ScottDornanREF Begin GameModeif (DoTSCOnce != 1)set HasBeenHired to 0set TSCBase to 0set CombatStyleRanged to 1set CombatStyleMelee to 0set IsFollowingDefault to 0set IsFollowingLong to 0set FollowerSwitchAggressive to 0set Waiting to 0set Relax to 0set DoTSCOnce to 1EndIfEnd ;Begin OnLoadset ScottDornanREF to GetSelf ; equip Dornan's uniform when not following and on duty shiftif (ScottDornanREF.HasBeenHired == 0 && ScottDornanREF.GetInCell 00MSEmbassyStaffRooms == 0)if (ScottDornanREF.GetItemCount 00MSMarineArmorNPC >= 1)EquipItem 00MSMarineArmorNPC 1 1endifif (ScottDornanREF.GetItemCount 00MSTSCFieldHatNPC >= 1)EquipItem 00MSTSCFieldHatNPC 1 1endifif (ScottDornanREF.GetItemCount 00MSGlassesDornan >= 1)EquipItem 00MSGlassesDornan 1 1endifendifEnd It keeps telling me HasBeenHired is an invalid variable, even though it works in recruiting him and getting him to follow. Same with ScottDornanREF. That's the reference used where I placed him. Any ideas what I'm doing wrong? (He's a TSC sergeant from TSC Vegas. Intending to amend the follower script I made so he wears off duty clothing when he's in the TSC Embassy Staff Room or told to relax.) Edited March 4, 2016 by panzersharkcat Link to comment Share on other sites More sharing options...
Belthan Posted March 4, 2016 Share Posted March 4, 2016 The compiler doesn't like it because ScottDornanREF is a reference variable instead of an actual persistent REF. A reference variable can be set to an instance of any object, so the compiler tends to barf on anything that isn't generic to all objects. That is, ScottDornanREF.GetInCell is okay because you can call GetInCell on any reference, but ScottDornanREF.HasBeenHired is not okay because it would only work for objects that have a HasBeenHired variable declared in their object script, and the compiler doesn't resolve those dependencies. Anyway, if the code is in his object script, you can skip the indirection and just check HasBeenHired directly: if (HasBeenHired == 0 && GetInCell 00MSEmbassyStaffRooms == 0)In fact, you could probably do away entirely with the ScottDornanREF variable, since reference functions in an object script will operate on the self by default. Also, BEGIN OnLoad is commented out, so the code that follows it is currently outside the scope of any block, which will probably cause other unexpected behavior if it compiles. Link to comment Share on other sites More sharing options...
panzersharkcat Posted March 4, 2016 Author Share Posted March 4, 2016 Oh, the commenting out was something I did while editing in here. Forgot to erase it. Thanks. I was basing this partly on the Hidden Valley paladin scripts. Link to comment Share on other sites More sharing options...
panzersharkcat Posted March 5, 2016 Author Share Posted March 5, 2016 Is there a script command that tells an NPC to equip their best armor if previously told to equip something else? Link to comment Share on other sites More sharing options...
hlp Posted March 5, 2016 Share Posted March 5, 2016 UnEquip the current item then make a change to their inventory. It should select the "best" to equip. There could be a visual glitch though. Link to comment Share on other sites More sharing options...
panzersharkcat Posted March 5, 2016 Author Share Posted March 5, 2016 I tried that. It puts him in his underwear temporarily. Not really what I want to do. Link to comment Share on other sites More sharing options...
Belthan Posted March 5, 2016 Share Posted March 5, 2016 I use the following technique. It all happens in the same frame so I haven't noticed any visual glitches, but your mileage may vary. cesForceEquip is a dummy armor I created for this purpose. You could technically use any armor in its place, but if the character happens to have the same type in their inventory with less than 100% condition, the last function call could remove the damaged one and leave the new one in their inventory, which could potentially be exploited to get free 100% armor repair. additem cesForceEquip 1 equipitem cesForceEquip removeitem cesForceEquip 1 Link to comment Share on other sites More sharing options...
panzersharkcat Posted March 6, 2016 Author Share Posted March 6, 2016 Alright. Thanks. Will test it out. See how it works. Running into an issue where certain dialog option won't pop up. There's supposed to be a greeting for if you shoot up on chems or drink in uniform and then talk to him. Never triggers. It's set to check if target has anything from a form list equipped and if player has any of the chem effects. Never shows up. Thinking of just scrapping it. Link to comment Share on other sites More sharing options...
panzersharkcat Posted March 10, 2016 Author Share Posted March 10, 2016 (edited) It works. For some reason, he seems to trigger my mines even though I used a script to give him Light Step and, you know, he's a teammate. He also aggroes if I accidentally shoot him. His hiring script has SetPlayerTeammate 1 and SetIgnoreFriendlyHits 1. Set ScottDornanREF.Waiting to 0Set ScottDornanREF.Relax to 0Set ScottDornanREF.IsFollowingDefault to 1Set ScottDornanREF.IsFollowingLong to 0Set ScottDornanREF.CombatStyleRanged to 1Set ScottDornanREF.CombatStyleMelee to 0Set ScottDornanREF.HasBeenHired to 1SetPlayerTeammate 1SetIgnoreFriendlyHits 1Player.AddPerk 00MSWAPerkDornanUnequipItem 00MSOffDutySoldierOutfitDornan 1 1AddItem PSCDummyArmor 1EquipItem PSCDummyArmor 1RemoveItem PSCDummyArmor 1AddItem PSCDummyHelmet 1EquipItem PSCDummyHelmet 1RemoveItem PSCDummyHelmet 1ScottDornanREF.evpEDIT: Never mind, Figured it out. Needed to add the player to his faction. Edited March 12, 2016 by panzersharkcat Link to comment Share on other sites More sharing options...
Recommended Posts