• 🏆 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] Summoning unit for players in game

Status
Not open for further replies.
Level 6
Joined
Sep 24, 2015
Messages
174
Hi,

I tried to do a trigger for summoning one unit if the player is in game 0.01 second after map initialisation and i failed ...again...and again...i guess it needs integer from 1 to 10 but how to do it properly...

here's my trigger :

  • Summoning builders
    • Events
      • Time - Elapsed game time is 0.01 seconds
    • Conditions
    • Actions
      • For each (Integer A) from 1 to 10, do (Actions)
        • Loop - Actions
          • Custom script: set bj_wantDestroyGroup = true
          • Set PlayersAtStart = (All players controlled by a User)
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • ((Matching player) controller) Equal to User
            • Then - Actions
              • Unit - Create 1 Builder for (Player((Integer A))) at ((Matching player) start location) facing Orientation building with default degrees
            • Else - Actions
I converted all player to player index but somehow something is still wrong...
 
Level 15
Joined
Mar 25, 2016
Messages
1,327
there is no Matching player. Replace Matching player with Player((Integer A)). Replace it in the condition and in the unit create action.
set bj_wantDestroyGroup = true only works for unit groups not for player groups.
Use
  • Custom script: call DestroyForce(udg_PLayersAtStart)
at the end of the loop.
 
Level 6
Joined
Sep 24, 2015
Messages
174
I found a solution myself before you post Jampion ! I'm proud ahha

Here's the solution (I hope it's working for other players):

  • Summoning builders
    • Events
      • Time - Elapsed game time is 0.01 seconds
    • Conditions
    • Actions
      • For each (Integer A) from 1 to 10, do (Actions)
        • Loop - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • ((Player((Integer A))) controller) Equal to User
            • Then - Actions
              • Player group - Pick every player in (Player group((Player((Integer A))))) and do (Actions)
                • Loop - Actions
                  • Unit - Create 1 Builder for (Player((Integer A))) at ((Matching player) start location) facing Orientation building with default degrees
            • Else - Actions
 
Level 15
Joined
Mar 25, 2016
Messages
1,327
That player group makes no sense. You can simply use the action without the player group, as you are not using picked player at all.
You should also change ((Matching player) start location) to ((Player((Integer A))) start location)
 
Level 6
Joined
Sep 24, 2015
Messages
174
oh thank you i removed that player groupe and changed matching to integer A :)

Edit: why is it creating one unit for all the players when i test the map?

i set forces like this :
force 1:
player1 to 10 = user

force 2:
player 11 and 12=user

edit: it's okay i found the problem had to change player controller to player statut = play
 
Last edited:
Status
Not open for further replies.
Top