• 🏆 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!

[Solved] how to make this work for many players

Status
Not open for further replies.
Level 11
Joined
Dec 5, 2009
Messages
846
Hey, i think my index variable is the fault here, because when player 1 uses the ability, index will be set to 1, but if player 2 uses the same right after player 1 then the index will be set to 2 and it all will be fail, so is there any other way to do this so it will work for more players?

Thank you!

  • Storing Elements
    • Events
      • Unit - A unit Starts the effect of an ability
    • Conditions
      • Or - Any (Conditions) are true
        • Conditions
          • (Ability being cast) Equal to Fire
    • Actions
      • Set U = (Triggering unit)
      • Set Index = (Player number of (Owner of U))
      • Set Unit[Index] = (Triggering unit)
      • Set one[Index] = 1
      • Set two[Index] = 2
      • Set three[Index] = 3
      • Set four[Index] = 4
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • StoringElements[Index] Equal to 4
        • Then - Actions
          • Game - Display to (All players matching ((Matching player) Equal to (Owner of Unit[Index]))) the text: You already have 4 ...
        • Else - Actions
          • Set StoringElements[Index] = (StoringElements[Index] + 1)
 
Level 9
Joined
Jul 10, 2011
Messages
562
i really dont get what youre trying to do ^^

what are these lines for Oo

  • Set one[Index] = 1
  • Set two[Index] = 2
  • Set three[Index] = 3
  • Set four[Index] = 4
and why you use
  • Set U = (Triggering unit)
  • Set Index = (Player number of (Owner of U))
okay index is for lazyness but why you set triggering unit in 2 globals?

and whats the if/then/else for? because thats the only part changing at all...
 
Level 11
Joined
Dec 5, 2009
Messages
846
Nevermind what i am trying to do because you will just be an questionmark if i explain just help me with the indexing this is only a small bit of a really big trigger.

And I forgot to remove U it shouldn't be there ^^ it should be instead

  • Set Index = (Player number of (Owner of Triggering Unit))
So is there a way to make this work for many players? :)
 
Level 9
Joined
Jul 10, 2011
Messages
562
so...your trigger works for every player. and the
when player 1 uses the ability, index will be set to 1, but if player 2 uses the same right after player 1 then the index will be set to 2
is as it is...if teal would use it index would be 3....whats wrong there? when you set index equal to player number then it is like that...what you want it to be?
 
Level 11
Joined
Dec 5, 2009
Messages
846
yeah and it will be fail the index for player 1 shall be 1 all the time not change to 2 and the index for player 2 should be 2 all the time index shouldn't change do u understand what i mean?
 
Level 3
Joined
Aug 20, 2012
Messages
36
  • if - conditions
    • Stacks[(Player number of)(Owner of(Triggering unit))] equal to 4
    • Then - Actions
      • Game - Display to (Player((Owner of(Triggering unit) the text: You already have 4 stacks
    • Else - Actions
      • Set Stacks[(Player number of)(Owner of(triggering unit))] = Stacks[(Player number)(Owner of(triggering unit))] + 1
"Stacks" is an array integer variable.

My first post on here, this should be what u want to do. I dont remember the exact names of the functions though, I'll take a look when I come home.
 
Last edited:
Level 11
Joined
Dec 5, 2009
Messages
846
so the thing that fucks this up is that i put (Player number of (Owner of (UnitVariable)) in a integer variable right? I should skip the variable and only put this in instead, because the variable will be changed everytime another player uses the ability fire and everything will be fucked up, thank u! :)
 
Level 2
Joined
May 17, 2011
Messages
10
Here is what I think will work I am not 100% sure and I dont really understand what you wanna do. Maybe the thing you need looks like this. I hope I got it right. Im not very good at this, but I try. :3

  • Events
  • Unit - A unit Starts the effect of an ability
  • Conditions
    • Or - Any (Conditions) are true
      • Conditions
        • (Ability being cast) Equal to Fire
  • Actions
    • Set U = (Triggering unit)
    • Player Group - Pick every player in (All Players) and do actions.
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Picked Player) equal to Player 1 (Red)
          • StoringElements[Index] Equal to 4
        • Then - Actions
          • Game - Display to (All players matching ((Owner of (Triggering Unit)) Equal to (Picked Player))) the text: You already have 4 ...
          • Set StoringElements[Index] = (StoringElements[Index] + 1)
        • Else - Actions
          • Do Nothing
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Picked Player) equal to Player 2 (Blue)
          • StoringElements[Index] Equal to 4
        • Then - Actions
          • Game - Display to (All players matching ((Owner of (Triggering Unit)) Equal to (Picked Player))) the text: You already have 4 ...
          • Set StoringElements[Index] = (StoringElements[Index] + 1)
        • Else - Actions
          • Do Nothing
And so on.
 
Level 3
Joined
Aug 20, 2012
Messages
36
so the thing that fucks this up is that i put (Player number of (Owner of (UnitVariable)) in a integer variable right? I should skip the variable and only put this in instead, because the variable will be changed everytime another player uses the ability fire and everything will be fucked up, thank u! :)

Yes I think you've got it. You don't need a unit variable, cause that just means more work :)
 
Status
Not open for further replies.
Top