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

Need help serius

Status
Not open for further replies.
Level 19
Joined
Aug 24, 2007
Messages
2,888
UPS just forgot to add "if"
DELETE PLEASE

Heyya I coppied and edited fan of knives
and have a code with it to use
JASS:
function Trig_Death_Cry_Actions takes nothing returns nothing
local unit caster
local real x
local real y
set x = GetUnitX(GetTriggerUnit())
set y = GetUnitY(GetTriggerUnit())
set caster = CreateUnitAtLoc(GetOwningPlayer(GetTriggerUnit()),'h00C',Location(x,y),bj_UNIT_FACING)
call SetUnitAbilityLevel(caster,'A00U',GetUnitAbilityLevel(GetTriggerUnit(),'A00W'))
call IssueImmediateOrderBJ(caster,"fanofknives")
call UnitApplyTimedLife(caster,'BTLF',2)
set caster = null
endfunction

//===========================================================================
function InitTrig_Death_Cry takes nothing returns nothing
    set gg_trg_Death_Cry = CreateTrigger(  )
    call TriggerRegisterAnyUnitEventBJ( gg_trg_Death_Cry, EVENT_PLAYER_UNIT_SPELL_EFFECT )
    call TriggerAddAction( gg_trg_Death_Cry, function Trig_Death_Cry_Actions )
endfunction
Anyway It shuts the game with no errors when I cast the spell h00C is a dummy spell caster btw and A00U is ability to cast by dummy caster (its fan of knives based too) and A00W is ability that hero casts
 
Level 9
Joined
Jun 26, 2007
Messages
659
an advice: indenting your code make it more readable
like this:
Code:
function a_stupid_function takes integer a_param returns integer
  local integer a_variable
    set a_variable = 2*a_param
    if (a_variable>=16) then
      return a_variable
    endif
    return 0
endfunction
 
Status
Not open for further replies.
Top