• 🏆 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!

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