wc3edit.net
https://forum.wc3edit.net/

Locust Damage based on Hero Attribute
http://forum.wc3edit.net/deprotection-cheating-f64/locust-damage-based-on-hero-attribute-t30490.html
Page 1 of 1

Author:  JustANewbie [ November 19th, 2015, 4:32 am ]
Post subject:  Locust Damage based on Hero Attribute

JassCraft finds no error but the map just won't start, what is the problem?

Code:
function Locust_Conditions takes nothing returns boolean
return(GetUnitTypeId(udg_GDD_DamageSource)=='u00D')or(GetUnitTypeId(udg_GDD_DamageSource)=='u008')
endfunction
function Locust_Actions takes integer Damage returns nothing
call UnitDamageTarget(udg_GDD_DamageSource,udg_GDD_DamagedUnit,Damage,true,false,ATTACK_TYPE_CHAOS,DAMAGE_TYPE_NORMAL,WEAPON_TYPE_WHOKNOWS)
endfunction
function InitTrig_Locust takes nothing returns nothing
set gg_trg_Locust=CreateTrigger()
call DisableTrigger(gg_trg_Locust)
call TriggerRegisterVariableEvent(gg_trg_Locust,"udg_GDD_Event",EQUAL,0)
call TriggerAddCondition(gg_trg_Locust,Condition(function Locust_Conditions))
call TriggerAddAction(gg_trg_Locust,function Locust_Actions)
endfunction

Code:
function LocustCast_Conditions takes nothing returns boolean
return(GetSpellAbilityId()=='A07A')or(GetSpellAbilityId()=='A065')
endfunction
function LocustCast_Actions takes nothing returns nothing
local integer array Damage
local integer CV
local unit array Caster
if CV<10 then
set CV=CV+1
else
set CV=0
endif
set Caster[CV]=GetTriggerUnit()
if GetUnitTypeId(Caster[CV])=='A07A' then
set Damage[CV]=GetHeroInt(Caster[CV],true)
else
set Damage[CV]=GetHeroAgi(Caster[CV],true)
endif
endfunction
function InitTrig_LocustCast takes nothing returns nothing
set gg_trg_LocustCast=CreateTrigger()
call DisableTrigger(gg_trg_LocustCast)
call TriggerRegisterAnyUnitEventBJ(gg_trg_LocustCast,EVENT_PLAYER_UNIT_SPELL_EFFECT)
call TriggerAddCondition(gg_trg_Fortitude,Condition(function LocustCast_Conditions))
call TriggerAddAction(gg_trg_LocustCast,function LocustCast_Actions)   
endfunction

Author:  haxorico [ November 19th, 2015, 5:12 pm ]
Post subject:  Re: Locust Damage based on Hero Attribute

we need both the unedited and edited MAPS to see what is wrong.

Author:  JustANewbie [ November 20th, 2015, 5:19 am ]
Post subject:  Re: Locust Damage based on Hero Attribute

I believe the problem is with this specific trigger because this is the one I added, and when I remove this trigger, the map works. So basically what I'm doing is I'm using the GDD damage detection system to create a locust ability where the locust damage should based on the caster, recently I saw in a post of "The Helper" where it is about MUI triggers. From that tutorial, I've learned that by using a custom value when a unit cast a spell, it would be MUI. In this case, I have 2 heroes having the locust spell where they are agility based and intelligence based respectively. Please help me to analyse what is the problem or guide me to make this trigger. Thank you.

Page 1 of 1 All times are UTC
Powered by phpBB® Forum Software © phpBB Group
http://www.phpbb.com/