New Lua Functions: GetTempVariable and SetTempVariable
Posted: Fri May 24, 2013 7:03 pm
http://oldforums.eq2classic.com/
Code: Select all
function hailed(NPC, Player)
SetTempVariable(Player, "SpawnPointer", NPC) -- This will store the npc in a temp variable on the player who hailed it
end
function SomeFunctionInADiffrentSpawnScript(NPC, Player)
-- Get the spawn pointer we stored in the players temp variables
Spawn = GetTempVariable(Player, "SpawnPointer")
-- Check to make sure the pointer is valid
if Spawn ~= nil then
-- Lets change that spawns visual state
SpawnSet(Spawn, "visual_state", 1111) -- FYI - made up # for visual state, no clue if it is valid
-- No longer need the spawn pointer so lets clear it
SetTempVariable(Player, "SpawnPointer", nil)
end
end