- Joined
- Jul 26, 2008
- Messages
- 1,009
okay so I made a single quest that runs in a series. Basically how it works is it creates triggers at the appropriate point and destroys triggers at appropriate points in order to progress the quest along with a few branch offs.
This particular one runs like so: Lieutenant is nearby (in region) of General. General tells him to go see Bishop. When he gets in region of Bishop, Bishop says go raze building and bring back book. If you read the book, you fail the quest. If you don't, you win it.
If an enemy kills the building before you, you fail. If Bishop or General is dead, you cannot do the quest.
Simple enough. I must've messed up the triggers, because it won't initialize. However I was also hoping to get some feedback on it. Thanks!
This particular one runs like so: Lieutenant is nearby (in region) of General. General tells him to go see Bishop. When he gets in region of Bishop, Bishop says go raze building and bring back book. If you read the book, you fail the quest. If you don't, you win it.
If an enemy kills the building before you, you fail. If Bishop or General is dead, you cannot do the quest.
Simple enough. I must've messed up the triggers, because it won't initialize. However I was also hoping to get some feedback on it. Thanks!
JASS:
scope TreeQuest initializer Init
globals
private trigger array TreeQuest
endglobals
private function Actions6 takes nothing returns nothing
if not IsUnitType(Bishop, UNIT_TYPE_DEAD) then
if GetTriggerUnit() == Lieutenant then
call DisplayTextToPlayer( Player(3), 0,0, "|cffaca899BISHOP|r: I am disappointed in you. You read the book, yet appear to have survived, so all is not lost. That book may have contained secrets able to defeat these Vampires.... But we shall never know now. If the spawn of that book has harmed any innocents, may the guilt rest upon your head." )
call DestroyTrigger(GetTriggeringTrigger())
set TreeQuest[5] = null
endif
endif
endfunction
private function Actions5 takes nothing returns nothing
local real ang = GetRandomReal(0,2*bj_PI)
local real x = GetUnitX(GetTriggerUnit())+GetRandomReal(20,900)*Cos(ang)
local real y = GetUnitY(GetTriggerUnit())+GetRandomReal(20,900)*Sin(ang)
if GetItemOfTypeFromUnitBJ(Lieutenant, 'IC17') == GetManipulatedItem() then
call DisplayTextToPlayer( Player(3), 0, 0, "Fool! This book contains awesome power, your tainted blood is not pure enough to wield the trees of death! Flee!" )
// call GroupAddUnit( gg_unit_HC56_0183, udg_ReadBook )
call DestroyTrigger(TreeQuest[1])
set TreeQuest[1] = null
call DestroyTrigger(TreeQuest[2])
set TreeQuest[2] = null
call DestroyTrigger(TreeQuest[3])
set TreeQuest[3] = null
set TreeQuest[5] = CreateTrigger()
call TriggerRegisterEnterRectSimple( TreeQuest[5], gg_rct_BishopHome )
call TriggerAddAction( TreeQuest[5], function Actions6 )
// call GroupRemoveUnitSimple( gg_unit_HC56_0183, udg_GeneralQuestBishop )
call TriggerSleepAction( 3.00 )
set bj_forLoopAIndex = 1
set bj_forLoopAIndexEnd = 6
loop
exitwhen bj_forLoopAIndex > bj_forLoopAIndexEnd
call CreateUnit( Player(12), 'nfrl', x, y, ang )
call DestroyEffect( AddSpecialEffect("Abilities\\Spells\\NightElf\\EntangleMine\\Roots.mdl", x, y ))
set bj_forLoopAIndex = bj_forLoopAIndex + 1
endloop
call DestroyTrigger(TreeQuest[4])
set TreeQuest[4] = null
endif
endfunction
private function Actions4 takes nothing returns nothing
if GetTriggerUnit() == Lieutenant and GetInventoryIndexOfItemTypeBJ(Lieutenant, 'IC17') > 0 and not IsUnitType(Bishop, UNIT_TYPE_DEAD) then
call DisplayTextToPlayer( Player(3), 0, 0, "|cffaca899BISHOP|r: Ahh the Sacred Book... It will be safe here. Nobody as ever successfully deciphered it, but we have discovered you can create strange magic seeds from its energy. Here, they are capable of spawning interesting plants. And take this Slayer level up too. I have no need of it." )
call RemoveItem( GetItemOfTypeFromUnitBJ(Lieutenant, 'IC17') )
call UnitAddItemByIdSwapped( 'IC18', Lieutenant )
call UnitAddItemByIdSwapped( 'IC57', Lieutenant )
call DestroyTrigger(TreeQuest[1])
set TreeQuest[1] = null
call DestroyTrigger(TreeQuest[2])
set TreeQuest[2] = null
call DestroyTrigger(TreeQuest[3])
set TreeQuest[3] = null
call DestroyTrigger(TreeQuest[4])
set TreeQuest[4] = null
endif
endfunction
private function Actions3 takes nothing returns nothing
if IsUnitEnemy(GetKillingUnit(), Player(3)) then
call DisplayTextToPlayer( Player(3), 0, 0, "The Sacred Reliquary has been destroyed. The quest is failed." )
//PlaySound("FailQuest")
call DestroyTrigger(TreeQuest[0])
set TreeQuest[0] = null
call DestroyTrigger(TreeQuest[1])
set TreeQuest[1] = null
call DestroyTrigger(TreeQuest[2])
set TreeQuest[2] = null
endif
endfunction
private function Actions2 takes nothing returns nothing
if not IsUnitType(Bishop, UNIT_TYPE_DEAD) then
if GetTriggerUnit() == Lieutenant then
if IsUnitType(gg_unit_nbwd_0412,UNIT_TYPE_DEAD) then
call DisplayTextToPlayer(Player(3), 0, 0, "|cffaca899BISHOP|r: I had a task for you, to retrieve a powerful book. Regretibly Vampires recently destroyed the reliquary where it is housed and made away with it. I pray they cannot decipher its dark power.")
call GroupRemoveUnit( udg_GeneralQuestBishop, Lieutenant )
else
call DisplayTextToPlayer(Player(3), 0, 0, "|cffaca899BISHOP|r: The General said I had a task? hmm.... Oh yes, I mentioned the book. To the southeast of here, between the river fork, just to the west of the Vault is the reliquary. It is an old building, but it houses the Sacred Book of The Forest. I fear for the book's safety, with all these")
call DestroyTrigger(TreeQuest[0])
set TreeQuest[0] = null
set TreeQuest[3] = CreateTrigger()
call TriggerRegisterEnterRectSimple( TreeQuest[3], gg_rct_BishopHome )
call TriggerAddAction( TreeQuest[3], function Actions4 )
set TreeQuest[4] = CreateTrigger()
call TriggerRegisterPlayerUnitEvent( TreeQuest[4], Player(3), EVENT_PLAYER_UNIT_USE_ITEM, null )
call TriggerAddAction( TreeQuest[4], function Actions5 )
endif
endif
endif
endfunction
private function Actions takes nothing returns nothing
if RectContainsCoords(gg_rct_CassidyTalks, GetUnitX(Lieutenant), GetUnitY(Lieutenant)) then
if not IsUnitType(General, UNIT_TYPE_DEAD) then
if not(IsUnitInGroup(Lieutenant, udg_GeneralQuestQueen) or IsUnitInGroup(Lieutenant, udg_GeneralQuestLucas) or IsUnitInGroup(Lieutenant, udg_GeneralQuestTynan)) then
if IsUnitType(Bishop, UNIT_TYPE_DEAD) then
call DisplayTextToPlayer(Player(3), 0, 0, "|cffaca899GENERAL CASSIDY|r: The Bishop had a mission for you... Before Vampires killed him... He is dead now, so theres nothing to be done.")
else
call DisplayTextToPlayer( Player(3), 0, 0, "GENERAL CASSIDY: |cffffcc00The Archbishop has a mission of the utmost importance... Go see him right away" )
// call GroupAddUnit( udg_GeneralQuestBishop, Lieutenant )
set TreeQuest[1] = CreateTrigger()
call TriggerRegisterEnterRectSimple(TreeQuest[1], gg_rct_BishopHome )
call TriggerAddAction( TreeQuest[1], function Actions2 )
set TreeQuest[2] = CreateTrigger()
call TriggerRegisterUnitEvent( TreeQuest[2], gg_unit_nbwd_0412, EVENT_UNIT_DEATH )
call TriggerAddAction( TreeQuest[2], function Actions3 )
endif
endif
endif
endif
endfunction
//===========================================================================
public function Init takes nothing returns nothing
set TreeQuest[0] = CreateTrigger()
call TriggerRegisterPlayerChatEvent( TreeQuest[0], Player(3), "-bishop", true )
call TriggerAddAction( TreeQuest[0], function Actions )
endfunction
endscope