• 🏆 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!
  • 🏆 Hive's 6th HD Modeling Contest: Mechanical is now open! Design and model a mechanical creature, mechanized animal, a futuristic robotic being, or anything else your imagination can tinker with! 📅 Submissions close on June 30, 2024. Don't miss this opportunity to let your creativity shine! Enter now and show us your mechanical masterpiece! 🔗 Click here to enter!

Help~Spawning trigger in Footmen

Status
Not open for further replies.
Level 1
Joined
Jul 19, 2012
Messages
2
Hello. I am making footmen games. I had try to solved sold spawning system becacuse of the delay.

BUT I couldnt solved it.

So, I want updated spawning system for footmen.

Please help me.
 
Level 31
Joined
Jul 10, 2007
Messages
6,306
This goes over unit groups and enumeration and uses the topic of unit spawning to teach those concepts (exactly what you are looking for). It also introduces defeat conditions (what you'll need later on).

http://www.youtube.com/watch?v=je8_AyV3VWs&feature=player_embedded

See my sig for more video tutorials if you are unfamiliar with vjass = ). They can get you up and running in vjass in a couple of hours.

I'm linking you a tutorial rather than providing code because the code is extremely easy.
 
Level 1
Joined
Jul 19, 2012
Messages
2
I used system is this.
------------------------------------------------------------------------------------

function Trig_Spawn_Footmen_Func001Func002001 takes nothing returns boolean
return ( RectContainsUnit(RectFromCenterSizeBJ(GetPlayerStartLocationLoc(GetEnumPlayer()), 384.00, 384.00), GroupPickRandomUnit(GetUnitsOfPlayerAndTypeId(GetEnumPlayer(), 'hbar'))) == true )
endfunction

function Trig_Spawn_Footmen_Func001A takes nothing returns nothing
// Barracks -> Footman
if ( Trig_Spawn_Footmen_Func001Func002001() ) then
call CreateNUnitsAtLoc( 1, 'hfoo', GetEnumPlayer(), GetPlayerStartLocationLoc(GetEnumPlayer()), bj_UNIT_FACING )
else
call DoNothing( )
endif
endfunction

function Trig_Spawn_Footmen_Actions takes nothing returns nothing
call ForForce( GetPlayersAll(), function Trig_Spawn_Footmen_Func001A )
endfunction

//===========================================================================
function InitTrig_Spawn_Footmen takes nothing returns nothing
set gg_trg_Spawn_Footmen = CreateTrigger( )
call TriggerRegisterTimerEventPeriodic( gg_trg_Spawn_Footmen, 8.00 )
call TriggerAddAction( gg_trg_Spawn_Footmen, function Trig_Spawn_Footmen_Actions )
endfunction

--------------------------------------------------------------------------------
is this system have the memory leakage?
 
Status
Not open for further replies.
Top