• Check out the results of the Techtree Contest #19!
  • 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.
  • Create a void inspired texture for Warcraft 3 and enter Hive's 34th Texturing Contest: Void! Click here to enter!
  • The Hive's 22nd Icon Contest: Creep Abilities is now concluded, time to vote for your favourite set of icons! Click here to vote!

[Trigger] Spawn System w/o Building!

Status
Not open for further replies.
Level 6
Joined
Feb 12, 2008
Messages
207
Ok, I already have a spawn system. But it's not working the way I want to. The system just spawns some units in <Playable Map Area> and they always spawn everywhere, even underwater and in the middle of a cliff! Is there any way to prevent this easily? I didn't tried by automatically moving the unit a little so it comes out of the cliff. Going to try and edit post while I wait for a good answer.

Here is the trigger:
  • Spawn Stag
    • Events
      • Time - Every 15.00 seconds of game time
    • Conditions
      • (Number of living Stag units owned by Neutral Hostile) Less than 100
    • Actions
      • Set AntiLeakPosition = (Random point in (Playable map area))
      • Unit - Create 1 Stag for Neutral Hostile at AntiLeakPosition facing Default building facing degrees
      • Custom script: call RemoveLocation(udg_AntiLeakPosition)
Thanks in advance!
 
IsTerrainPathable(x,y,PATHING_TYPE_WALKABILITY) and not(IsTerrainPathable(x,y,PATHING_TYPE_AMPHIBIOUSPATHING))

x,y would be the coordinates.


Possibly PATHING_TYPE_BUILDABILITY too to make sure theres no structures in the way of it. But that might be atken care of with the placement.
 
ok good, my trigger is now converted into JASS and I've been able to stop the spawning in the water. But they keep appearing on the edge of cliffs, so they are unable to move.
Heres the full trigger:

JASS:
function Trig_Spawn_Stag_Conditions takes nothing returns boolean
    if ( not ( CountLivingPlayerUnitsOfTypeId('n000', Player(PLAYER_NEUTRAL_AGGRESSIVE)) < 100 ) ) then
        return false
    endif
    return true
endfunction

function Trig_Spawn_Stag_Actions takes nothing returns nothing
    local location AntiLeakPosition
    set AntiLeakPosition = GetRandomLocInRect(GetPlayableMapRect())
    if (IsTerrainPathableBJ(AntiLeakPosition,PATHING_TYPE_WALKABILITY) == true) and (not(IsTerrainPathableBJ(AntiLeakPosition,PATHING_TYPE_AMPHIBIOUSPATHING) == true)) then 
       call TriggerExecute( GetTriggeringTrigger() )
    else
       call CreateNUnitsAtLoc( 1, 'n000', Player(PLAYER_NEUTRAL_AGGRESSIVE), AntiLeakPosition, bj_UNIT_FACING )
       set AntiLeakPosition = null
       call RemoveLocation(udg_Temp_Point)
    endif
endfunction

//===========================================================================
function InitTrig_Spawn_Stag takes nothing returns nothing
    set gg_trg_Spawn_Stag = CreateTrigger(  )
    call DisableTrigger( gg_trg_Spawn_Stag )
    call TriggerRegisterTimerEventPeriodic( gg_trg_Spawn_Stag, 5.00 )
    call TriggerAddCondition( gg_trg_Spawn_Stag, Condition( function Trig_Spawn_Stag_Conditions ) )
    call TriggerAddAction( gg_trg_Spawn_Stag, function Trig_Spawn_Stag_Actions )
endfunction

Oh and please if any moderator comes to this post. Change it to JASS!
 
hmm. not going to change. They appear in the middle of the cliffs edges so i dont think it would fix it. Anyway, not spawning on water is an advance.
 
Well, there's no way to spawn units in areas except those you decide to unless you use multiple regions :/
 
Status
Not open for further replies.
Back
Top