• 🏆 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] Start Location Error

Status
Not open for further replies.
Level 6
Joined
Jul 23, 2018
Messages
243
Hello everyone,
I have a trigger creating custom start units for players but, every unit spawns in the map initialization all was created at Player 1 start Location? I'm currently using patch 1.29 with WEX. I appreciate all helps.
  • PEASANT
    • Events
      • Map initialization
    • Conditions
      • Or - Any (Conditions) are true
        • Conditions
          • (Player 1 (Red) slot status) Equal to Is playing
          • (Player 2 (Blue) slot status) Equal to Is playing
          • (Player 3 (Teal) slot status) Equal to Is playing
          • (Player 4 (Purple) slot status) Equal to Is playing
          • (Player 5 (Yellow) slot status) Equal to Is playing
          • (Player 6 (Orange) slot status) Equal to Is playing
          • (Player 7 (Green) slot status) Equal to Is playing
          • (Player 8 (Pink) slot status) Equal to Is playing
          • (Player 9 (Gray) slot status) Equal to Is playing
          • (Player 10 (Light Blue) slot status) Equal to Is playing
          • (Player 11 (Dark Green) slot status) Equal to Is playing
          • (Player 12 (Brown) slot status) Equal to Is playing
    • Actions
      • Set TempPoint[0] = ((Picked player) start location)
      • Player Group - Pick every player in (All players controlled by a User player) and do (Actions)
        • Loop - Actions
          • Unit - Create 1 Great Peasent for (Picked player) at Loc_Ini[0] facing Default building facing degrees
          • Unit - Create 1 Defense Builder for (Picked player) at Loc_Ini[0] facing Default building facing degrees
          • Unit - Create 1 Mechanical Engineer for (Picked player) at Loc_Ini[0] facing Default building facing degrees
          • Camera - Set the camera bounds for (Picked player) to kingdom <gen>
 
Level 13
Joined
May 10, 2009
Messages
868
Move TempPoint[0] variable to the top of Player Group block. Right now, it's just pointing to player red starting location because it's out of it. Don't forget to add a custom script line call RemoveLocation(udg_TempPoint[0]) after you're done with it.

Those conditions don't need to be there as the player group is already enumerating users.

The player group also leaks as you're creating a new force (player group) and it's not being destroyed.
  • Events
    • Map initialization
  • Conditions
  • Actions
    • Set tmpForce = (All players controlled by a User player)
    • Player Group - Pick every player in tmpForce and do (Actions)
      • Loop - Actions
        • Set tmpPoint = ((Picked player) start location)
        • -------- Do your stuff here --------
        • Custom script: call RemoveLocation(udg_tmpPoint)
    • Custom script: call DestroyForce(udg_tmpForce)
 
Level 6
Joined
Jul 23, 2018
Messages
243
I'll admit I'm not entirely sure what the trigger is trying to achieve, but you're spawning units at the exact same location called Loc_Ini[0] every single time.
It's like creating starting units in melee game

Move TempPoint[0] variable to the top of Player Group block. Right now, it's just pointing to player red starting location because it's out of it. Don't forget to add a custom script line call RemoveLocation(udg_TempPoint[0]) after you're done with it.

Those conditions don't need to be there as the player group is already enumerating users.

The player group also leaks as you're creating a new force (player group) and it's not being destroyed.
  • Events
    • Map initialization
  • Conditions
  • Actions
    • Set tmpForce = (All players controlled by a User player)
    • Player Group - Pick every player in tmpForce and do (Actions)
      • Loop - Actions
        • Set tmpPoint = ((Picked player) start location)
        • -------- Do your stuff here --------
        • Custom script: call RemoveLocation(udg_tmpPoint)
    • Custom script: call DestroyForce(udg_tmpForce)
Oh, so I have to create location inside Player Group loop? And also I used All players controlled by user for testing, so technically it's supposed to be All players because there's only 6 players.
 
Level 13
Joined
May 10, 2009
Messages
868
Oh, so I have to create location inside Player Group loop?
Yes. Otherwise, the variable will only be set once, and picked player doesn't work out of a player group block. Strangely, the (Get Player X Starting Location) function returns player red's loc when passing a null player to it.

And also I used All players controlled by user for testing, so technically it's supposed to be All players because there's only 6 players.
All right. Then I must warn you that you shouldn't destroy (All Players). It's an exception, a constant group.
 
Status
Not open for further replies.
Top