- Joined
- Jul 26, 2008
- Messages
- 1,009
I'm having trouble with a Quest series. Basically the quest activates for every player who is currently playing (And not Player(3))
I figured I had it perfect, but the quests show up twice when you initiate it by stepping into the rect. Also, it does not destroy the first trigger on the second trigger like it should.
Thanks for the help! I'm trying to make it MPI. I've also created a dummy FX in a localized string and move it for each player so player A will see a kid by the lighthouse after completing the quest but player B will see him at the hideout. I know strings are a little specialized with desyncs so it'd be good to know if I did this part right as well.
I figured I had it perfect, but the quests show up twice when you initiate it by stepping into the rect. Also, it does not destroy the first trigger on the second trigger like it should.
Thanks for the help! I'm trying to make it MPI. I've also created a dummy FX in a localized string and move it for each player so player A will see a kid by the lighthouse after completing the quest but player B will see him at the hideout. I know strings are a little specialized with desyncs so it'd be good to know if I did this part right as well.
JASS:
scope LightHouseQuest initializer Init
globals
public trigger array Quest1
public trigger array Quest2
public trigger array Quest3
private effect FX
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()))
if IsUnitType(GetTriggerUnit(), UNIT_TYPE_UNDEAD) and IsUnitType(GetTriggerUnit(), UNIT_TYPE_HERO) and GetPlayerController(GetOwningPlayer(GetTriggerUnit())) == MAP_CONTROL_USER then
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 )
if GetLocalPlayer() == GetOwningPlayer(GetTriggerUnit()) then
call DestroyEffect(FX)
set FX = AddSpecialEffect("units\\critters\\VillagerKid1\\VillagerKid1.mdl", 10818, 5357 )
endif
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
endif
endfunction
//===========================================================================
public function Init takes nothing returns nothing
local integer i = 0
set FX = AddSpecialEffect("units\\critters\\VillagerKid1\\VillagerKid1.mdl", 1320, 4358 )
loop
exitwhen i == 12
if i != 3 and GetPlayerSlotState(Player(i)) == PLAYER_SLOT_STATE_PLAYING then
set Quest1[i] = CreateTrigger()
call TriggerRegisterEnterRectSimple( Quest1[i], gg_rct_QuestLightHouse )
call TriggerAddAction( Quest1[i], function Actions1 )
endif
set i = i + 1
endloop
endfunction
endscope
Last edited: