- Joined
- Jul 26, 2008
- Messages
- 1,009
Alright I decided to do quests for players in a nifty way using trigger arrays. I figured it'd be good cause it'd allow me to control how quests flow and condense them to a single struct.
However I must not have done it correctly because when I try to do it, it gives me the quest twice when I enter the rect. I'm not sure why either, I cant figure it out :\
I've also set up an effect array so player A sees a little boy at location A and after completing the quest he'll see the little boy at location B, but only he will see it.
Advice on the FXPath and if I'm doing it right would be great. Also help with the double-Trigger thing would do wonders, thanks
However I must not have done it correctly because when I try to do it, it gives me the quest twice when I enter the rect. I'm not sure why either, I cant figure it out :\
I've also set up an effect array so player A sees a little boy at location A and after completing the quest he'll see the little boy at location B, but only he will see it.
Advice on the FXPath and if I'm doing it right would be great. Also help with the double-Trigger thing would do wonders, thanks
JASS:
scope LightHouseQuest initializer Init
globals
public trigger array Quest1
public trigger array Quest2
public trigger array Quest3
private effect array FX1
private effect array FX2
endglobals
private function Actions3 takes nothing returns nothing
local integer id = GetPlayerId(GetOwningPlayer(GetTriggerUnit()))
call DisplayTextToPlayer( GetOwningPlayer(GetTriggerUnit()), 0, 0, "|cffffd700LIGHTHOUSE KEEPER|r: You Found Him! Here are the keys! Its all yours!" )
if GetOwningPlayer(gg_unit_nC48_0523) == Player(PLAYER_NEUTRAL_PASSIVE) then
call SetUnitOwner( gg_unit_nC48_0523, GetOwningPlayer(GetTriggerUnit()), true )
call SetUnitInvulnerable( gg_unit_nC48_0523, false )
else
set bj_lastCreatedUnit = CreateUnit(GetOwningPlayer(GetTriggerUnit()), 'nC06', 10735, 5739, 270)
call IssuePointOrder(bj_lastCreatedUnit, "move", GetUnitX(GetTriggerUnit()), GetUnitY(GetTriggerUnit()))
endif
call DestroyTrigger( Quest3[id] )
set Quest3[id] = null
endfunction
private function Actions2 takes nothing returns nothing
local integer id = GetPlayerId(GetOwningPlayer(GetTriggerUnit()))
local string boy = "none.mdl"
if IsUnitType(GetTriggerUnit(), UNIT_TYPE_UNDEAD) and IsUnitType(GetTriggerUnit(), UNIT_TYPE_HERO) and GetPlayerController(GetOwningPlayer(GetTriggerUnit())) == MAP_CONTROL_USER then
call DisableTrigger( Quest1[id] )
call DestroyTrigger( Quest1[id] )
set Quest1[id] = null
call DestroyTrigger( Quest2[id] )
set Quest2[id] = null
call DisplayTextToPlayer( GetOwningPlayer(GetTriggerUnit()), 0, 0,"|cffffd700KEEPERS SON|r: My dad sent you? oh... I come here to play with my friends sometimes... I guess I stayed out too long. You look weird, Oh well, I better go" )
set Quest3[id] = CreateTrigger()
call TriggerRegisterEnterRectSimple( Quest3[id], gg_rct_QuestLightHouse )
call TriggerAddAction( Quest3[id], function Actions3 )
call TriggerSleepAction( 2.00 )
call IssuePointOrderLoc( gg_unit_nvlk_0611, "move", GetRandomLocInRect(gg_rct_QuestLHouseSon) )
call IssuePointOrderLoc( gg_unit_nvlk_0612, "move", GetRandomLocInRect(gg_rct_QuestLHouseSon) )
call TriggerSleepAction( 10.00 )
call DestroyEffect(FX1[id])
if GetLocalPlayer() == GetOwningPlayer(GetTriggerUnit()) then
set boy = "units\\critters\\VillagerKid1\\VillagerKid1.mdl"
endif
set FX2[id] = AddSpecialEffect(boy, 10818, 5357 )
endif
endfunction
private function Actions1 takes nothing returns nothing
local integer id = GetPlayerId(GetOwningPlayer(GetTriggerUnit()))
if IsUnitType(GetTriggerUnit(), UNIT_TYPE_UNDEAD) and IsUnitType(GetTriggerUnit(), UNIT_TYPE_HERO) and GetPlayerController(GetOwningPlayer(GetTriggerUnit())) == MAP_CONTROL_USER then
if Quest2[id] == null then
call DisplayTextToPlayer( GetOwningPlayer(GetTriggerUnit()), 0, 0, "|cffffd700LIGHTHOUSE KEEPER|r: Please..... I don't know what you are, but find my boy and bring him back... I don't have much, but you can have my Armoured Car if you find him. Its not as fast as other cars, but it has Weaponry and formidable armour. I last saw my son to the southeast of Bob's Guns, near the cities walls." )
set Quest2[id] = CreateTrigger()
call TriggerRegisterEnterRectSimple( Quest2[id], gg_rct_QuestLHouseSon )
call TriggerAddAction( Quest2[id], function Actions2 )
else
call DisplayTextToPlayer( GetOwningPlayer(GetTriggerUnit()), 0, 0, "|cffffd700LIGHTHOUSE KEEPER|r: My son, I saw him just southeast of Bobs. Find him, please." )
endif
call DisableTrigger(GetTriggeringTrigger())
endif
endfunction
//===========================================================================
public function Init takes nothing returns nothing
local integer i = 0
local string boy = "none.mdl"
loop
exitwhen i > 11
if i != 3 and GetPlayerSlotState(Player(i)) == PLAYER_SLOT_STATE_PLAYING then
if GetLocalPlayer() == Player(i) then
set boy = "units\\critters\\VillagerKid1\\VillagerKid1.mdl"
endif
set Quest1[i] = CreateTrigger()
set FX1[i] = AddSpecialEffect(boy, 1320, 4358 )
call TriggerRegisterEnterRectSimple( Quest1[i], gg_rct_QuestLightHouse )
call TriggerAddAction( Quest1[i], function Actions1 )
endif
set i = i + 1
endloop
endfunction
endscope