• 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.

Trying to use code

Status
Not open for further replies.
I wanna use code to make the casting unit get 500 health can someone please help me? this is what I converted except last incomplete line which I tried to do
EDIT:forgot to put I want it for 20 seconds only
function Trig_jass_attempt_Conditions takes nothing returns boolean
if ( not ( GetSpellAbilityId() == 'A01F' ) ) then
return false
endif
if ( not ( GetUnitAbilityLevelSwapped('A01F', GetSpellAbilityUnit()) == 1 ) ) then
return false
endif
return true
then (take(CastingUnit(+500
endfunction

function Trig_jass_attempt_Actions takes nothing returns nothing
endfunction

//===========================================================================
function InitTrig_jass_attempt takes nothing returns nothing
set gg_trg_jass_attempt = CreateTrigger( )
call TriggerRegisterAnyUnitEventBJ( gg_trg_jass_attempt, EVENT_PLAYER_UNIT_SPELL_CAST )
call TriggerAddCondition( gg_trg_jass_attempt, Condition( function Trig_jass_attempt_Conditions ) )
call TriggerAddAction( gg_trg_jass_attempt, function Trig_jass_attempt_Actions )
endfunction

 
Level 15
Joined
Sep 3, 2006
Messages
1,738
Calling Triggering Unit is faster than calling Casting Unit. If you want to know why, just think of it this way:

Triggering Unit
-checks the event if it was triggered by a unit
-checks the conditions if triggering unit was used

Casting Unit
-checks the event if it was triggered by a unit
-checks the event if it involves a unit casting spells
-checks the condition if it has casting unit

plus 'casting unit' will get re-written after a 'wait'.
 
Status
Not open for further replies.
Top