a would-be simple jass trig, but war3 editor wont accept it!
This is my trigger, its ment to revive creeps after a certain amount of time, but still allow the corpses to be exploded, raised, what ever. GUI cant handle it so i tried this, but wce bites!
function jassreviveconds takes nothing returns boolean
if (not(GetOwningPlayer(GetTriggerUnit()) == Player(PLAYER_NEUTRAL_AGGRESSIVE) ) ) then
return false
endif
return true
endfunction
function jassreviveact takes nothing returns nothing
local unit res = GetTriggerUnit()
call CreateNUnitsAtLoc( 1 , GetUnitTypeId(GetTriggerUnit()), Player(PLAYER_NEUTRAL_AGGRESSIVE), GetUnitX( res ), GetUnitY( res ) , bj_UNIT_FACING )
set res = null
endfunction
//====================================
function gg_trg_jassrevive takes nothing returns nothing
call gg_trg_jassrevive (CreateTrigger( ))
call TriggerRegisterUnitEvent ( gg_trg_jassrevive , EVENT_PLAYER_UNIT_DEATH ) // this has "invalid number of arguments"
call TriggerAddCondition ( gg_trg_jassrevive, Condition( function jassreviveconds ) ) // this has " expected '(' "
call TriggerAddAction ( gg_trg_jassrevive, function jassreviveact ) // this also wants the '('
endfunction
... Hell, where did you get this from!? No wonder, why the compiler did not want it: It cannot work as "CreateNUnitsAtLoc" requires a location object, not two real primitives. It cannot work, as "gg_trg_jassrevive" is a variable, no function and thus cannot be called. It cannot work as "TriggerRegisterPlayerUnitEvent" takes a player object on call. It cannot work as a function of name "InitTrig_<name of trigger>" has to exist, which is auto-called on map initialisation.
I did not seek for more mistakes, just rewrote the whole thing:
function jassreviveact takes nothing returns nothing
local unit res = GetTriggerUnit()
call TriggerSleepAction(1.74)
call CreateUnit(Player(12),GetUnitTypeId(res),GetUnitX(res),GetUnitY(res),0)
set res = null
endfunction
function InitTrig_Jassrevive takes nothing returns nothing
set gg_trg_Jassrevive = CreateTrigger()
call TriggerRegisterPlayerUnitEvent(gg_trg_Jassrevive,Player(12),EVENT_PLAYER_UNIT_DEATH,null)
call TriggerAddAction(gg_trg_Jassrevive,function jassreviveact)
endfunction
<<Kicks in the condition so that you write them well in the future>>
Well, in this case, you dont need a condition, cuz only Neutral Aggressive can trigger it in the first place, but when youre writing your conditions, instead of the crappy GUI way
function jassreviveconds takes nothing returns boolean
if (not(GetOwningPlayer(GetTriggerUnit()) == Player(PLAYER_NEUTRAL_AGGRESSIVE) ) ) then
return false
endif
return true
endfunction