Page 2 of 9
Posted: Fri Aug 29, 2008 1:43 pm
by LethalEncounter
Nope, since all our spawn_ids are unique now you will not have to specify the type of spawn it is when you are spawning a new spawn. It will automatically determine that for you. You just have to supply a valid id.
Since the LUA stuff is global, I need a reference to which zone it was called from. That is why the first parameter is a spawn in the current zone. It doesnt matter which one. Say you want to spawn another Spawn when a player hails a particular spawn. Here are a few examples:
function hailed(NPC, Spawn)
Spawn(NPC, 4) -- Spawns a new spawn with an id of 4 for all to see
end
function hailed(NPC, Player)
Spawn(Player, 5) -- Spawns a new spawn with an id of 5 for all to see
end
function hailed(CoolNPC, CoolPlayer)
Spawn(CoolNPC, 6) -- Spawns a new spawn with an id of 6 for all to see
end
function hailed(CoolNPC, CoolPlayer)
NewSpawn = Spawn(CoolPlayer, 7, true) -- Spawns a new spawn with an id of 7 that noone can see
AddSpawnAccess(NewSpawn, CoolPlayer) -- give the player access to the private spawn
end
Posted: Fri Aug 29, 2008 1:47 pm
by LethalEncounter
oh btw a safer approach to that last example would be:
function hailed(CoolNPC, CoolPlayer)
NewSpawn = Spawn(CoolPlayer, 7, true) -- Spawns a new spawn with an id of 7 that noone can see
if NewSpawn ~= nil then
AddSpawnAccess(NewSpawn, CoolPlayer) -- give the player access to the private spawn
end
end
The reason being if there is an error and the spawn wasnt spawned for whatever reason like maybe the id was invalid, the previous LUA script would crash.
Posted: Fri Aug 29, 2008 1:51 pm
by Scatman
Ok cool so I can give the "Spawn" param the questgiver parameter passed in through a quest script. Easy enough

Thanks!
Posted: Fri Aug 29, 2008 3:59 pm
by John Adams
Awesome. Nevermind that first thing in your JA Tasks request then hehe. I'll keep an eye out for commits, and get it to Tess for us to try out. Looks cool.
And speaking of planes - while these days I am crashing networks, once upon a time (10 years ago) I worked for Boeing as well - formerly McDonnell/Douglas Helicopter (Apache/Longbow project) as a network engineer.
Posted: Fri Aug 29, 2008 8:26 pm
by Scatman
I just thought of another one but I'm not even sure if it's possible yet. We need a questUpdate function to allow us to update quests after inspecting a certain item (or reading a book). One of the quests on the noobie island requires this so that's when it came to mind.
Posted: Sat Aug 30, 2008 8:11 am
by John Adams
Here's another LUA function that would be popular, especially for getting off the tutorial islands.
ZonePlayer(zone_id|zone_name [x,y,z,h])
...where zone_id|zone_name are either the zone_id or zones.name field from the zones table, and optionally x,y,z,h are the coords to drop the player. If omitted, the zones safe_? coords could be used.
ZonePlayer, or ZoneTarget, ZoneSpawn, whatever you want to name it.
Posted: Sat Aug 30, 2008 10:18 am
by John Adams
And yet another!

SpawnAnim(visual_state_id) or SpawnEmote(visual_state_id, text) something like that. Unless there is already a function for this in the Play* stuff, which I haven't figured out yet.
Posted: Sat Aug 30, 2008 11:45 am
by LethalEncounter
OK, I added the GetZone and Zone functions as well as made a few modifications to the Spawn function.
Code: Select all
To get a Zone reference:
Zone = GetZone(name or id or spawn)
To then zone into that zone:
Zone(Zone, Player, x, y, z, h) -- all but Zone and Player are optional
New Spawn parameters are: Spawn(Zone, spawn_id, private_spawn)
Examples:
Zone = GetZone(Spawn)
Spawn(Zone, 4)
Zone = GetZone(Player)
Spawn(Zone, 5, true)
Zone = GetZone(253)
Spawn(Zone, 4)
Zone = GetZone("tutorial_island_good")
Spawn(Zone, 4)
Zone = GetZone(Player)
Zone(Player, 101, 85, 23, 10)
Zone = GetZone(253)
Zone(Player)
Posted: Sat Aug 30, 2008 11:48 am
by Scatman
Sweet! Thanks LE.
Posted: Sat Aug 30, 2008 12:08 pm
by LethalEncounter
Bah, I just realized that I didn't add any parameters to tell it WHERE you wanted to spawn the spawn. heh Anyways, I'll add x, y, z, heading to the function with heading being optional.
Posted: Sat Aug 30, 2008 12:16 pm
by Scatman
Lol, we all have our brain farts

Posted: Sat Aug 30, 2008 2:17 pm
by Scatman
Another LUA function we need is one to be able to tell which step of a certain quest we are on. Like, GetQuestStep(Spawn, quest_id) because sometimes you have to return back to the same quest NPC and each time you return back to him he says something different depending on which step of the quest you are on.
Posted: Sat Aug 30, 2008 2:38 pm
by LethalEncounter
OK, I added it as GetQuestStep(Player, quest_id). It returns 0 if the player doesnt have the quest, or the last completed step + 1.
Posted: Sat Aug 30, 2008 2:43 pm
by Scatman
Perfect, thanks!
Posted: Sat Aug 30, 2008 2:46 pm
by John Adams
LE, are we storing our character_quest and character_quest_progress data yet? If not, can you predict when we might get that? It is not vital for us learning how to write quests, but doing the same steps repeatedly to test new steps will eventually get annoying.

How many waterlogged britches can one man wear?
Thanks