Revive Creeps Trigger - Add condition

Sivert

New Member
Reaction score
0
Okey, so I have this custom script for creep revival. It works, although I want it to have a "(Triggering unit) is summoned equals to false", because everything becomes chaos when summoned creeps die. Now, the only problem is that I have somewhat no idea how to do that. I've tried typing the condition and converted to custom, but it becomes alittle too complicated for someone who just started reading "So you want to learn Jazz" tutorials..

The Revive trigger:
function Trig_Revive_Creeps_Actions takes nothing returns nothing
local integer CUSTOM
set CUSTOM = GetUnitUserData(GetDyingUnit())
call TriggerSleepAction( udg_Hostile_Revive_Time )
call CreateNUnitsAtLoc( 1, udg_Creep_Types[CUSTOM], Player(PLAYER_NEUTRAL_AGGRESSIVE), udg_Creep_Positions[CUSTOM], bj_UNIT_FACING )
call SetUnitUserData( GetLastCreatedUnit(), CUSTOM )
endfunction

//===========================================================================
function InitTrig_Revive_Creeps takes nothing returns nothing
set gg_trg_Revive_Creeps = CreateTrigger( )
call TriggerRegisterPlayerUnitEventSimple( gg_trg_Revive_Creeps, Player(PLAYER_NEUTRAL_AGGRESSIVE), EVENT_PLAYER_UNIT_DEATH )
call TriggerAddAction( gg_trg_Revive_Creeps, function Trig_Revive_Creeps_Actions )
endfunction

Here what I get for just typing in the condition when I convert it to custom:
function Trig_Untitled_Trigger_002_Conditions takes nothing returns boolean
if ( not ( IsUnitType(GetTriggerUnit(), UNIT_TYPE_SUMMONED) == false ) ) then
return false
endif
return true
endfunction

function Trig_Untitled_Trigger_002_Actions takes nothing returns nothing
endfunction

//===========================================================================
function InitTrig_Untitled_Trigger_002 takes nothing returns nothing
set gg_trg_Untitled_Trigger_002 = CreateTrigger( )
call TriggerAddCondition( gg_trg_Untitled_Trigger_002, Condition( function Trig_Untitled_Trigger_002_Conditions ) )

I don't know what to type or copy. Thanks :)
 

trb92

Throwing science at the wall to see what sticks
Reaction score
142
Here's how it would look with the condition added(I also optimized the condition, you have a crappy GUI condition).

JASS:

function Trig_Revive_Creeps_Conditions takes nothing returns boolean //added
return ( IsUnitType(GetTriggerUnit(), UNIT_TYPE_SUMMONED) == false )//added
endfunction//added

function Trig_Revive_Creeps_Actions takes nothing returns nothing
local integer CUSTOM
set CUSTOM = GetUnitUserData(GetDyingUnit())
call TriggerSleepAction( udg_Hostile_Revive_Time )
call CreateNUnitsAtLoc( 1, udg_Creep_Types[CUSTOM], Player(PLAYER_NEUTRAL_AGGRESSIVE), udg_Creep_Positions[CUSTOM], bj_UNIT_FACING )
call SetUnitUserData( GetLastCreatedUnit(), CUSTOM )
endfunction

//====================================================================== =====
function InitTrig_Revive_Creeps takes nothing returns nothing
set gg_trg_Revive_Creeps = CreateTrigger( )
call TriggerRegisterPlayerUnitEventSimple( gg_trg_Revive_Creeps, Player(PLAYER_NEUTRAL_AGGRESSIVE), EVENT_PLAYER_UNIT_DEATH )
call TriggerAddCondition(gg_trg_Revive_Creeps,Condition(function Trig_Revive_Creeps_Conditions))//added
call TriggerAddAction( gg_trg_Revive_Creeps, function Trig_Revive_Creeps_Actions )
endfunction


>"So you want to learn Jazz"
Heh. Romek(I think) once had his title about this. It's Jass, not Jazz.
I think his title was "Why do so many people call Jass, Jazz?"
 
General chit-chat
Help Users
  • No one is chatting at the moment.

      The Helper Discord

      Members online

      No members online now.

      Affiliates

      Hive Workshop NUON Dome World Editor Tutorials

      Network Sponsors

      Apex Steel Pipe - Buys and sells Steel Pipe.
      Top