mastar891 Posted May 6, 2015 Share Posted May 6, 2015 So, I've had this problem for a while. Basically in scripts, if my NPC's aren't duplicates it's impossible for me to do: If everyone's dead, then run this. This is because what ends up happening is that I do: begin OnDeath If (Thisactor.GetDead == 1 && Thisotheractor.Getdead == 1) run this command EndiF End What ends up happening is that the script checks if everyone's dead after I kill the actor with this script and if they're not, nothing happens. So I'm forced to make the command run only once one actor is dead, which is...not what I want. I was wondering if anyone knew how to do it like in the Hoover Dam Battle where the script checked if all of General Oliver's soldiers are dead as well as General Oliver before ending the game. Link to comment Share on other sites More sharing options...
tomm434 Posted May 7, 2015 Share Posted May 7, 2015 (edited) Any gamemode script? Create quest, attach script to it begin gamemode if Actor1Ref.GetDead && Actor2Ref.GetDead ; do this endif endAnd every N seconds (N = quest script delay, 5 seconds by default) code will run Edited May 7, 2015 by tomm434 Link to comment Share on other sites More sharing options...
mastar891 Posted May 7, 2015 Author Share Posted May 7, 2015 (edited) So it worked, problem is. I can't go menumode: begin gamemode if Actor1Ref.GetDead && Actor2Ref.GetDead ; do this endif end Begin MenuMode set button to getbuttonpressed if doonce ==0 If (button ==0) {commands here primarily enabling stuff like Reference.Enable 1} EndIf If (button ==1) {commands here} EndIf EndIf End Edited May 7, 2015 by mastar891 Link to comment Share on other sites More sharing options...
tomm434 Posted May 7, 2015 Share Posted May 7, 2015 What you want to do here is bring menu before player. You can use token. Create Misc Item and attach script to it ScriptName MyTokenScript Begin OnAdd PlayerRef showmessage Yourmessage (with buttons) end Begin MenuMode set button to getbuttonpressed if doonce ==0 If (button ==0) PlayerRef.RenoveItem MyToken 1 1 {commands here} EndIf If (button ==1) PlayerRef.RenoveItem MyToken 1 1 {commands here} EndIf EndIf End and add that token when all NPC are dead via PlayerRef.AddItem MyToken 1 1When you do that - menu will show up Link to comment Share on other sites More sharing options...
mastar891 Posted May 7, 2015 Author Share Posted May 7, 2015 Okay so it works :D which is amazing! But the message keeps showing up every time you choose something. Here's the item: scn LTATOAlphaItemSCRIPT short doonce short button Begin OnAdd PlayerRef ShowMessage LTATOAlphaDestruction End Begin MenuMode set button to getbuttonpressed if doonce ==0 If (button ==0) (useless stuff that makes it really confusing to look at, they're all commands) PlayerRef.RemoveItem LTATOAlphaItem 1 1 EndIf If (button ==1) (useless stuff that makes it really confusing to look at, they're all commands) PlayerRef.RemoveItem LTATOAlphaItem 1 1 EndIf EndIf End And the Quest Script: scn LTATOStationChecker Begin Gamemode If (LTATOStupidRangerNEW.GetDead == 1 && LTATOAlphaSoldier1.GetDead == 1 && RSAlphaCastilloRef.GetDead ==1 && LTATOAlphaSoldier2.GetDead == 1 && LineholmREF.GetDead == 1 && LTATOAlphaSoldier3.GetDead == 1) SetStage LTAttackTheOutposts 30 PlayerRef.AddItem LTATOAlphaItem 1 1 EndIf End Link to comment Share on other sites More sharing options...
tomm434 Posted May 8, 2015 Share Posted May 8, 2015 You didn't do script blocker so script in gamemode executes every N seconds. Stop the quest or introduce a variable If all are dead if MyInt == 0 set MyInt to 1 PlayerRef.AddItem Mytoken 1 1 endif endif Link to comment Share on other sites More sharing options...
mastar891 Posted May 8, 2015 Author Share Posted May 8, 2015 So I did: scn LTATOStationChecker Begin Gamemode If (LTATOStupidRangerNEW.GetDead == 1 && LTATOAlphaSoldier1.GetDead == 1 && RSAlphaCastilloRef.GetDead ==1 && LTATOAlphaSoldier2.GetDead == 1 && LineholmREF.GetDead == 1 && LTATOAlphaSoldier3.GetDead == 1) SetStage LTAttackTheOutposts 30 int IntegerCheck set IntegerCheck to 0 if IntegerCheck == 0 set IntegerCheck to 1 PlayerRef.AddItem LTATOAlphaItem 1 1 EndIf EndIf End Didn't work. Link to comment Share on other sites More sharing options...
tomm434 Posted May 8, 2015 Share Posted May 8, 2015 That's right because you sen int to 0 every time script executes so IntegerCheck becomes 0 every N seconds. Script always executes from Top to Botton. This script executes from top to bottom every N seconds.Each variable is eval to 0 by default. Link to comment Share on other sites More sharing options...
mastar891 Posted May 8, 2015 Author Share Posted May 8, 2015 Yeah it doesn't work. I tried making an integer that would go for both scripts, but I guess integers aren't global. Link to comment Share on other sites More sharing options...
tomm434 Posted May 8, 2015 Share Posted May 8, 2015 Hm try this scn LTATOStationChecker int IntegerCheck Begin Gamemode If (LTATOStupidRangerNEW.GetDead == 1 && LTATOAlphaSoldier1.GetDead == 1 && RSAlphaCastilloRef.GetDead ==1 && LTATOAlphaSoldier2.GetDead == 1 && LineholmREF.GetDead == 1 && LTATOAlphaSoldier3.GetDead == 1) if IntegerCheck == 0 SetStage LTAttackTheOutposts 30 set IntegerCheck to 1 PlayerRef.AddItem LTATOAlphaItem 1 1 stopquest <quest to which this script attached> EndIf EndIf EndBecause it should work - token is added to player only one time so message should appear only one time Link to comment Share on other sites More sharing options...
Recommended Posts