Hey and thanks for stopping by,
I would like to have your guidance. Yeah, seriously, I'm stuck.
So I intends to create an orb coming out from a character, it'll go to that person desired location( target point of ability being cast ) and it will explode in the area even if there's nothing there. Like a grenade but I would like to try it on my own way to determine whether I can create something based on my knowledge about JASS so far.
So anyway here is my code, I don't know what I should do with it anymore. I'm stunned.
And the outcome was against my expectation of course. The projectile did come out and goes to the location but it didn't explode or anything. It just stands there doing nothing, more like a torchlight since my model brightens it surrounding.
I would like to have your guidance. Yeah, seriously, I'm stuck.
So I intends to create an orb coming out from a character, it'll go to that person desired location( target point of ability being cast ) and it will explode in the area even if there's nothing there. Like a grenade but I would like to try it on my own way to determine whether I can create something based on my knowledge about JASS so far.
So anyway here is my code, I don't know what I should do with it anymore. I'm stunned.
JASS:
function Trig_A_Jass_Condition takes nothing returns boolean
return GetSpellAbilityId() == 'A007'
endfunction
function T_SfxExp takes nothing returns string
return "Objects\\Spawnmodels\\Other\\NeutralBuildingExplosion\\NeutralBuildingExplosion.mdl"
endfunction
function Trig_A_Jass_Actions takes nothing returns nothing
local unit cas = GetTriggerUnit()
local location casp = GetUnitLoc(cas)
local location casloc = GetSpellTargetLoc()
local unit L
local real RDist = DistanceBetweenPoints( casp, casloc )
local real MRDist
local effect LE
call CreateNUnitsAtLoc( 1, 'h005', GetOwningPlayer(cas), casp, 0.00)
set L = GetLastCreatedUnit()
call IssuePointOrderLoc( L, "move", casloc)
loop
set MRDist = DistanceBetweenPoints( GetUnitLoc(L), casloc)
exitwhen MRDist < 50.00
if MRDist < 50.00 then
call UnitDamagePointLoc( L, 0.00, 50.00, casloc, 500, ATTACK_TYPE_SIEGE, DAMAGE_TYPE_SONIC)
call KillUnit(L)
call AddSpecialEffectLoc( T_SfxExp(), casloc)
set LE = GetLastCreatedEffectBJ()
call DestroyEffect(LE)
endif
endloop
set L = null
set casp = null
set casloc = null
set RDist = 0.00
set MRDist = 0.00
set LE = null
set cas = null
endfunction
//=================================================================
function InitTrig_A_Jass takes nothing returns nothing
local trigger t = CreateTrigger()
call TriggerRegisterAnyUnitEventBJ( t, EVENT_PLAYER_UNIT_SPELL_EFFECT )
call TriggerAddAction( t, function Trig_A_Jass_Actions )
call TriggerAddCondition( t, Condition(function Trig_A_Jass_Condition))
endfunction
And the outcome was against my expectation of course. The projectile did come out and goes to the location but it didn't explode or anything. It just stands there doing nothing, more like a torchlight since my model brightens it surrounding.