I need to make it worK:
So ExecuteFunc("") doesn't work... How can i do that?
JASS:
///////GREAT QUEST SYSTEM/////////////////////////////////
interface Quest
trigger eventTrigger = null
unit unitGiver = null
integer rewardXp = 0
integer rewardGold = 0
string beginString = ""
string finishString = ""
string toFinishString = ""
trigger eventGive = null
effect effectGiver = null
method Reward takes nothing returns nothing
method Init takes nothing returns nothing
endinterface
struct KillQuest extends Quest
integer unitToKill = 0
integer unitCount = 0
integer unitTotal = 0
string killString = ""
method Reward takes nothing returns nothing
local integer i = 0
local player pl = GetOwningPlayer(Heroes[i])
loop
call AddHeroXP(Heroes[i], this.rewardXp, true)
call SetPlayerState(pl, PLAYER_STATE_RESOURCE_GOLD, GetPlayerState(pl, PLAYER_STATE_RESOURCE_GOLD))
set i = i + 1
exitwhen(i == HeroesCount)
endloop
set pl = null
endmethod
method Init takes nothing returns nothing
set this.eventGive = CreateTrigger()
set this.unitTotal = this.unitCount
set this.effectGiver = AddSpecialEffectTarget("Abilities\\Spells\\Other\\TalkToMe\\TalkToMe.mdl",this.unitGiver,"overhead")
call TriggerRegisterUnitEvent(this.eventGive, this.unitGiver, EVENT_UNIT_ATTACKED)
call TriggerAddAction(this.eventGive, function thistype.onBegin)
endmethod
method Death takes nothing returns nothing
set this.unitCount = this.unitCount - 1
if(this.unitCount == 0) then
call this.ToFinish()
else
call BJDebugMsg(I2S(this.unitCount) + this.killString + I2S(this.unitTotal))
endif
endmethod
static method onDeath takes nothing returns nothing
call ExecuteFunc("Death")
endmethod
static method onBegin takes nothing returns nothing
call ExecuteFunc("Begin")
endmethod
method ToFinish takes nothing returns nothing
call BJDebugMsg(this.toFinishString)
set this.eventGive = CreateTrigger()
set this.effectGiver = AddSpecialEffectTarget("Abilities\\Spells\\Other\\TalkToMe\\TalkToMe.mdl",this.unitGiver,"overhead")
call TriggerRegisterUnitEvent(this.eventGive, this.unitGiver, EVENT_UNIT_ATTACKED)
call TriggerAddAction(this.eventGive, function thistype.onFinish)
endmethod
static method onFinish takes nothing returns nothing
ExecuteFunc("Finish")
endmethod
method Begin takes nothing returns nothing
call BJDebugMsg(this.beginString)
call DestroyTrigger(this.eventGive)
set this.eventGive = null
call DestroyEffect(this.effectGiver)
call AddSpecialEffectTarget("Objects\\RandomObject\\RandomObject.mdl",this.unitGiver,"overhead")
set this.eventTrigger = CreateTrigger()
call TriggerRegisterPlayerUnitEvent(this.eventTrigger, Player(12), EVENT_PLAYER_UNIT_DEATH, null)
call TriggerAddAction(this.eventTrigger, function thistype.onDeath)
endmethod
method Destroy takes nothing returns nothing
call DestroyEffect(this.effectGiver)
set this.effectGiver = null
set this.unitGiver = null
set this.beginString = null
set this.finishString = null
call DestroyTrigger(this.eventTrigger)
set this.eventTrigger = null
endmethod
method Finish takes nothing returns nothing
call DestroyTrigger(this.eventGive)
set this.eventGive = null
call BJDebugMsg(this.finishString)
call this.Reward()
call this.Destroy()
endmethod
endstruct
//////END QUEST SYSTEM/////////////////////////////////////////