Jump to content

Recommended Posts

Posted

Is it possible to count the number of specific flags?

 

I mean, for example,

 

There are eight flags for specific activities -11,12,13....18 and I want to display the number of randomly activated flags from the list.

If flag 11, 14 true -> display '2'

or if flag 12,15,16,17 true -> display '4'

of course all flags true -> display '8'

 

I don't wanna write all possible combinations, just need simpler way to do that via triggers or scripts. Any suggestions?

Posted

Each time you set a flag to true, you increment the same common flag.

 

Once> Whatever> Flag 11 on, Flag 10 increase 1

Once> Whatever> Flag 12 on, Flag 10 increase 1

...

 

 

To display the message you gotta use the scripting system.

Once>whatever> trigger.action.outText(trigger.misc.getUserFlag('10'), 20)

 

 

Or use the scripting system entirely.

 

local timesTrue = 0

for i = 11, 18 do

if trigger.misc.getUserFlag(i) > 0 then

timesTrue = timesTrue + 1

end

end

trigger.action.outText('The number of flags set to true is: ' .. timesTrue, 20)

The right man in the wrong place makes all the difference in the world.

Current Projects:  Grayflag ServerScripting Wiki

Useful Links: Mission Scripting Tools MIST-(GitHub) MIST-(Thread)

 SLMOD, Wiki wishlist, Mission Editing Wiki!, Mission Building Forum

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...