trigger_newb
Active Member
- Reaction score
- 3
I'm trying to create one of those skills where after a certain number of hits, you can release a huge attack. Can I get a general idea on this please? Thanks in advance
struct BamBamCritz extends array
private constant integer HITS_TO_CRIT=5
private method onCrit takes nothing returns nothing
// Adds 2x dmg.
call Damage_Pure(GetEventDamageSource(),GetTriggerUnit(),GetEventDamage()*2)
endmethod
private static constant boolean I_HAVE_A_PERFECT_DAMAGE_IMPLEMENTATION=false
integer hits
boolean attacking
private method AIDS_onCreate takes nothing returns nothing
set this.hits=0
endmethod
private static method AIDS_onInit takes nothing returns nothing
local trigger t=CreateTrigger()
call TriggerAddCondition(t,Filter(function thistype.onDamage))
call Damage_RegisterEvent(t)
set t=CreateTrigger()
call TriggerAddCondition(t,Filter(function thistype.onAttack))
call TriggerRegisterAnyUnitEventBJ(t,EVENT_PLAYER_UNIT_ATTACKED)
endmethod
//! runtextmacro AIDS()
private static method onDamage takes nothing returns boolean
local thistype this=thistype[GetEventDamageSource()]
static if thistype.I_HAVE_A_PERFECT_DAMAGE_IMPLEMENTATION then
set this.attacking=Damage_IsAttack()
endif
if this.attacking then
set this.hits=this.hits+1
if this.hits==HITS_TO_CRIT then
set this.hits=0
call this.onCrit()
endif
endif
set this.attacking=false
return false
endmethod
private static method onAttack takes nothing returns boolean
set this.attacking=true
return false
endmethod
endstruct
This unleashes a crit every 5 attacks to triple damage. It is fully MUI/MPI, gains a bonus from a perfect Damage implementation (but can kinda do without it) and will not gain hits tracked from fake attacks (hitting stop when attacking).
JASS:JASS
I love taunting GUI users.
(Hand written, didn't check if it compiles. Requires Damage.)
You dont need to learn JASS to implement it, my EGUI Core has like 10 triggers of JASS stuff which I cant even read the first 3 lines! (Not counting the little pictures they make with their script).
I Could make one, but it would detect spells too.
Trigger:
- rawr<div class="bbCodeBlock bbCodeBlock--screenLimited bbCodeBlock--code"><div class="bbCodeBlock-title">Trigger:</div><div class="wc3trigger"><ul class="wc3" id="wc3_6">
- </ul>
- </div></div>