Name | Type | is_array | initial_value |
PlayerHero | unit | Yes |
//TESH.scrollpos=28
//TESH.alwaysfold=0
//About the Quest Template System
//
// I designed this system so that I myself can make quests quick and easy. This is the result.
//
// Some features include:
// - Solo quests, allow players to quests at their own pace.
// - Easy to fill out configuration to set up quests quick and easy.
// - Chain quest option available, to make chains of quests they require another to be completed before it.
// - Grey exclamation mark on a quest giver = you cannot get the quest yet for one reason or another,
// - Yellow exclamation mark on a quest giver = you can get the quest are you are currently on that quest.
//
// - Restrictions:
// - It is a template, so you are restricted to the configurations on it. I plan to make more options and templates.
// - One quest per unit.
// - Quest givers must be pre-placed on the map and have the QuestGiver ability.
//
//How to copy:
//
//- Make sure you are using Jass Helper. (comes with the Jass NewGen package)
//
//- Copy the Quests folder to your map.
//
//- Copy the QuestGiver item ability to your map then change the rawcode at
// the top of the QuestSystemCore trigger (in the QuestGiverSpell function) to the rawcode the ability now has.
//
//- Give the QuestGiver ability to all of the units that will be quest givers in your game.
//
//- Import the TalkToMeGREY.mdx into your map.
//
//- Done!
//
// You can now create quests by simply copying existing example quests and replacing the triggers function
// code with a new unique one. (for example, the trigger Q1's function code is Q1 because all of its
// functions have Q1 at the end of them, so replace Q1 with Q5 or something for the entire trigger).
// Note: Press Ctr+H to use the replace feature if you have TESH.
//
//Now that you've done that, just fill out the config options at the top of a quest trigger template
// and you're done! (Q1,Q2,Q3 are all the Killing Quest templates and Q4 is the Item Collecting Template)
//
//Please remember:
// Not to put more than one quest on the same quest giving unit.
// All quest givers must be placed on the map in World Editor. (so make them invulnerable or something)
// This works for maps with only one hero per player. Your hero that will be able to do quests is whatever
// the last hero entering playable map area for you was. (can be changed in the trigger 'Hero Store')
//
//
// Tips: -To get a units unique code, (eg. gg_unit_hpea_0001), just make a GUI trigger, like pause unit,
// and select the unit on the map as the unit to pause. Now convert the GUI trigger to JASS and it will
// display the units unique code.
// -To get a unit or item's rawcode simply go to the object editor and click View > Display Values
// as Raw Data, now the units names will be replaced with rawcodes on your sidebar.
//
//
//- An option available in the configuration is to chain quests. When done correctly, chained quests will
// only be available as you complete the quest before it in the chain.
//TESH.scrollpos=0
//TESH.alwaysfold=0
library MiscQuestFunctions
constant function QuestGiverSpell takes nothing returns integer
return 'A000'
endfunction
function AddSpecialEffectTargetPlayer takes player p, string fx, unit u, string attach returns effect
if(GetLocalPlayer()==p) then
return AddSpecialEffectTarget(fx,u,attach)
endif
return AddSpecialEffectTarget("",u,attach)
endfunction
function FilterQGivers takes nothing returns boolean
return GetUnitAbilityLevel(GetFilterUnit(),QuestGiverSpell())>0
endfunction
endlibrary
struct QuestData
integer array count[13]
integer array count2[13]
integer array count3[13]
//-----------------------
integer array status[13]
effect array sfx[13]
boolean array avail[13]
integer level
boolean chain
endstruct
function Trig_Update_Quests_Conditions takes nothing returns boolean
return GetTriggerUnit()==udg_PlayerHero[GetPlayerId(GetOwningPlayer(GetTriggerUnit()))+1]
endfunction
function Trig_Update_Quests_Actions takes nothing returns nothing
local QuestData d
local group g=CreateGroup()
local unit u
local integer num=GetPlayerId(GetOwningPlayer(GetTriggerUnit()))+1
local boolean b=false
call GroupEnumUnitsInRect(g,bj_mapInitialPlayableArea,Condition(function FilterQGivers))
loop
set u=FirstOfGroup(g)
exitwhen u==null
set d=QuestData(GetUnitUserData(u))
if d.chain==true then
if d.avail[num]==false then
set b=false
else
set b=true
endif
else
set b=true
endif
if d.level<=GetHeroLevel(GetTriggerUnit()) and d.status[num]==0 and b==true then
call DestroyEffect(d.sfx[num])
set d.sfx[num]=AddSpecialEffectTargetPlayer(Player(num-1),"Abilities\\Spells\\Other\\TalkToMe\\TalkToMe.mdl",u,"overhead")
endif
call GroupRemoveUnit(g,u)
endloop
call DestroyGroup(g)
set g=null
endfunction
function Trig_Quests_Init_Actions takes nothing returns nothing
local QuestData d
local group g=CreateGroup()
local unit u
local integer i=12
call GroupEnumUnitsInRect(g,bj_mapInitialPlayableArea,Condition(function FilterQGivers))
loop
set u=FirstOfGroup(g)
exitwhen u==null
set d=QuestData.create()
call SetUnitUserData(u,d)
loop
exitwhen i<1
set d.sfx[i]=AddSpecialEffectTargetPlayer(Player(i-1),"TalkToMeGREY.mdl",u,"overhead")
set i=i-1
endloop
set i=8
call GroupRemoveUnit(g,u)
endloop
call DestroyGroup(g)
set g=null
endfunction
//===========================================================================
function InitTrig_Update_Quests takes nothing returns nothing
local trigger gg_trg_Quests_Init=CreateTrigger()
set gg_trg_Update_Quests = CreateTrigger( )
call TriggerRegisterAnyUnitEventBJ( gg_trg_Update_Quests, EVENT_PLAYER_HERO_LEVEL )
call TriggerRegisterEnterRectSimple( gg_trg_Update_Quests, GetPlayableMapRect() )
call TriggerAddCondition( gg_trg_Update_Quests, Condition( function Trig_Update_Quests_Conditions ) )
call TriggerAddAction( gg_trg_Update_Quests, function Trig_Update_Quests_Actions )
call TriggerRegisterTimerEventSingle( gg_trg_Quests_Init, 0.00 )
call TriggerAddAction( gg_trg_Quests_Init, function Trig_Quests_Init_Actions )
set gg_trg_Quests_Init=null
endfunction
//TESH.scrollpos=0
//TESH.alwaysfold=0
//Configuration
//=============================================================
constant function QgiverQ1 takes nothing returns unit
return gg_unit_hpea_0081 //unit that gives the quest
endfunction
constant function LevelQ1 takes nothing returns integer
return 1 //level hero has to be to get quest
endfunction
constant function KillRangeQ1 takes nothing returns integer
return 900 //the radius in which credit of the kill is given to heroes with the quest.
endfunction
//=============================================================
constant function CreepQ1 takes nothing returns integer
return 'nspb' //spiders rawcode in this case
//note: always use this creep
endfunction
constant function KillsQ1 takes nothing returns integer
return 3 //how many spiders must be killed
endfunction
constant function NameQ1 takes nothing returns string
return "Black Spider" //creeps name
endfunction
//=============================================================
constant function Creep2Q1 takes nothing returns integer
return 0
endfunction
constant function Kills2Q1 takes nothing returns integer
return 0
endfunction
constant function Name2Q1 takes nothing returns string
return null
endfunction
//=============================================================
constant function Creep3Q1 takes nothing returns integer
return 0 //no 3rd unit
endfunction
constant function Kills3Q1 takes nothing returns integer
return 0 //3rd unit kills needed
endfunction
constant function Name3Q1 takes nothing returns string
return null //3rd creeps name
endfunction
//=============================================================
constant function StartDialogQ1 takes nothing returns string
return "|CFF00AEEFGuy|r: Hi go kill me 3 Black Spiders please! Go to the west. Thanks!"
endfunction
constant function StartDialog2Q1 takes nothing returns string
return null
endfunction
constant function StartDialog3Q1 takes nothing returns string
return null // put null on these if you don't want a new line
endfunction
constant function EndDialogQ1 takes nothing returns string
return "|CFF00AEEFGuy|r: Good job, here have 2 gold."
endfunction
constant function EndDialog2Q1 takes nothing returns string
return null
endfunction
constant function EndDialog3Q1 takes nothing returns string
return null
endfunction
//=============================================================
constant function ExperienceRewardQ1 takes nothing returns integer
return 400 //amount of experience rewarded, put 0 for no experience
endfunction
constant function GoldRewardQ1 takes nothing returns integer
return 2 //amount of gold rewarded, put 0 for no gold
endfunction
constant function ItemRewardQ1 takes nothing returns integer
return 0 //rawcode of the item reward, put 0 for no item reward
endfunction
constant function ItemRewardNameQ1 takes nothing returns string
return null //if you have an item reward put its name here, make sure this is null if you have no reward
endfunction
//=============================================================
constant function ChainQuestQ1 takes nothing returns boolean
return false //is this quest chained from another?
//the starting quest of chain quests is always false, any quest that requires another quest to be completed before it, should be true
endfunction
constant function ChainQuestPreQGiverQ1 takes nothing returns unit
return null //the quest giver of the quest before this quest | make null if this is not chained from another quest
//note: if ChainQuestQ1 is false this is obviously null
endfunction
constant function ChainQuestNextQGiverQ1 takes nothing returns unit
return null //the quest giver of the next quest in the chain
//note: do not use more than one quest on any quest giver, that includes chains aswell | null if no chain quest after this quest
endfunction
//=============================================================
//End Configuration
function Trig_Q1_Conditions takes nothing returns boolean
return GetUnitAbilityLevel(GetTriggerUnit(),QuestGiverSpell())>0 and IsUnitInRange(udg_PlayerHero[GetPlayerId(GetTriggerPlayer())+1],GetTriggerUnit(),200.) and GetTriggerUnit()==QgiverQ1()
endfunction
function Trig_Q1_Actions takes nothing returns nothing
local QuestData d=QuestData(GetUnitUserData(QgiverQ1()))
local QuestData chain=QuestData(GetUnitUserData(ChainQuestNextQGiverQ1()))
local QuestData preq=QuestData(GetUnitUserData(ChainQuestPreQGiverQ1()))
local integer num=GetPlayerId(GetTriggerPlayer())+1
local item itemreward
if preq.status[num]==3 or ChainQuestQ1()==false then
if GetHeroLevel(udg_PlayerHero[num])>=LevelQ1() then
if d.status[num]==0 then
call DisplayTextToPlayer(GetTriggerPlayer(),0,0,StartDialogQ1())
call DisplayTextToPlayer(GetTriggerPlayer(),0,0,StartDialog2Q1())
call DisplayTextToPlayer(GetTriggerPlayer(),0,0,StartDialog3Q1())
set d.status[num]=1
elseif d.status[num]==1 then
if KillsQ1()!=0 then
call DisplayTextToPlayer(GetTriggerPlayer(),0,0,"You have killed "+I2S(d.count[num])+"/"+I2S(KillsQ1())+" "+NameQ1()+"s")
endif
if Kills2Q1()!=0 then
call DisplayTextToPlayer(GetTriggerPlayer(),0,0,"You have killed "+I2S(d.count2[num])+"/"+I2S(Kills2Q1())+" "+Name2Q1()+"s")
endif
if Kills3Q1()!=0 then
call DisplayTextToPlayer(GetTriggerPlayer(),0,0,"You have killed "+I2S(d.count3[num])+"/"+I2S(Kills3Q1())+" "+Name3Q1()+"s")
endif
elseif d.status[num]==2 then
set d.status[num]=3
call DisplayTextToPlayer(GetTriggerPlayer(),0,0,EndDialogQ1())
call DisplayTextToPlayer(GetTriggerPlayer(),0,0,EndDialog2Q1())
call DisplayTextToPlayer(GetTriggerPlayer(),0,0,EndDialog3Q1())
call DestroyEffect(d.sfx[num])
if ChainQuestNextQGiverQ1()!=null then
set chain.status[num]=0
set chain.avail[num]=true
if GetHeroLevel(udg_PlayerHero[num])>=chain.level then
call DestroyEffect(chain.sfx[num])
set chain.sfx[num]=AddSpecialEffectTargetPlayer(Player(num-1),"Abilities\\Spells\\Other\\TalkToMe\\TalkToMe.mdl",ChainQuestNextQGiverQ1(),"overhead")
endif
endif
if ExperienceRewardQ1()>0 then
call AddHeroXP(udg_PlayerHero[num],ExperienceRewardQ1(),true)
call DisplayTextToPlayer(GetTriggerPlayer(),0,0,"|CFFFFFF00Experience gained: |r "+I2S(ExperienceRewardQ1()))
endif
if GoldRewardQ1()>0 then
call SetPlayerState(GetTriggerPlayer(),PLAYER_STATE_RESOURCE_GOLD,GoldRewardQ1())
call DisplayTextToPlayer(GetTriggerPlayer(),0,0,"|CFFFFFF00Gold gained: |r "+I2S(GoldRewardQ1()))
endif
if ItemRewardQ1()!=null then
set itemreward=CreateItem(ItemRewardQ1(),0,0)
call UnitAddItem(udg_PlayerHero[num],itemreward)
call DisplayTextToPlayer(GetTriggerPlayer(),0,0,"|CFFFFFF00Item reward: |r "+ItemRewardNameQ1())
endif
//If you want to add your own special reward, add it here.
endif
else
call DisplayTextToPlayer(GetTriggerPlayer(),0,0,"You must be level |CFFFF0303"+I2S(LevelQ1())+"|r to get this quest")
endif
else
call DisplayTextToPlayer(GetTriggerPlayer(),0,0,"Another quest must be completed before accepting this one.")
endif
set itemreward=null
endfunction
function Q1Completing_Conditions takes nothing returns boolean
return GetUnitTypeId(GetTriggerUnit())==CreepQ1() or GetUnitTypeId(GetTriggerUnit())==Creep2Q1() or GetUnitTypeId(GetTriggerUnit())==Creep3Q1()
endfunction
function Trig_Q1Kill takes nothing returns boolean
return IsUnitType(GetFilterUnit(),UNIT_TYPE_HERO)==true and IsUnitEnemy(GetFilterUnit(),Player(PLAYER_NEUTRAL_AGGRESSIVE))==true
endfunction
function Q1Completing_Actions takes nothing returns nothing
local QuestData d=QuestData(GetUnitUserData(QgiverQ1()))
local group g=CreateGroup()
local unit u
local real x=GetUnitX(GetTriggerUnit())
local real y=GetUnitY(GetTriggerUnit())
local integer num=0
call GroupEnumUnitsInRange(g,x,y,KillRangeQ1(),Condition(function Trig_Q1Kill))
loop
set u=FirstOfGroup(g)
exitwhen u==null
set num=GetPlayerId(GetOwningPlayer(u))+1
if d.status[num]==1 then
if GetUnitTypeId(GetTriggerUnit())==CreepQ1() then
if d.count[num]<KillsQ1() then
set d.count[num]=d.count[num]+1
call DisplayTextToPlayer(Player(num-1),0,0,"You have slain "+I2S(d.count[num])+"/"+I2S(KillsQ1())+" "+NameQ1()+"s.")
endif
endif
if GetUnitTypeId(GetTriggerUnit())==Creep2Q1() then
if d.count2[num]<Kills2Q1() then
set d.count2[num]=d.count2[num]+1
call DisplayTextToPlayer(Player(num-1),0,0,"You have slain "+I2S(d.count2[num])+"/"+I2S(Kills2Q1())+" "+Name2Q1()+"s.")
endif
endif
if GetUnitTypeId(GetTriggerUnit())==Creep3Q1() then
if d.count3[num]<Kills3Q1() then
set d.count3[num]=d.count3[num]+1
call DisplayTextToPlayer(Player(num-1),0,0,"You have slain "+I2S(d.count3[num])+"/"+I2S(Kills3Q1())+" "+Name3Q1()+"s.")
endif
endif
endif
if d.count[num]==KillsQ1() and d.count2[num]==Kills2Q1() and d.count3[num]==Kills3Q1() and d.status[num]==1 then
set d.status[num]=2
endif
call GroupRemoveUnit(g,u)
endloop
call DestroyGroup(g)
set g=null
endfunction
function Trig_QuestLevelQ1_Actions takes nothing returns nothing
local QuestData d=QuestData(GetUnitUserData(QgiverQ1()))
local integer i=12
set d.level=LevelQ1()
set d.chain=ChainQuestQ1()
loop
exitwhen i<1
if LevelQ1()==1 and ChainQuestQ1()==false then
call DestroyEffect(d.sfx[i])
set d.sfx[i]=AddSpecialEffectTargetPlayer(Player(i-1),"Abilities\\Spells\\Other\\TalkToMe\\TalkToMe.mdl",QgiverQ1(),"overhead")
endif
set i=i-1
endloop
endfunction
//===========================================================================
function InitTrig_Q1 takes nothing returns nothing
local trigger gg_trg_Q1Completing=CreateTrigger()
local trigger gg_trg_QuestLevelQ1=CreateTrigger()
set gg_trg_Q1 = CreateTrigger( )
call TriggerRegisterPlayerSelectionEventBJ( gg_trg_Q1, Player(0), true )
call TriggerRegisterPlayerSelectionEventBJ( gg_trg_Q1, Player(1), true )
call TriggerRegisterPlayerSelectionEventBJ( gg_trg_Q1, Player(2), true )
call TriggerRegisterPlayerSelectionEventBJ( gg_trg_Q1, Player(3), true )
call TriggerRegisterPlayerSelectionEventBJ( gg_trg_Q1, Player(4), true )
call TriggerRegisterPlayerSelectionEventBJ( gg_trg_Q1, Player(5), true )
call TriggerRegisterPlayerSelectionEventBJ( gg_trg_Q1, Player(6), true )
call TriggerRegisterPlayerSelectionEventBJ( gg_trg_Q1, Player(7), true )
call TriggerAddCondition( gg_trg_Q1, Condition( function Trig_Q1_Conditions ) )
call TriggerAddAction( gg_trg_Q1, function Trig_Q1_Actions )
call TriggerRegisterAnyUnitEventBJ( gg_trg_Q1Completing, EVENT_PLAYER_UNIT_DEATH )
call TriggerAddCondition( gg_trg_Q1Completing, Condition( function Q1Completing_Conditions ) )
call TriggerAddAction( gg_trg_Q1Completing, function Q1Completing_Actions )
call TriggerRegisterTimerEventSingle( gg_trg_QuestLevelQ1, 0.00 )
call TriggerAddAction( gg_trg_QuestLevelQ1, function Trig_QuestLevelQ1_Actions )
set gg_trg_Q1Completing=null
set gg_trg_QuestLevelQ1=null
endfunction
//TESH.scrollpos=103
//TESH.alwaysfold=0
//Configuration
//=============================================================
constant function QgiverQ2 takes nothing returns unit
return gg_unit_hkni_0082 //unit that gives the quest
endfunction
constant function LevelQ2 takes nothing returns integer
return 2 //level hero has to be to get quest
endfunction
constant function KillRangeQ2 takes nothing returns integer
return 900 //the radius in which credit of the kill is given to heroes with the quest.
endfunction
//=============================================================
constant function CreepQ2 takes nothing returns integer
return 'nftr' //trolls rawcode in this case
//note: always use this creep
endfunction
constant function KillsQ2 takes nothing returns integer
return 5 //how many trolls must be killed
endfunction
constant function NameQ2 takes nothing returns string
return "Forest Troll" //creeps name
endfunction
//=============================================================
constant function Creep2Q2 takes nothing returns integer
return 0
endfunction
constant function Kills2Q2 takes nothing returns integer
return 0
endfunction
constant function Name2Q2 takes nothing returns string
return null
endfunction
//=============================================================
constant function Creep3Q2 takes nothing returns integer
return 0 //no 3rd unit
endfunction
constant function Kills3Q2 takes nothing returns integer
return 0 //3rd unit kills needed
endfunction
constant function Name3Q2 takes nothing returns string
return null //3rd creeps name
endfunction
//=============================================================
constant function StartDialogQ2 takes nothing returns string
return "|CFF00AEEFGuy2|r: Hey umm, go kill me 5 forest trolls, don't ask why. They are North-West."
endfunction
constant function StartDialog2Q2 takes nothing returns string
return null
endfunction
constant function StartDialog3Q2 takes nothing returns string
return null
endfunction
constant function EndDialogQ2 takes nothing returns string
return "|CFF00AEEFGuy2|r: Good job. Here have this item."
endfunction
constant function EndDialog2Q2 takes nothing returns string
return null
endfunction
constant function EndDialog3Q2 takes nothing returns string
return null
endfunction
//=============================================================
constant function ExperienceRewardQ2 takes nothing returns integer
return 500 //amount of experience rewarded, put 0 for no experience
endfunction
constant function GoldRewardQ2 takes nothing returns integer
return 0 //amount of gold rewarded, put 0 for no gold
endfunction
constant function ItemRewardQ2 takes nothing returns integer
return 'bgst'
endfunction
constant function ItemRewardNameQ2 takes nothing returns string
return "Belt of Ogre Strength"
endfunction
//=============================================================
constant function ChainQuestQ2 takes nothing returns boolean
return false //is this quest chained from another?
//the starting quest of chain quests is always false, any quest that requires another quest to be completed before it, should be true
endfunction
constant function ChainQuestPreQGiverQ2 takes nothing returns unit
return gg_unit_hkni_0082 //the quest giver of the quest before this quest | make null if this is not chained from another quest
//note: if ChainQuestQ2 is false this is obviously null
endfunction
constant function ChainQuestNextQGiverQ2 takes nothing returns unit
return gg_unit_hspt_0084 //the quest giver of the next quest in the chain
//note: do not use more than one quest on any quest giver, that includes chains aswell | null if no chain quest after this quest
endfunction
//=============================================================
//End Configuration
function Trig_Q2_Conditions takes nothing returns boolean
return GetUnitAbilityLevel(GetTriggerUnit(),QuestGiverSpell())>0 and IsUnitInRange(udg_PlayerHero[GetPlayerId(GetTriggerPlayer())+1],GetTriggerUnit(),200.) and GetTriggerUnit()==QgiverQ2()
endfunction
function Trig_Q2_Actions takes nothing returns nothing
local QuestData d=QuestData(GetUnitUserData(QgiverQ2()))
local QuestData chain=QuestData(GetUnitUserData(ChainQuestNextQGiverQ2()))
local QuestData preq=QuestData(GetUnitUserData(ChainQuestPreQGiverQ2()))
local integer num=GetPlayerId(GetTriggerPlayer())+1
local item itemreward
if preq.status[num]==3 or ChainQuestQ2()==false then
if GetHeroLevel(udg_PlayerHero[num])>=LevelQ2() then
if d.status[num]==0 then
call DisplayTextToPlayer(GetTriggerPlayer(),0,0,StartDialogQ2())
call DisplayTextToPlayer(GetTriggerPlayer(),0,0,StartDialog2Q2())
call DisplayTextToPlayer(GetTriggerPlayer(),0,0,StartDialog3Q2())
set d.status[num]=1
elseif d.status[num]==1 then
if KillsQ2()!=0 then
call DisplayTextToPlayer(GetTriggerPlayer(),0,0,"You have killed "+I2S(d.count[num])+"/"+I2S(KillsQ2())+" "+NameQ2()+"s")
endif
if Kills2Q2()!=0 then
call DisplayTextToPlayer(GetTriggerPlayer(),0,0,"You have killed "+I2S(d.count2[num])+"/"+I2S(Kills2Q2())+" "+Name2Q2()+"s")
endif
if Kills3Q2()!=0 then
call DisplayTextToPlayer(GetTriggerPlayer(),0,0,"You have killed "+I2S(d.count3[num])+"/"+I2S(Kills3Q2())+" "+Name3Q2()+"s")
endif
elseif d.status[num]==2 then
set d.status[num]=3
call DisplayTextToPlayer(GetTriggerPlayer(),0,0,EndDialogQ2())
call DisplayTextToPlayer(GetTriggerPlayer(),0,0,EndDialog2Q2())
call DisplayTextToPlayer(GetTriggerPlayer(),0,0,EndDialog3Q2())
call DestroyEffect(d.sfx[num])
if ChainQuestNextQGiverQ2()!=null then
set chain.status[num]=0
set chain.avail[num]=true
if GetHeroLevel(udg_PlayerHero[num])>=chain.level then
call DestroyEffect(chain.sfx[num])
set chain.sfx[num]=AddSpecialEffectTargetPlayer(Player(num-1),"Abilities\\Spells\\Other\\TalkToMe\\TalkToMe.mdl",ChainQuestNextQGiverQ2(),"overhead")
endif
endif
if ExperienceRewardQ2()>0 then
call AddHeroXP(udg_PlayerHero[num],ExperienceRewardQ2(),true)
call DisplayTextToPlayer(GetTriggerPlayer(),0,0,"|CFFFFFF00Experience gained: |r "+I2S(ExperienceRewardQ2()))
endif
if GoldRewardQ2()>0 then
call SetPlayerState(GetTriggerPlayer(),PLAYER_STATE_RESOURCE_GOLD,GoldRewardQ2())
call DisplayTextToPlayer(GetTriggerPlayer(),0,0,"|CFFFFFF00Gold gained: |r "+I2S(GoldRewardQ2()))
endif
if ItemRewardQ2()!=null then
set itemreward=CreateItem(ItemRewardQ2(),0,0)
call UnitAddItem(udg_PlayerHero[num],itemreward)
call DisplayTextToPlayer(GetTriggerPlayer(),0,0,"|CFFFFFF00Item reward: |r "+ItemRewardNameQ2())
endif
//If you want to add your own special reward, add it here.
endif
else
call DisplayTextToPlayer(GetTriggerPlayer(),0,0,"You must be level |CFFFF0303"+I2S(LevelQ2())+"|r to get this quest")
endif
else
call DisplayTextToPlayer(GetTriggerPlayer(),0,0,"Another quest must be completed before accepting this one.")
endif
set itemreward=null
endfunction
function Q2Completing_Conditions takes nothing returns boolean
return GetUnitTypeId(GetTriggerUnit())==CreepQ2() or GetUnitTypeId(GetTriggerUnit())==Creep2Q2() or GetUnitTypeId(GetTriggerUnit())==Creep3Q2()
endfunction
function Trig_Q2Kill takes nothing returns boolean
return IsUnitType(GetFilterUnit(),UNIT_TYPE_HERO)==true and IsUnitEnemy(GetFilterUnit(),Player(PLAYER_NEUTRAL_AGGRESSIVE))==true
endfunction
function Q2Completing_Actions takes nothing returns nothing
local QuestData d=QuestData(GetUnitUserData(QgiverQ2()))
local group g=CreateGroup()
local unit u
local real x=GetUnitX(GetTriggerUnit())
local real y=GetUnitY(GetTriggerUnit())
local integer num=0
call GroupEnumUnitsInRange(g,x,y,KillRangeQ2(),Condition(function Trig_Q2Kill))
loop
set u=FirstOfGroup(g)
exitwhen u==null
set num=GetPlayerId(GetOwningPlayer(u))+1
if d.status[num]==1 then
if GetUnitTypeId(GetTriggerUnit())==CreepQ2() then
if d.count[num]<KillsQ2() then
set d.count[num]=d.count[num]+1
call DisplayTextToPlayer(Player(num-1),0,0,"You have slain "+I2S(d.count[num])+"/"+I2S(KillsQ2())+" "+NameQ2()+"s.")
endif
endif
if GetUnitTypeId(GetTriggerUnit())==Creep2Q2() then
if d.count2[num]<Kills2Q2() then
set d.count2[num]=d.count2[num]+1
call DisplayTextToPlayer(Player(num-1),0,0,"You have slain "+I2S(d.count2[num])+"/"+I2S(Kills2Q2())+" "+Name2Q2()+"s.")
endif
endif
if GetUnitTypeId(GetTriggerUnit())==Creep3Q2() then
if d.count3[num]<Kills3Q2() then
set d.count3[num]=d.count3[num]+1
call DisplayTextToPlayer(Player(num-1),0,0,"You have slain "+I2S(d.count3[num])+"/"+I2S(Kills3Q2())+" "+Name3Q2()+"s.")
endif
endif
endif
if d.count[num]==KillsQ2() and d.count2[num]==Kills2Q2() and d.count3[num]==Kills3Q2() and d.status[num]==1 then
set d.status[num]=2
endif
call GroupRemoveUnit(g,u)
endloop
call DestroyGroup(g)
set g=null
endfunction
function Trig_QuestLevelQ2_Actions takes nothing returns nothing
local QuestData d=QuestData(GetUnitUserData(QgiverQ2()))
local integer i=12
set d.level=LevelQ2()
set d.chain=ChainQuestQ2()
loop
exitwhen i<1
if LevelQ2()==1 and ChainQuestQ2()==false then
call DestroyEffect(d.sfx[i])
set d.sfx[i]=AddSpecialEffectTargetPlayer(Player(i-1),"Abilities\\Spells\\Other\\TalkToMe\\TalkToMe.mdl",QgiverQ2(),"overhead")
endif
set i=i-1
endloop
endfunction
//===========================================================================
function InitTrig_Q2 takes nothing returns nothing
local trigger gg_trg_Q2Completing=CreateTrigger()
local trigger gg_trg_QuestLevelQ2=CreateTrigger()
set gg_trg_Q2 = CreateTrigger( )
call TriggerRegisterPlayerSelectionEventBJ( gg_trg_Q2, Player(0), true )
call TriggerRegisterPlayerSelectionEventBJ( gg_trg_Q2, Player(1), true )
call TriggerRegisterPlayerSelectionEventBJ( gg_trg_Q2, Player(2), true )
call TriggerRegisterPlayerSelectionEventBJ( gg_trg_Q2, Player(3), true )
call TriggerRegisterPlayerSelectionEventBJ( gg_trg_Q2, Player(4), true )
call TriggerRegisterPlayerSelectionEventBJ( gg_trg_Q2, Player(5), true )
call TriggerRegisterPlayerSelectionEventBJ( gg_trg_Q2, Player(6), true )
call TriggerRegisterPlayerSelectionEventBJ( gg_trg_Q2, Player(7), true )
call TriggerAddCondition( gg_trg_Q2, Condition( function Trig_Q2_Conditions ) )
call TriggerAddAction( gg_trg_Q2, function Trig_Q2_Actions )
call TriggerRegisterAnyUnitEventBJ( gg_trg_Q2Completing, EVENT_PLAYER_UNIT_DEATH )
call TriggerAddCondition( gg_trg_Q2Completing, Condition( function Q2Completing_Conditions ) )
call TriggerAddAction( gg_trg_Q2Completing, function Q2Completing_Actions )
call TriggerRegisterTimerEventSingle( gg_trg_QuestLevelQ2, 0.00 )
call TriggerAddAction( gg_trg_QuestLevelQ2, function Trig_QuestLevelQ2_Actions )
set gg_trg_Q2Completing=null
set gg_trg_QuestLevelQ2=null
endfunction
//TESH.scrollpos=30
//TESH.alwaysfold=0
//Configuration
//=============================================================
constant function QgiverQ3 takes nothing returns unit
return gg_unit_hspt_0084 //unit that gives the quest
endfunction
constant function LevelQ3 takes nothing returns integer
return 2 //level hero has to be to get quest
endfunction
constant function KillRangeQ3 takes nothing returns integer
return 900 //the radius in which credit of the kill is given to heroes with the quest.
endfunction
//=============================================================
constant function CreepQ3 takes nothing returns integer
return 'nspb'
//note: always use this creep
endfunction
constant function KillsQ3 takes nothing returns integer
return 1
endfunction
constant function NameQ3 takes nothing returns string
return "Black Spider"
endfunction
//=============================================================
constant function Creep2Q3 takes nothing returns integer
return 'nftr'
endfunction
constant function Kills2Q3 takes nothing returns integer
return 1
endfunction
constant function Name2Q3 takes nothing returns string
return "Forest Troll"
endfunction
//=============================================================
constant function Creep3Q3 takes nothing returns integer
return 0 //no 3rd unit
endfunction
constant function Kills3Q3 takes nothing returns integer
return 0 //3rd unit kills needed
endfunction
constant function Name3Q3 takes nothing returns string
return null //3rd creeps name
endfunction
//=============================================================
constant function StartDialogQ3 takes nothing returns string
return "|CFF00AEEFBrillan|r: Yeah hey, I need you to kill me 1 black spider and 1 forest troll. Thanks."
endfunction
constant function StartDialog2Q3 takes nothing returns string
return null
endfunction
constant function StartDialog3Q3 takes nothing returns string
return null
endfunction
constant function EndDialogQ3 takes nothing returns string
return "|CFF00AEEFBrillan|r: You did it! Here! Have nothing!"
endfunction
constant function EndDialog2Q3 takes nothing returns string
return null
endfunction
constant function EndDialog3Q3 takes nothing returns string
return null
endfunction
//=============================================================
constant function ExperienceRewardQ3 takes nothing returns integer
return 0 //amount of experience rewarded, put 0 for no experience
endfunction
constant function GoldRewardQ3 takes nothing returns integer
return 0 //amount of gold rewarded, put 0 for no gold
endfunction
constant function ItemRewardQ3 takes nothing returns integer
return 0
endfunction
constant function ItemRewardNameQ3 takes nothing returns string
return null
endfunction
//=============================================================
constant function ChainQuestQ3 takes nothing returns boolean
return true //is this quest chained from another?
//the starting quest of chain quests is always false, any quest that requires another quest to be completed before it, should be true
endfunction
constant function ChainQuestPreQGiverQ3 takes nothing returns unit
return gg_unit_hkni_0082 //the quest giver of the quest before this quest | make null if this is not chained from another quest
//note: if ChainQuestQ3 is false this is obviously null
endfunction
constant function ChainQuestNextQGiverQ3 takes nothing returns unit
return null //the quest giver of the next quest in the chain
//note: do not use more than one quest on any quest giver, that includes chains aswell | null if no chain quest after this quest
endfunction
//=============================================================
//End Configuration
function Trig_Q3_Conditions takes nothing returns boolean
return GetUnitAbilityLevel(GetTriggerUnit(),QuestGiverSpell())>0 and IsUnitInRange(udg_PlayerHero[GetPlayerId(GetTriggerPlayer())+1],GetTriggerUnit(),200.) and GetTriggerUnit()==QgiverQ3()
endfunction
function Trig_Q3_Actions takes nothing returns nothing
local QuestData d=QuestData(GetUnitUserData(QgiverQ3()))
local QuestData chain=QuestData(GetUnitUserData(ChainQuestNextQGiverQ3()))
local QuestData preq=QuestData(GetUnitUserData(ChainQuestPreQGiverQ3()))
local integer num=GetPlayerId(GetTriggerPlayer())+1
local item itemreward
if preq.status[num]==3 or ChainQuestQ3()==false then
if GetHeroLevel(udg_PlayerHero[num])>=LevelQ3() then
if d.status[num]==0 then
call DisplayTextToPlayer(GetTriggerPlayer(),0,0,StartDialogQ3())
call DisplayTextToPlayer(GetTriggerPlayer(),0,0,StartDialog2Q3())
call DisplayTextToPlayer(GetTriggerPlayer(),0,0,StartDialog3Q3())
set d.status[num]=1
elseif d.status[num]==1 then
if KillsQ3()!=0 then
call DisplayTextToPlayer(GetTriggerPlayer(),0,0,"You have killed "+I2S(d.count[num])+"/"+I2S(KillsQ3())+" "+NameQ3()+"s")
endif
if Kills2Q3()!=0 then
call DisplayTextToPlayer(GetTriggerPlayer(),0,0,"You have killed "+I2S(d.count2[num])+"/"+I2S(Kills2Q3())+" "+Name2Q3()+"s")
endif
if Kills3Q3()!=0 then
call DisplayTextToPlayer(GetTriggerPlayer(),0,0,"You have killed "+I2S(d.count3[num])+"/"+I2S(Kills3Q3())+" "+Name3Q3()+"s")
endif
elseif d.status[num]==2 then
set d.status[num]=3
call DisplayTextToPlayer(GetTriggerPlayer(),0,0,EndDialogQ3())
call DisplayTextToPlayer(GetTriggerPlayer(),0,0,EndDialog2Q3())
call DisplayTextToPlayer(GetTriggerPlayer(),0,0,EndDialog3Q3())
call DestroyEffect(d.sfx[num])
if ChainQuestNextQGiverQ3()!=null then
set chain.status[num]=0
set chain.avail[num]=true
if GetHeroLevel(udg_PlayerHero[num])>=chain.level then
call DestroyEffect(chain.sfx[num])
set chain.sfx[num]=AddSpecialEffectTargetPlayer(Player(num-1),"Abilities\\Spells\\Other\\TalkToMe\\TalkToMe.mdl",ChainQuestNextQGiverQ3(),"overhead")
endif
endif
if ExperienceRewardQ3()>0 then
call AddHeroXP(udg_PlayerHero[num],ExperienceRewardQ3(),true)
call DisplayTextToPlayer(GetTriggerPlayer(),0,0,"|CFFFFFF00Experience gained: |r "+I2S(ExperienceRewardQ3()))
endif
if GoldRewardQ3()>0 then
call SetPlayerState(GetTriggerPlayer(),PLAYER_STATE_RESOURCE_GOLD,GoldRewardQ3())
call DisplayTextToPlayer(GetTriggerPlayer(),0,0,"|CFFFFFF00Gold gained: |r "+I2S(GoldRewardQ3()))
endif
if ItemRewardQ3()!=null then
set itemreward=CreateItem(ItemRewardQ3(),0,0)
call UnitAddItem(udg_PlayerHero[num],itemreward)
call DisplayTextToPlayer(GetTriggerPlayer(),0,0,"|CFFFFFF00Item reward: |r "+ItemRewardNameQ3())
endif
//If you want to add your own special reward, add it here.
endif
else
call DisplayTextToPlayer(GetTriggerPlayer(),0,0,"You must be level |CFFFF0303"+I2S(LevelQ3())+"|r to get this quest")
endif
else
call DisplayTextToPlayer(GetTriggerPlayer(),0,0,"Another quest must be completed before accepting this one.")
endif
set itemreward=null
endfunction
function Q3Completing_Conditions takes nothing returns boolean
return GetUnitTypeId(GetTriggerUnit())==CreepQ3() or GetUnitTypeId(GetTriggerUnit())==Creep2Q3() or GetUnitTypeId(GetTriggerUnit())==Creep3Q3()
endfunction
function Trig_Q3Kill takes nothing returns boolean
return IsUnitType(GetFilterUnit(),UNIT_TYPE_HERO)==true and IsUnitEnemy(GetFilterUnit(),Player(PLAYER_NEUTRAL_AGGRESSIVE))==true
endfunction
function Q3Completing_Actions takes nothing returns nothing
local QuestData d=QuestData(GetUnitUserData(QgiverQ3()))
local group g=CreateGroup()
local unit u
local real x=GetUnitX(GetTriggerUnit())
local real y=GetUnitY(GetTriggerUnit())
local integer num=0
call GroupEnumUnitsInRange(g,x,y,KillRangeQ3(),Condition(function Trig_Q3Kill))
loop
set u=FirstOfGroup(g)
exitwhen u==null
set num=GetPlayerId(GetOwningPlayer(u))+1
if d.status[num]==1 then
if GetUnitTypeId(GetTriggerUnit())==CreepQ3() then
if d.count[num]<KillsQ3() then
set d.count[num]=d.count[num]+1
call DisplayTextToPlayer(Player(num-1),0,0,"You have slain "+I2S(d.count[num])+"/"+I2S(KillsQ3())+" "+NameQ3()+"s.")
endif
endif
if GetUnitTypeId(GetTriggerUnit())==Creep2Q3() then
if d.count2[num]<Kills2Q3() then
set d.count2[num]=d.count2[num]+1
call DisplayTextToPlayer(Player(num-1),0,0,"You have slain "+I2S(d.count2[num])+"/"+I2S(Kills2Q3())+" "+Name2Q3()+"s.")
endif
endif
if GetUnitTypeId(GetTriggerUnit())==Creep3Q3() then
if d.count3[num]<Kills3Q3() then
set d.count3[num]=d.count3[num]+1
call DisplayTextToPlayer(Player(num-1),0,0,"You have slain "+I2S(d.count3[num])+"/"+I2S(Kills3Q3())+" "+Name3Q3()+"s.")
endif
endif
endif
if d.count[num]==KillsQ3() and d.count2[num]==Kills2Q3() and d.count3[num]==Kills3Q3() and d.status[num]==1 then
set d.status[num]=2
endif
call GroupRemoveUnit(g,u)
endloop
call DestroyGroup(g)
set g=null
endfunction
function Trig_QuestLevelQ3_Actions takes nothing returns nothing
local QuestData d=QuestData(GetUnitUserData(QgiverQ3()))
local integer i=12
set d.level=LevelQ3()
set d.chain=ChainQuestQ3()
loop
exitwhen i<1
if LevelQ3()==1 and ChainQuestQ3()==false then
call DestroyEffect(d.sfx[i])
set d.sfx[i]=AddSpecialEffectTargetPlayer(Player(i-1),"Abilities\\Spells\\Other\\TalkToMe\\TalkToMe.mdl",QgiverQ3(),"overhead")
endif
set i=i-1
endloop
endfunction
//===========================================================================
function InitTrig_Q3 takes nothing returns nothing
local trigger gg_trg_Q3Completing=CreateTrigger()
local trigger gg_trg_QuestLevelQ3=CreateTrigger()
set gg_trg_Q3 = CreateTrigger( )
call TriggerRegisterPlayerSelectionEventBJ( gg_trg_Q3, Player(0), true )
call TriggerRegisterPlayerSelectionEventBJ( gg_trg_Q3, Player(1), true )
call TriggerRegisterPlayerSelectionEventBJ( gg_trg_Q3, Player(2), true )
call TriggerRegisterPlayerSelectionEventBJ( gg_trg_Q3, Player(3), true )
call TriggerRegisterPlayerSelectionEventBJ( gg_trg_Q3, Player(4), true )
call TriggerRegisterPlayerSelectionEventBJ( gg_trg_Q3, Player(5), true )
call TriggerRegisterPlayerSelectionEventBJ( gg_trg_Q3, Player(6), true )
call TriggerRegisterPlayerSelectionEventBJ( gg_trg_Q3, Player(7), true )
call TriggerAddCondition( gg_trg_Q3, Condition( function Trig_Q3_Conditions ) )
call TriggerAddAction( gg_trg_Q3, function Trig_Q3_Actions )
call TriggerRegisterAnyUnitEventBJ( gg_trg_Q3Completing, EVENT_PLAYER_UNIT_DEATH )
call TriggerAddCondition( gg_trg_Q3Completing, Condition( function Q3Completing_Conditions ) )
call TriggerAddAction( gg_trg_Q3Completing, function Q3Completing_Actions )
call TriggerRegisterTimerEventSingle( gg_trg_QuestLevelQ3, 0.00 )
call TriggerAddAction( gg_trg_QuestLevelQ3, function Trig_QuestLevelQ3_Actions )
set gg_trg_Q3Completing=null
set gg_trg_QuestLevelQ3=null
endfunction
//TESH.scrollpos=0
//TESH.alwaysfold=0
//Configuration
constant function QgiverQ4 takes nothing returns unit
return gg_unit_hgyr_0083 //unit that gives the quest
endfunction
constant function LevelQ4 takes nothing returns integer
return 3 //level hero has to be to get quest
endfunction
//=============================================================
constant function ItemQ4 takes nothing returns integer
return 'I000'
endfunction
constant function ItemAmountQ4 takes nothing returns integer
return 4
endfunction
constant function ItemNameQ4 takes nothing returns string
return "Glyph"
endfunction
//=============================================================
constant function Item2Q4 takes nothing returns integer
return 0
endfunction
constant function ItemAmount2Q4 takes nothing returns integer
return 0
endfunction
constant function ItemName2Q4 takes nothing returns string
return null
endfunction
//=============================================================
constant function Item3Q4 takes nothing returns integer
return 0
endfunction
constant function ItemAmount3Q4 takes nothing returns integer
return 0
endfunction
constant function ItemName3Q4 takes nothing returns string
return null
endfunction
//=============================================================
constant function StartDialogQ4 takes nothing returns string
return "|CFF00AEEFHelicopter Man|r: Go collect me 4 glyphs to the south!"
endfunction
constant function StartDialog2Q4 takes nothing returns string
return null
endfunction
constant function StartDialog3Q4 takes nothing returns string
return null
endfunction
constant function EndDialogQ4 takes nothing returns string
return "|CFF00AEEFHelicopter Man|r: Yay you got me 3 glyphs you are awesome and stuff thanks"
endfunction
constant function EndDialog2Q4 takes nothing returns string
return null
endfunction
constant function EndDialog3Q4 takes nothing returns string
return null
endfunction
//=============================================================
constant function ExperienceRewardQ4 takes nothing returns integer
return 2000 //amount of experience rewarded, put 0 for no experience
endfunction
constant function GoldRewardQ4 takes nothing returns integer
return 750 //amount of gold rewarded, put 0 for no gold
endfunction
constant function ItemRewardQ4 takes nothing returns integer
return 0
endfunction
constant function ItemRewardNameQ4 takes nothing returns string
return null
endfunction
//=============================================================
constant function ChainQuestQ4 takes nothing returns boolean
return false //is this quest chained from another?
//the starting quest of chain quests is always false, any quest that requires another quest to be completed before it, should be true
endfunction
constant function ChainQuestPreQGiverQ4 takes nothing returns unit
return null //the quest giver of the quest before this quest | make null if this is not chained from another quest
//note: if ChainQuestQ4 is false this is obviously null
endfunction
constant function ChainQuestNextQGiverQ4 takes nothing returns unit
return null //the quest giver of the next quest in the chain
//note: do not use more than one quest on any quest giver, that includes chains aswell | null if no chain quest after this quest
endfunction
//=============================================================
//End Configuration
function Trig_Q4_Conditions takes nothing returns boolean
return GetUnitAbilityLevel(GetTriggerUnit(),QuestGiverSpell())>0 and IsUnitInRange(udg_PlayerHero[GetPlayerId(GetTriggerPlayer())+1],GetTriggerUnit(),200.) and GetTriggerUnit()==QgiverQ4()
endfunction
function Trig_Q4_Actions takes nothing returns nothing
local QuestData d=QuestData(GetUnitUserData(QgiverQ4()))
local QuestData chain=QuestData(GetUnitUserData(ChainQuestNextQGiverQ4()))
local QuestData preq=QuestData(GetUnitUserData(ChainQuestPreQGiverQ4()))
local integer num=GetPlayerId(GetTriggerPlayer())+1
local item itemreward
if preq.status[num]==3 or ChainQuestQ4()==false then
if GetHeroLevel(udg_PlayerHero[num])>=LevelQ4() then
if d.status[num]==0 then
call DisplayTextToPlayer(GetTriggerPlayer(),0,0,StartDialogQ4())
call DisplayTextToPlayer(GetTriggerPlayer(),0,0,StartDialog2Q4())
call DisplayTextToPlayer(GetTriggerPlayer(),0,0,StartDialog3Q4())
set d.status[num]=1
elseif d.status[num]==1 then
if ItemAmountQ4()!=0 then
call DisplayTextToPlayer(GetTriggerPlayer(),0,0,"You have collected "+I2S(d.count[num])+"/"+I2S(ItemAmountQ4())+" "+ItemNameQ4())
endif
if ItemAmount2Q4()!=0 then
call DisplayTextToPlayer(GetTriggerPlayer(),0,0,"You have collected "+I2S(d.count2[num])+"/"+I2S(ItemAmount2Q4())+" "+ItemName2Q4())
endif
if ItemAmount3Q4()!=0 then
call DisplayTextToPlayer(GetTriggerPlayer(),0,0,"You have collected "+I2S(d.count3[num])+"/"+I2S(ItemAmount3Q4())+" "+ItemName3Q4())
endif
elseif d.status[num]==2 then
set d.status[num]=3
call DisplayTextToPlayer(GetTriggerPlayer(),0,0,EndDialogQ4())
call DisplayTextToPlayer(GetTriggerPlayer(),0,0,EndDialog2Q4())
call DisplayTextToPlayer(GetTriggerPlayer(),0,0,EndDialog3Q4())
call DestroyEffect(d.sfx[num])
if ChainQuestNextQGiverQ4()!=null then
set chain.status[num]=0
set chain.avail[num]=true
if GetHeroLevel(udg_PlayerHero[num])>=chain.level then
call DestroyEffect(chain.sfx[num])
set chain.sfx[num]=AddSpecialEffectTargetPlayer(Player(num-1),"Abilities\\Spells\\Other\\TalkToMe\\TalkToMe.mdl",ChainQuestNextQGiverQ4(),"overhead")
endif
endif
if ExperienceRewardQ4()>0 then
call AddHeroXP(udg_PlayerHero[num],ExperienceRewardQ4(),true)
call DisplayTextToPlayer(GetTriggerPlayer(),0,0,"|CFFFFFF00Experience gained: |r "+I2S(ExperienceRewardQ4()))
endif
if GoldRewardQ4()>0 then
call SetPlayerState(GetTriggerPlayer(),PLAYER_STATE_RESOURCE_GOLD,GoldRewardQ4())
call DisplayTextToPlayer(GetTriggerPlayer(),0,0,"|CFFFFFF00Gold gained: |r "+I2S(GoldRewardQ4()))
endif
if ItemRewardQ4()!=null then
set itemreward=CreateItem(ItemRewardQ4(),0,0)
call UnitAddItem(udg_PlayerHero[num],itemreward)
call DisplayTextToPlayer(GetTriggerPlayer(),0,0,"|CFFFFFF00Item reward: |r "+ItemRewardNameQ4())
endif
//If you want to add your own special reward, add it here.
endif
else
call DisplayTextToPlayer(GetTriggerPlayer(),0,0,"You must be level |CFFFF0303"+I2S(LevelQ4())+"|r to get this quest")
endif
else
call DisplayTextToPlayer(GetTriggerPlayer(),0,0,"Another quest must be completed before accepting this one.")
endif
set itemreward=null
endfunction
function Q4Completing_Conditions takes nothing returns boolean
return GetItemTypeId(GetManipulatedItem())==ItemQ4() or GetItemTypeId(GetManipulatedItem())==Item2Q4() or GetItemTypeId(GetManipulatedItem())==Item3Q4()
endfunction
function Q4Completing_Actions takes nothing returns nothing
local QuestData d=QuestData(GetUnitUserData(QgiverQ4()))
local real x=GetUnitX(GetTriggerUnit())
local real y=GetUnitY(GetTriggerUnit())
local integer num=0
set num=GetPlayerId(GetOwningPlayer(GetTriggerUnit()))+1
if d.status[num]==1 then
if GetItemTypeId(GetManipulatedItem())==ItemQ4() then
if d.count[num]<ItemAmountQ4() then
set d.count[num]=d.count[num]+1
call DisplayTextToPlayer(Player(num-1),0,0,"You have collected "+I2S(d.count[num])+"/"+I2S(ItemAmountQ4())+" "+ItemNameQ4())
endif
endif
if GetItemTypeId(GetManipulatedItem())==Item2Q4() then
if d.count2[num]<ItemAmount2Q4() then
set d.count2[num]=d.count2[num]+1
call DisplayTextToPlayer(Player(num-1),0,0,"You have collected "+I2S(d.count2[num])+"/"+I2S(ItemAmount2Q4())+" "+ItemName2Q4())
endif
endif
if GetItemTypeId(GetManipulatedItem())==Item3Q4() then
if d.count3[num]<ItemAmount3Q4() then
set d.count3[num]=d.count3[num]+1
call DisplayTextToPlayer(Player(num-1),0,0,"You have collected "+I2S(d.count3[num])+"/"+I2S(ItemAmount3Q4())+" "+ItemName3Q4())
endif
endif
else
call CreateItem(GetItemTypeId(GetManipulatedItem()),GetUnitX(GetTriggerUnit()),GetUnitY(GetTriggerUnit()))
call DisplayTextToPlayer(Player(num-1),0,0,"You have no need for this item.")
endif
if d.count[num]==ItemAmountQ4() and d.count2[num]==ItemAmount2Q4() and d.count3[num]==ItemAmount3Q4() and d.status[num]==1 then
set d.status[num]=2
endif
endfunction
function Trig_QuestLevelQ4_Actions takes nothing returns nothing
local QuestData d=QuestData(GetUnitUserData(QgiverQ4()))
local integer i=12
set d.level=LevelQ4()
set d.chain=ChainQuestQ4()
loop
exitwhen i<1
if LevelQ4()==1 and ChainQuestQ4()==false then
call DestroyEffect(d.sfx[i])
set d.sfx[i]=AddSpecialEffectTargetPlayer(Player(i-1),"Abilities\\Spells\\Other\\TalkToMe\\TalkToMe.mdl",QgiverQ4(),"overhead")
endif
set i=i-1
endloop
endfunction
//===========================================================================
function InitTrig_Q4 takes nothing returns nothing
local trigger gg_trg_Q4Completing=CreateTrigger()
local trigger gg_trg_QuestLevelQ4=CreateTrigger()
set gg_trg_Q4 = CreateTrigger( )
call TriggerRegisterPlayerSelectionEventBJ( gg_trg_Q4, Player(0), true )
call TriggerRegisterPlayerSelectionEventBJ( gg_trg_Q4, Player(1), true )
call TriggerRegisterPlayerSelectionEventBJ( gg_trg_Q4, Player(2), true )
call TriggerRegisterPlayerSelectionEventBJ( gg_trg_Q4, Player(3), true )
call TriggerRegisterPlayerSelectionEventBJ( gg_trg_Q4, Player(4), true )
call TriggerRegisterPlayerSelectionEventBJ( gg_trg_Q4, Player(5), true )
call TriggerRegisterPlayerSelectionEventBJ( gg_trg_Q4, Player(6), true )
call TriggerRegisterPlayerSelectionEventBJ( gg_trg_Q4, Player(7), true )
call TriggerAddCondition( gg_trg_Q4, Condition( function Trig_Q4_Conditions ) )
call TriggerAddAction( gg_trg_Q4, function Trig_Q4_Actions )
call TriggerRegisterAnyUnitEventBJ( gg_trg_Q4Completing, EVENT_PLAYER_UNIT_PICKUP_ITEM )
call TriggerAddCondition( gg_trg_Q4Completing, Condition( function Q4Completing_Conditions ) )
call TriggerAddAction( gg_trg_Q4Completing, function Q4Completing_Actions )
call TriggerRegisterTimerEventSingle( gg_trg_QuestLevelQ4, 0.00 )
call TriggerAddAction( gg_trg_QuestLevelQ4, function Trig_QuestLevelQ4_Actions )
set gg_trg_Q4Completing=null
set gg_trg_QuestLevelQ4=null
endfunction
function Trig_Vis_Actions takes nothing returns nothing
call FogEnableOff( )
call FogMaskEnableOff( )
endfunction
//===========================================================================
function InitTrig_Vis takes nothing returns nothing
set gg_trg_Vis = CreateTrigger( )
call TriggerRegisterTimerEventSingle( gg_trg_Vis, 0.10 )
call TriggerAddAction( gg_trg_Vis, function Trig_Vis_Actions )
endfunction
function Trig_Untitled_Trigger_001_Copy_2_Actions takes nothing returns nothing
call CreateNUnitsAtLoc( 1, 'Hpal', Player(2), GetRectCenter(gg_rct_Start), bj_UNIT_FACING )
endfunction
//===========================================================================
function InitTrig_Pally_P1 takes nothing returns nothing
set gg_trg_Pally_P1 = CreateTrigger( )
call TriggerRegisterTimerEventSingle( gg_trg_Pally_P1, 1.00 )
call TriggerAddAction( gg_trg_Pally_P1, function Trig_Untitled_Trigger_001_Copy_2_Actions )
endfunction
function Trig_Untitled_Trigger_001_Copy_Actions takes nothing returns nothing
call CreateNUnitsAtLoc( 1, 'Hpal', Player(1), GetRectCenter(gg_rct_Start), bj_UNIT_FACING )
endfunction
//===========================================================================
function InitTrig_Pally_P3 takes nothing returns nothing
set gg_trg_Pally_P3 = CreateTrigger( )
call TriggerRegisterTimerEventSingle( gg_trg_Pally_P3, 1.00 )
call TriggerAddAction( gg_trg_Pally_P3, function Trig_Untitled_Trigger_001_Copy_Actions )
endfunction
function Trig_Untitled_Trigger_001_Actions takes nothing returns nothing
call CreateNUnitsAtLoc( 1, 'Hpal', Player(0), GetRectCenter(gg_rct_Start), bj_UNIT_FACING )
endfunction
//===========================================================================
function InitTrig_Pally_P2 takes nothing returns nothing
set gg_trg_Pally_P2 = CreateTrigger( )
call TriggerRegisterTimerEventSingle( gg_trg_Pally_P2, 1.00 )
call TriggerAddAction( gg_trg_Pally_P2, function Trig_Untitled_Trigger_001_Actions )
endfunction