• Listen to a special audio message from Bill Roper to the Hive Workshop community (Bill is a former Vice President of Blizzard Entertainment, Producer, Designer, Musician, Voice Actor) 🔗Click here to hear his message!
  • Read Evilhog's interview with Gregory Alper, the original composer of the music for WarCraft: Orcs & Humans 🔗Click here to read the full interview.
  • The Hive's 22nd Icon Contest: Creep Abilities is now concluded, time to vote for your favourite set of icons! Click here to vote!
  • ✅ The POLL for Hive's Texturing Contest #34 is OPEN! Vote for the TOP 3 SKINS! 🔗Click here to cast your vote!
  • ✅ The POLL for Hive's Techtree Contest #20 is OPEN! Vote for the TOP 3 FACTIONS! 🔗Click here to cast your vote!

creating unit for players present

Status
Not open for further replies.
Level 6
Joined
Apr 16, 2011
Messages
158
hello, my doubt is the following:
My map is for 4 players
When I get the map that each player receives a wisp this could go the taverns.
If they are only 3 people playing, I want it to be created only three wisp.


Map initialization

conditions:
(player 1( red) slot status ) Equal to is playing

Action:
Unit- ceate 1 wisp for player 1 (Red) at Center of name <gen> facing building degress

But this way it still knows just how blue player (computer) when test map. player already checked properties
would trigger an error?
What could it be?
 

Attachments

Last edited:
You can't add a condition for the event of "Map Initialization", it doesn't make sense. It will always be Map Initialization, no matter what.

Use this:
  • Tr
  • Events
    • Map Initialization
  • Conditions
  • Actions
    • Set Point1 = (Center of centro <gen>)
    • For each (Integer A) from 1 to 4, do (Actions)
      • Loop - Actions
        • If (All conditions are true) then do (Actions) else do (Actions)
          • If - Conditions
            • (Player(IntegerA) slot status) Equal to Is playing
            • (Player(IntegerA) controller) Equal to User
          • Then - Actions
            • Unit - Create 1 Alfa for Player(IntegerA) at Point1 facing Default building degrees
          • Else - Actions
    • Custom script: call RemoveLocation (udg_Point1)
Point1 is a "Point" variable. The "Custom script" in the end removes the memory leak, created by the Point variable. If you don't save the "Center of centro <gen>" in a variable, the memory leak won't be cleaned and as the game progresses, several of random leaks can possibly lag your map.

https://www.hiveworkshop.com/forums/trigger-gui-editor-tutorials-279/variables-5896/
https://www.hiveworkshop.com/forums/triggers-scripts-269/things-leak-35124/

In order to get that "Player(IntegerA)", when you are supposed to select a player, e.g. Player 1 (Red) go to the "Function" field and scroll to Conversion - Convert Player Index to Player. Then, find "For Integer A".
 
Status
Not open for further replies.
Back
Top