Zachc12385 Posted January 19, 2024 Posted January 19, 2024 here's my script --part 1 do trigger.action.setUserFlag(5, math.random(1, 10)) end --part 2 if trigger.misc.getUserFlag(5),1) == 5 then do mist.cloneInZone('Ground-1', {'New Trigger Zone-1','New Trigger Zone-2','New Trigger Zone-3','New Trigger Zone-4','New Trigger Zone-5','New Trigger Zone-6','New Trigger Zone-7','New Trigger Zone-8','New Trigger Zone-9','New Trigger Zone-10','New Trigger Zone-11','New Trigger Zone-12','New Trigger Zone-13','New Trigger Zone-14','New Trigger Zone-15','New Trigger Zone-16','New Trigger Zone-17','New Trigger Zone-18','New Trigger Zone-19','New Trigger Zone-20'}) offsetRoute = True end I've tried changing "if trigger.misc.getUserFlag(5),1) == 5 then" in many ways with no success. Part 1 of the script works fine but the 2nd part im having all sorts of issues. Please is there anyone who knows what is going wrong? I just want to spawn a random group in a random zone. I have no idea how to debug this
Kanelbolle Posted January 19, 2024 Posted January 19, 2024 (edited) Hi! Have not tested your code, but looks like its the ",1)" in your if statement. Should look like this: if trigger.misc.getUserFlag(5) == 5 then Here is an example i tested and works: trigger.action.setUserFlag(5, math.random(1, 2)) if trigger.misc.getUserFlag(5) == 2 then trigger.action.outText("Flag is correct!",20) else trigger.action.outText("Flag is wrong!",20) end Hope this helps Edited January 19, 2024 by Kanelbolle WARGAMES Servers: https://forum.dcs.world/topic/301046-wargames-server-pvp-and-pve-campaign-servers/ Scripts: RGC & SPGG https://github.com/AGluttonForPunishment/
Wrecking Crew Posted January 20, 2024 Posted January 20, 2024 Here is an example. It's long ... This is yours -- if trigger.misc.getUserFlag(5),1) == 5 then is missing a "(" like this Flag((5,1) == 5,,,, but I don't know if that actually works local msg = {} msg[#msg + 1]='Welcome to the Witches Hollo mission! \n \n' if trigger.misc.getUserFlag('30000') == 0 then -- All Four Objectives Still Alive -- Blue Counter F30000 is False msg[#msg + 1]='Blue must clear out the Witches Hollo of the Red HQ and three Red Camps. See the Briefing for HQ & camp target coordinates. \n \n' msg[#msg + 1]='Use JTAC Hummers to spot targets and laser designate. \n \n' msg[#msg + 1]='Go Blue! \n \n' msg[#msg + 1]='Blue to win: \n' msg[#msg + 1]='Destory the Red HQ and three camps: East Camp, Central, and West. \n \n' msg[#msg + 1]='See the Radio F10 Menu for mission options including Restart. \n \n' end if trigger.misc.getUserFlag('30000') == 1 then -- Three Objectives Still Alive if trigger.misc.getUserFlag('30101') == 0 then -- RDR VGrp01 HQ Alive msg[#msg + 1]='Very nice Blue pilots -- one camp was destroyed. \n \n' msg[#msg + 1]='Finish the mission objectives. Destroy the Red HQ building! \n' else -- RDR VGrp01 HQ Dead FT 30101 msg[#msg + 1]='Very nice Blue pilots -- the Red Headquarters was destroyed! \n \n' msg[#msg + 1]='Finish the mission objectives -- destroy the three Red camps at Witches Hollo. \n' end end if trigger.misc.getUserFlag('30000') == 2 then -- Two Objectives Destroyed, Two Still Alive if trigger.misc.getUserFlag('30101') == 0 and trigger.misc.getUserFlag('33001') == 0 then -- HQ & Central Camp Alive msg[#msg + 1]='Blue pilots -- destroy the Red Headquarters at Witches Hollo! \n \n' msg[#msg + 1]='The Central Red camp is also operational. \n \n' msg[#msg + 1]='Destroy these two targets to finish the mission objectives. \n' end if trigger.misc.getUserFlag('30101') == 0 and trigger.misc.getUserFlag('33101') == 0 then -- HQ & East Camp Alive msg[#msg + 1]='Blue pilots -- destroy the Red Headquarters at Witches Hollo! \n \n' msg[#msg + 1]='The East Red camp is also operational. \n \n' msg[#msg + 1]='Destroy these two targets to finish the mission objectives. \n' end if trigger.misc.getUserFlag('30101') == 0 and trigger.misc.getUserFlag('33201') == 0 then -- HQ & West Camp Alive msg[#msg + 1]='Blue pilots -- destroy the Red Headquarters at Witches Hollo! \n \n' msg[#msg + 1]='The West Red camp is also operational. \n \n' msg[#msg + 1]='Destroy these two targets to finish the mission objectives. \n' end if trigger.misc.getUserFlag('30101') == 1 then -- HQ Plus One Camp Dead msg[#msg + 1]='Very nice Blue pilots -- the Red Headquarters was destroyed! \n \n' msg[#msg + 1]='Finish the mission objectives -- destroy the last two Red camps at Witches Hollo: \n' if trigger.misc.getUserFlag('33001') == 0 then -- Central Camp Alive msg[#msg + 1]=' Central Camp \n' end if trigger.misc.getUserFlag('33101') == 0 then -- East Camp Alive msg[#msg + 1]=' East Camp \n' end if trigger.misc.getUserFlag('33201') == 0 then -- West Camp Alive msg[#msg + 1]=' West Camp \n' end msg[#msg + 1]='\n \n' end end if trigger.misc.getUserFlag('30000') == 3 then -- Three Objectives Destroyed if trigger.misc.getUserFlag('30101') == 0 then -- HQ Alive msg[#msg + 1]='Blue pilots -- the Red Headquarters building is still operatonal. \n \n' msg[#msg + 1]='Destroy this structure to complete the mission objectives and send the red dogs back to Kaspi! \n \n' end if trigger.misc.getUserFlag('33001') == 0 then -- Central Camp Alive msg[#msg + 1]='Blue pilots -- The Central Red camp is still operatonal. \n \n' msg[#msg + 1]='Destroy this fortification to complete the mission objectives! \n \n' end if trigger.misc.getUserFlag('33101') == 0 then -- East Camp Alive msg[#msg + 1]='Blue pilots -- the East Red camp is still operatonal. \n \n' msg[#msg + 1]='Destroy this fortification to complete the mission objectives! \n \n' end if trigger.misc.getUserFlag('33201') == 0 then -- West Camp Alive msg[#msg + 1]='Blue pilots -- the West Red camp is still operatonal. \n \n' msg[#msg + 1]='Destroy this fortification to complete the mission objectives! \n \n' end end if trigger.misc.getUserFlag('30000') > 3 then -- All Objectives Destroyed msg[#msg + 1]='Blue wins today hooray! Fun flying under the clouds. \n \n' msg[#msg + 1]='All mission objectives are met! \n \n' msg[#msg + 1]='Mop up any remaining Red units around Witches Hollo. \n \n' end trigger.action.outText(table.concat(msg), 25) Visit the Hollo Pointe DCS World server -- an open server with a variety of COOP & H2H missions including Combined Arms. All released missions are available for free download, modification and public hosting, from my Wrecking Crew Projects site.
Recommended Posts