What I do is this:
Spawn npc next to spawning location
On npc spawn, he is a variable.
On player enter world, disable controll and wait 3 seconds (chance to load npc).
Npc do stuff.
Npc do some more stuff.
Player enable controll.
Here is an example script of me doing this:
Code:
local PlayerA = nil
local NPC_SPAWNER_A = nil
local NPC_SPAWNER_B = nil
local PlayerB = nil
local NPC_A = nil
local NPC_B = nil
function NPCGIA_GJOEAOJG_HXOJ(pUnit, Event)
NPC_SPAWNER_A = pUnit
end
RegisterUnitEvent(99955, 18, "NPCGIA_GJOEAOJG_HXOJ")
function NPCGIA_GJOEAOJG_HXOJ_Z(pUnit, Event)
NPC_SPAWNER_B = pUnit
end
RegisterUnitEvent(99954, 18, "NPCGIA_GJOEAOJG_HXOJ_Z")
function zzz_OnFirstEnterWorld(event, pPlayer)
pPlayer:CastSpell(50010)
if PlayerA == nil then
PlayerA = pPlayer
local race = PlayerA:GetPlayerRace()
if race == 1 or race == 3 or race == 4 or race == 7 or race == 11 then
PlayerA:SetPlayerLock(1)
PlayerA:MovePlayerTo(PlayerA:GetX(),PlayerA:GetY(),PlayerA:GetZ()+2, PlayerA:GetO(), 12288)
PlayerA:CastSpell(50010)
PlayerA:CastSpell(28330)
PlayerA:CastSpell(53658)
RegisterTimedEvent("TesttestTesttestTest_zzogje", 4000, 1)
else
PlayerA = nil
end
else
pPlayer:RemoveAura(63752)
pPlayer:RemoveAura(28330)
pPlayer:RemoveAura(53658)
end
end
function TesttestTesttestTest_zzogje(pUnit, Event)
NPC_SPAWNER_A:SendChatMessage(12,0,"We got another live one!")
NPC_SPAWNER_A:ChannelSpell(51361, PlayerA)
NPC_SPAWNER_B:ChannelSpell(51361, PlayerA)
NPC_SPAWNER_A:RegisterEvent("SayHelloToMyLittleFriend_Z_z_Z", 5000, 1)
end
RegisterServerHook(3, "zzz_OnFirstEnterWorld")
function SayHelloToMyLittleFriend_Z_z_Z(pUnit, Event)
local Name = PlayerA:GetName()
NPC_SPAWNER_B:SendChatMessage(12, 0, "Woah, are you alright "..Name.."? Your lucky to be alive! Here let me give you a hand.")
NPC_SPAWNER_A:RegisterEvent("CastReviveVisualThingyTeheTeheTehe", 4000, 1)
end
function CastReviveVisualThingyTeheTeheTehe(pUnit, Event)
NPC_SPAWNER_A:StopChannel()
NPC_SPAWNER_B:StopChannel()
NPC_SPAWNER_B:FullCastSpellOnTarget(37755, PlayerA)
NPC_SPAWNER_A:RegisterEvent("LetPlayerMoveaogyaohea", 2400, 1)
end
function LetPlayerMoveaogyaohea(pUnit, Event)
PlayerA:SetPlayerLock(0)
PlayerA:CastSpell(21074)
PlayerA:RemoveAura(50010)
PlayerA:RemoveAura(28330)
PlayerA:RemoveAura(53658)
NPC_SPAWNER_A:SendChatMessage(12, 0, "There we go! You should go see if you can help around the camp now.")
NPC_SPAWNER_A:RegisterEvent("MassDespawnAndResetoajphae", 1000, 1)
end
function MassDespawnAndResetoajphae(pUnit, Event)
PlayerA = nil
end
See if you can figure it out.