• 🏆 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!
  • 🏆 Hive's 6th HD Modeling Contest: Mechanical is now open! Design and model a mechanical creature, mechanized animal, a futuristic robotic being, or anything else your imagination can tinker with! 📅 Submissions close on June 30, 2024. Don't miss this opportunity to let your creativity shine! Enter now and show us your mechanical masterpiece! 🔗 Click here to enter!

Create Unit for all players except tempPlayer

Status
Not open for further replies.
Level 2
Joined
Jun 18, 2012
Messages
24
Hello again fellow members!
So i need help with another trigger that i just cant figure out...

I created this trigger
  • Event
    • Time - Elapsed game time is 10.00 seconds
  • Conditions
  • Actions
    • Set tempPlayerGroup = (All players matching (((Matching player) controller) Equal to User))
    • Set tempPlayer = (Random player from tempPlayerGroup)
    • Player - Make tempPlayer treat Player 1 (Red) as an Enemy
  • -------- above action is looped to all players, 1-11 --------
    • Custom script: call DestroyForce(udg_tempPlayerGroup)
This trigger chooses a random player, but I have this trigger which creates a unit for every player, tho I do not want that unit to be created for that Random player (tempPlayer).

This is how my create unit trigger looks like
  • Events
    • Time - Elapsed game time is 10.00 seconds
  • Conditions
    • (Player 1 (Red) slot status) Equal to Is playing
  • Actions
    • Unit - Create 1 Elf for Player 1 (Red) at (Center of spawn <gen>) facing Default building facing degrees
TLDR; Create unit for every player without the picked random player
 
Level 2
Joined
Jun 18, 2012
Messages
24
loop through all players and check if the picked player is temp player. In the else block create the unit for that picked player.

Can you please do that in TRIGGER? Im having a hard time figuring out how to actually do that :/ Anyways thanks for such fast reply!

Ok i think i got it?

  • Time
    • Elapsed game time is 10.00 seconds
  • Conditions
  • Actions
    • For each (Integer B) from 1 to 11, do (Actions)
      • Loop - Actions
        • If (Player Equal to tempPlayer) then do (Do nothing) else do (Unit - Create 1 Footman for Player 1 (Red) at (Center of (Playable map area)) facing Default building facing degrees)
Tho this only creates a unit for Player 1 (Red), but i know how to change that
 
Last edited by a moderator:
Level 5
Joined
Feb 22, 2013
Messages
161
That is a correct way to do it, but where you have it creating for player 1 (red) needs to be changed

  • Melee Initialization
    • Events
      • Time - Elapsed game time is 10.00 seconds
    • Conditions
    • Actions
      • For each (Integer B) from 1 to 11, do (Actions)
        • Loop - Actions
          • If ((Player number of (Player((Integer B)))) Equal to tempPlayerNumber) then do (Do nothing) else do (Unit - Create 1 Footman for (Player((Integer B))) at (Center of (Playable map area)) facing Default building facing degrees)
 
Level 2
Joined
Jun 18, 2012
Messages
24
That is a correct way to do it, but where you have it creating for player 1 (red) needs to be changed

  • Melee Initialization
    • Events
      • Time - Elapsed game time is 10.00 seconds
    • Conditions
    • Actions
      • For each (Integer B) from 1 to 11, do (Actions)
        • Loop - Actions
          • If ((Player number of (Player((Integer B)))) Equal to tempPlayerNumber) then do (Do nothing) else do (Unit - Create 1 Footman for (Player((Integer B))) at (Center of (Playable map area)) facing Default building facing degrees)

Thanks alot! both of ya!
 
Level 2
Joined
Jun 18, 2012
Messages
24
This leaks.
  • (Center of (Playable map area))
Also Don't use integer A/B. They are slow and less efficient than your own custom integer.

The region is changed to my own. Also, rite now im gonna stick with the integer A/B, Im not that experienced with creating/using variables.
 
Level 13
Joined
Mar 24, 2013
Messages
1,105
Center of youRegion leaks also. Not only is Integer A and B bad but they can bug. Just go to the variable creator and make TempInteger type Interger and go do For each "custom integer" and plug in TempInteger
 
Status
Not open for further replies.
Top