P1raten
05-02-10, 04:52 AM
Here's a little code for you.
Originally made by stoneharry, modified by me.
Make sure you change the id in the introid column in playercreateinfo(it's on the far right).
It should be 0.
local PlayerA = nil -- This will be the player we use to do the event
local NPC_SPAWNER_A = nil -- This is the first npc we shall use
function NPCGIA_GJOEAOJG_HXOJ(pUnit, Event)
NPC_SPAWNER_A = pUnit -- Here we say variable is the unit
end
RegisterUnitEvent(99955, 18, "NPCGIA_GJOEAOJG_HXOJ") -- The first npc, on spawn tell the script that this is him
function zzz_OnFirstEnterWorld(event, pPlayer) -- When they first enter world
if PlayerA == nil then -- If a player is not being used currently, a bug check so that we do not do it two times
local race = pPlayer:GetPlayerRace() -- We get the race of the person that we shall use
if race == 1 or race == 3 or race == 4 or race == 7 or race == 11 then -- THIS IS THE ALLIANCE RACES, change to what you want.
pPlayer:CastSpell(50010) -- Visual
pPlayer:CastSpell(53658) -- Visual
pPlayer:SetPlayerLock(1) -- Stop him moving
pPlayer:MovePlayerTo(pPlayer:GetX(),pPlayer:GetY() ,pPlayer:GetZ()+0.5, pPlayer:GetO(), 12288) -- Move him slightly to play client side effects and shizzle
pPlayer:CastSpell(50010) -- More visuals
pPlayer:CastSpell(28330) -- More visuals
pPlayer:CastSpell(53658) -- More visuals
PlayerA = pPlayer -- Here we tell the script we are now using a player
RegisterTimedEvent("TesttestTesttestTest_zzogje", 4000, 1) -- players cant register events so we use a world event
RegisterTimedEvent("TesttestTesttestTest_zzogje_z", 500, 2) -- See above
else
PlayerA = nil -- if the player is not the race we wanted, reset it
end
else -- if the event is in use
pPlayer:RemoveAura(63752) -- Stop it
pPlayer:RemoveAura(28330) -- Stop it
pPlayer:RemoveAura(53658) -- Stop it
end
end
function TesttestTesttestTest_zzogje_z(pUnit, Event)
PlayerA:CastSpell(53658) -- Some random visual because moving them is buggy and disables it
end
function TesttestTesttestTest_zzogje(pUnit, Event)
NPC_SPAWNER_A:SendChatMessage(12,0,"We got another live one!") -- ok, our first npc is doing something
NPC_SPAWNER_A:ChannelSpell(51361, PlayerA) -- Visual
NPC_SPAWNER_A:RegisterEvent("SayHelloToMyLittleFriend_Z_z_Z", 5000, 1) -- now we can use the npc to control the event rather than the idiotic world event
end
RegisterServerHook(3, "zzz_OnFirstEnterWorld") -- Register the on first enter world
function SayHelloToMyLittleFriend_Z_z_Z(pUnit, Event)
local Name = PlayerA:GetName() -- Get his name
NPC_SPAWNER_A:SendChatMessage(12, 0, "Woah, are you alright "..Name.."? Your lucky to be alive! Here let me give you a hand.") -- Send a message including his name
NPC_SPAWNER_A:RegisterEvent("CastReviveVisualThingyTeheTeheTehe", 4000, 1) -- next event
end
function CastReviveVisualThingyTeheTeheTehe(pUnit, Event)
NPC_SPAWNER_A:StopChannel() -- stop it
NPC_SPAWNER_A:FullCastSpellOnTarget(37755, PlayerA) -- ress visual
NPC_SPAWNER_A:RegisterEvent("LetPlayerMoveaogyaohea", 2400, 1) -- reset player
end
function LetPlayerMoveaogyaohea(pUnit, Event)
PlayerA:SetPlayerLock(0) -- let the player move
PlayerA:CastSpell(21074) -- ress visual
PlayerA:RemoveAura(50010) -- delete visual
PlayerA:RemoveAura(28330) -- delete visual
PlayerA:RemoveAura(53658) -- delete visual
NPC_SPAWNER_A:SendChatMessage(12, 0, "There we go! You should go see if you can help around the camp now.") -- ohai a message
NPC_SPAWNER_A:RegisterEvent("MassDespawnAndResetoajphae", 1000, 1) -- reset event
end
function MassDespawnAndResetoajphae(pUnit, Event)
PlayerA = nil -- All we need to do is say that the slot for a creating character is nil again
end
Originally made by stoneharry, modified by me.
Make sure you change the id in the introid column in playercreateinfo(it's on the far right).
It should be 0.
local PlayerA = nil -- This will be the player we use to do the event
local NPC_SPAWNER_A = nil -- This is the first npc we shall use
function NPCGIA_GJOEAOJG_HXOJ(pUnit, Event)
NPC_SPAWNER_A = pUnit -- Here we say variable is the unit
end
RegisterUnitEvent(99955, 18, "NPCGIA_GJOEAOJG_HXOJ") -- The first npc, on spawn tell the script that this is him
function zzz_OnFirstEnterWorld(event, pPlayer) -- When they first enter world
if PlayerA == nil then -- If a player is not being used currently, a bug check so that we do not do it two times
local race = pPlayer:GetPlayerRace() -- We get the race of the person that we shall use
if race == 1 or race == 3 or race == 4 or race == 7 or race == 11 then -- THIS IS THE ALLIANCE RACES, change to what you want.
pPlayer:CastSpell(50010) -- Visual
pPlayer:CastSpell(53658) -- Visual
pPlayer:SetPlayerLock(1) -- Stop him moving
pPlayer:MovePlayerTo(pPlayer:GetX(),pPlayer:GetY() ,pPlayer:GetZ()+0.5, pPlayer:GetO(), 12288) -- Move him slightly to play client side effects and shizzle
pPlayer:CastSpell(50010) -- More visuals
pPlayer:CastSpell(28330) -- More visuals
pPlayer:CastSpell(53658) -- More visuals
PlayerA = pPlayer -- Here we tell the script we are now using a player
RegisterTimedEvent("TesttestTesttestTest_zzogje", 4000, 1) -- players cant register events so we use a world event
RegisterTimedEvent("TesttestTesttestTest_zzogje_z", 500, 2) -- See above
else
PlayerA = nil -- if the player is not the race we wanted, reset it
end
else -- if the event is in use
pPlayer:RemoveAura(63752) -- Stop it
pPlayer:RemoveAura(28330) -- Stop it
pPlayer:RemoveAura(53658) -- Stop it
end
end
function TesttestTesttestTest_zzogje_z(pUnit, Event)
PlayerA:CastSpell(53658) -- Some random visual because moving them is buggy and disables it
end
function TesttestTesttestTest_zzogje(pUnit, Event)
NPC_SPAWNER_A:SendChatMessage(12,0,"We got another live one!") -- ok, our first npc is doing something
NPC_SPAWNER_A:ChannelSpell(51361, PlayerA) -- Visual
NPC_SPAWNER_A:RegisterEvent("SayHelloToMyLittleFriend_Z_z_Z", 5000, 1) -- now we can use the npc to control the event rather than the idiotic world event
end
RegisterServerHook(3, "zzz_OnFirstEnterWorld") -- Register the on first enter world
function SayHelloToMyLittleFriend_Z_z_Z(pUnit, Event)
local Name = PlayerA:GetName() -- Get his name
NPC_SPAWNER_A:SendChatMessage(12, 0, "Woah, are you alright "..Name.."? Your lucky to be alive! Here let me give you a hand.") -- Send a message including his name
NPC_SPAWNER_A:RegisterEvent("CastReviveVisualThingyTeheTeheTehe", 4000, 1) -- next event
end
function CastReviveVisualThingyTeheTeheTehe(pUnit, Event)
NPC_SPAWNER_A:StopChannel() -- stop it
NPC_SPAWNER_A:FullCastSpellOnTarget(37755, PlayerA) -- ress visual
NPC_SPAWNER_A:RegisterEvent("LetPlayerMoveaogyaohea", 2400, 1) -- reset player
end
function LetPlayerMoveaogyaohea(pUnit, Event)
PlayerA:SetPlayerLock(0) -- let the player move
PlayerA:CastSpell(21074) -- ress visual
PlayerA:RemoveAura(50010) -- delete visual
PlayerA:RemoveAura(28330) -- delete visual
PlayerA:RemoveAura(53658) -- delete visual
NPC_SPAWNER_A:SendChatMessage(12, 0, "There we go! You should go see if you can help around the camp now.") -- ohai a message
NPC_SPAWNER_A:RegisterEvent("MassDespawnAndResetoajphae", 1000, 1) -- reset event
end
function MassDespawnAndResetoajphae(pUnit, Event)
PlayerA = nil -- All we need to do is say that the slot for a creating character is nil again
end