• 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.

Spawning a unit for Random player, at Random Building of a unit-type... help!

Status
Not open for further replies.
Level 4
Joined
Jun 9, 2005
Messages
49
Well As the title says, im trying to get a unit to spawn for a random player, at random building of a unit type, this is my current attempt.

Recruit spawn
Events
Time - Every 45.00 seconds of game time
Conditions
Actions
Unit - Create 1 Recruit for (Random player from (All players)) at (Position of (Random unit from (Units owned by (Picked player) of type House))) facing Default building facing degrees
 
Level 16
Joined
Oct 12, 2008
Messages
1,570
Well, first: You leak a position,
Second: Picked player wont work since: You dont pick a player.
Here's some trigger that will work:
  • Actions
    • Set TempPlayer = (Random player from (All players))
    • Set TempGroup = (Units owned by TempPlayer)
    • Set Temploc1 = (Position of (Random unit from TempGroup))
    • Unit - Create 1 Footman for TempPlayer at Temploc1 facing Default building facing degrees
    • Custom script: call RemoveLocation(udg_Temploc1)
    • Custom script: call DestroyGroup(udg_TempGroup)
This will prevent a unit for Player 1 to spawn at a building of Player 2!
 
Level 4
Joined
Jun 9, 2005
Messages
49
Well, first: You leak a position,
Second: Picked player wont work since: You dont pick a player.
Here's some trigger that will work:
  • Actions
    • Set TempPlayer = (Random player from (All players))
    • Set TempGroup = (Units owned by TempPlayer)
    • Set Temploc1 = (Position of (Random unit from TempGroup))
    • Unit - Create 1 Footman for TempPlayer at Temploc1 facing Default building facing degrees
    • Custom script: call RemoveLocation(udg_Temploc1)
    • Custom script: call DestroyGroup(udg_TempGroup)
This will prevent a unit for Player 1 to spawn at a building of Player 2!

Im sorry but I don't have Custrom Script and the other complicated stuff (I can't even find Set stuff!), I guess I'll be using more of that kind of stuff later, so I'll learn... is it JASS?
 
Level 16
Joined
Oct 12, 2008
Messages
1,570
If you have TFT, you have the same as me, nothing more and nothing less,,
The custom script is under -General - and so is the Set variables (the TempPlayer, TempGroup and Temploc1 are variables)
The custom script is some JASS to prevent leaks, this is basic JASS that every triggerer should know ;)
 
Status
Not open for further replies.
Top