• 🏆 Texturing Contest #33 is OPEN! Contestants must re-texture a SD unit model found in-game (Warcraft 3 Classic), recreating the unit into a peaceful NPC version. 🔗Click here to enter!
  • It's time for the first HD Modeling Contest of 2024. Join the theme discussion for Hive's HD Modeling Contest #6! Click here to post your idea!

[Trigger] Set variable crash from using Pick every player

Status
Not open for further replies.
Level 5
Joined
Nov 14, 2004
Messages
159
This part is making crash, I can't figure out why. I'm trying set variable to make it easy to create multiboard (multiboard is pain in the ass for me).

  • Player Group - Pick every player in (All players) and do (Actions)
    • Loop - Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • ((Picked player) slot status) Equal to Is playing
          • Or - Any (Conditions) are true
            • Conditions
              • ((Picked player) controller) Equal to Computer
              • ((Picked player) controller) Equal to User
        • Then - Actions
          • Set someNum = (someNum + 1)
          • Set IsPlaying[(Player number of (Picked player))] = True
          • Set PlayerNum[someNum] = (Player number of (Picked player))
        • Else - Actions
Condition is 100% working fine, Im pretty sure, but there's something wrong with Set variable.

someNum is integer
IsPlaying is boolen array
PlayerNum is integer array

I'm trying to make it that.. example

there's player in slot 1
computer in slot 3
computer in slot 10

shows up in
IsPlaying
index 1 = true, 3 = true, 10 = true
PlayerNum
index 1 = 1, 2 = 3, 3 = 10

*edit - i tried even smaller trigger, it even still crash, what the heck? can someone explain?*

  • For each (Integer A) from 1 to 12, do (If (IsPlaying[(Integer A)] Equal to True) then do (Set PlayerNum[((Integer A) - someNum)] = (Integer A)) else do (Set someNum = (someNum + 1)))
 
Last edited:
Level 21
Joined
Jan 5, 2005
Messages
3,515
i havent done triggers in a while, but ti thought i would try these two out for fun. be warned these might not work :p

  • For each (Integer A) from 1 to 12, do (If (((Player((Integer A))) slot status) Equal to Is playing) then do (Set isplaying[(Integer A)] = True) else do (Do nothing))
  • For each (Integer A) from 1 to 12, do (Player Group - Pick every player in (All players matching (((Matching player) slot status) Equal to Is playing)) and do (Set PlayerNum[(somenum + 1)] = (Player number of (Picked player))))
i thinkt he first one will work but i am unsure about using the matching player function in the second one.

also how do u get triggers not to have that noob scroll bar?

the picked player thing u did i would have guessed to work but without trying it myself i dont know, the first trigger isnt to bas but the second one is harder, you need to define what players are aplying and what players arent. wait a sec i think i might know how to tackle this.


ok after thinking about it a little more, this i am 80% sure will work no problems

  • For each (Integer A) from 1 to 12, do (Actions)
    • Loop - Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • ((Player((Integer A))) slot status) Equal to Is playing
        • Then - Actions
          • Set isplay[(Integer A)] = True
          • Set someNum = (someNum + 1)
          • Set playernum[someNum] = (Integer A)
        • Else - Actions
          • Do nothing
 
Level 8
Joined
Sep 13, 2006
Messages
431
Ya, I think that should do it for ya.

However, the 'do nothing' is absolutely useless unless your intent is to waste processing power. In addition, you may want to have an else function that sets 'isplay[(IntegerA)] = false,' but it is not imperitive...
 
Status
Not open for further replies.
Top