an idea:
1. set reuse_delay on boom attack skill to 20-30 sec
2. at bigboom ai, when used boom attack, we set timer on 7-8 second (SetTimerPeriodByTick)
3. at timer_fired handler (handler 11) just check for Skill_InReuseDelay, if yes, then despawn npc. If no, timer will continue counting new 7 sec.
The problem: when I press cancel current action button, timer still exist, but for me it is better delete timer and I dont know how.
i_ai0 I used as identifier to validate timer reuse (unusable right now)
I combined with USE_SKILL_FINISHED, which affected when mobs not died
.
Code:
class summon_magicalattack_despawn : default_npc
parameter_define_begin
int DDMagic 1024257
parameter_define_end
handler 13 // CREATED
variable_begin
"myself"
"_choiceN"
"_code"
"_from_choice"
variable_end
shift_sp 1
push_const xx.xx0000
func_call 14 // func[AddPetDefaultDesire_Follow]
shift_sp -1
shift_sp -1
push_event // myself
push_const 28
add
fetch_i // i_ai0
push_const 2336
add
push_reg_sp
fetch_i
push_const 0
assign
shift_sp -1
handler_end
handler 62 // USE_SKILL_FINISHED
variable_begin
"myself"
"_choiceN"
"_code"
"_from_choice"
variable_end
shift_sp 1
push_const 0
func_call 52 // func[SetTimerPeriodByTick]
shift_sp -1
shift_sp -1
shift_sp 1
func_call 175 // func[Despawn]
shift_sp -1
handler_end
handler 0 // NO_DESIRE
variable_begin
"myself"
"_choiceN"
"_code"
"_from_choice"
variable_end
shift_sp 1
push_const xx.xx0000
func_call 14 // func[AddPetDefaultDesire_Follow]
shift_sp -1
shift_sp -1
shift_sp 1
push_event // myself
push_const 28
add
fetch_i // i_ai0
push_const 2336
add
fetch_i
push_const 0
equal
shift_sp -1
handler_end
handler 11 // TIMER_FIRED
variable_begin
"myself"
"_choiceN"
"_code"
"_from_choice"
variable_end
shift_sp 1
push_parameter DDMagic
func_call 160 // func[Skill_InReuseDelay]
shift_sp -1
push_const 0
greater
branch_false L67003
L67002
shift_sp 1
func_call 175 // func[Despawn]
shift_sp -1
jump L67004
L67003
push_event // myself
push_const 28
add
fetch_i // i_ai0
push_const 2336
add
fetch_i
push_const 0
equal
branch_false L67006
L67005
shift_sp 1
push_const 0
func_call 52 // func[SetTimerPeriodByTick]
shift_sp -1
shift_sp -1
L67006
L67004
handler_end
handler 32 // MENU_SELECTED
variable_begin
"ask"
"reply"
"i0"
"c0"
"myself"
"_choiceN"
"_code"
"_from_choice"
variable_end
push_event // i0
push_const 192
add
push_reg_sp
fetch_i
push_event // myself
push_const 28
add
fetch_i // master
push_const 2404
add
fetch_i // target_index
push_const 384
add
fetch_i
assign
shift_sp -1
push_event // i0
push_const 192
add
fetch_i
push_const 0
less_equal
branch_false L672101
L672100
exit_handler
L672101
push_event // c0
push_const 272
add
push_reg_sp
fetch_i
shift_sp 1
push_event // i0
push_const 192
add
fetch_i
func_call 30 // func[GetCreatureFromIndex]
shift_sp -1
assign
shift_sp -1
push_event // c0
push_const 272
add
fetch_i
branch_false L672103
L672102
shift_sp 1
push_parameter DDMagic
func_call 155 // func[Skill_GetConsumeMP]
shift_sp -1
push_event // myself
push_const 28
add
fetch_i // sm
push_const 2400
add
fetch_i // mp
push_const 352
add
fetch_d
less
push_reg_sp
fetch_i
branch_false L672104
shift_sp 1
push_parameter DDMagic
func_call 154 // func[Skill_GetConsumeHP]
shift_sp -1
push_event // myself
push_const 28
add
fetch_i // sm
push_const 2400
add
fetch_i // hp
push_const 344
add
fetch_d
less
and
push_reg_sp
fetch_i
branch_false L672104
shift_sp 1
push_parameter DDMagic
func_call 160 // func[Skill_InReuseDelay]
shift_sp -1
push_const 0
equal
and
L672104
branch_false L672106
L672105
shift_sp 1
push_event // myself
push_const 28
add
fetch_i // master
push_const 2404
add
fetch_i // target_id
push_const 388
add
fetch_i
push_parameter DDMagic
push_const 0
push_event // reply
push_const 104
add
fetch_i
push_event // ask
push_const 100
add
fetch_i
push_const 1000000
func_call 11 // func[AddUseSkillDesireEx]
shift_sp -6
shift_sp -1
shift_sp 1
push_const 7
func_call 52 // func[SetTimerPeriodByTick]
shift_sp -1
shift_sp -1
shift_sp 1
push_event // myself
push_const 28
add
fetch_i // i_ai0
push_const 2336
add
push_reg_sp
fetch_i
push_const 1
assign
shift_sp -1
L672106
L672103
handler_end
class_end
class big_boom : summon_magicalattack_despawn
class_end