Page 2 of 3
Posted: Mon Apr 14, 2008 8:32 am
by John Adams
That could work, too. Applying a set of spells to a group. Or, what might be even better - to steal more concepts from EQemu heh - make a npc_spells table that you can then point the npc record to that, and the npc_spells table could hold custom configs of allowed spells, priorities, chance to cast, whatever. Unless all that is handled in the script itself...
Posted: Mon Apr 14, 2008 2:25 pm
by LethalEncounter
This stuff is totally separate from spells. This is meant to control certain aspects of spawns, such as movement and conversations and such. The npc_spells table is what will eventually be created to handle NPC spells.
Posted: Tue Apr 15, 2008 1:13 pm
by LethalEncounter
Do you guys want the quest stuff as separate files or should the spawn scripts also contain the quests? For quests I was thinking about having:
Code: Select all
function CheckQuestRequirements(Player) //verifies the player has met the requirements for the quest to be offered
function CheckQuestUpdate(Player) //checks if a player has a quest update
function GetQuestDetails() //returns information necessary to give the quest to the player
Posted: Tue Apr 15, 2008 2:13 pm
by chrrox
I think it would be simpler to have them as one file. Also I prefer to work this way. That sounds like a great way to handle quests.
Posted: Tue Apr 15, 2008 3:01 pm
by John Adams
Hmm. I could honestly take it either way. I like the idea that if I want to mess with a spell, I can go to the Spells folder and edit the file and it will only contain Spell information/routines. Then, if I need to edit a quest, I can go to a Quests folder and do the same. Segregated, simple, clear.
Or, I also kinda like it all-inclusive. But again, this is assuming there is 1 spell/quest lua per NPC or spawn? For instance, if I have one NPC ID (a rat) that cases SoW on itself (hehe) and also says "Squeak! I will give you hanta!" and attacks, and also handles some sort of quest to rid Qeynos of all humans so rats can run free... I can sorta see one single file for all this getting confusing and overwhelming. Plus, what if I want only "a_rat_01" to use "lua_script_01", but I want "a_rat_01" (same rat NPC) in a different zone to use lua_script_02"?
Maybe that'll be solved by binding the script to the spawn instead of npc... what do you think?
Posted: Tue Apr 15, 2008 3:16 pm
by LethalEncounter
John Adams wrote:Hmm. I could honestly take it either way. I like the idea that if I want to mess with a spell, I can go to the Spells folder and edit the file and it will only contain Spell information/routines. Then, if I need to edit a quest, I can go to a Quests folder and do the same. Segregated, simple, clear.
Or, I also kinda like it all-inclusive. But again, this is assuming there is 1 spell/quest lua per NPC or spawn? For instance, if I have one NPC ID (a rat) that cases SoW on itself (hehe) and also says "Squeak! I will give you hanta!" and attacks, and also handles some sort of quest to rid Qeynos of all humans so rats can run free... I can sorta see one single file for all this getting confusing and overwhelming. Plus, what if I want only "a_rat_01" to use "lua_script_01", but I want "a_rat_01" (same rat NPC) in a different zone to use lua_script_02"?
Maybe that'll be solved by binding the script to the spawn instead of npc... what do you think?
heh, I think you are still confused about the way I am implementing it. LUA spell scripts are generic enough to be used for several spells and are place in the Spells directory. The lua_script field in the spells table controls which script a particular spell will use.
LUA scripts for spawns are separate from spells and are stored in the SpawnScripts directory. The spawn_script field in the spawn_group table controls which script will be run for a particular spawn. Since it is tied to the spawn group, any spawn that uses the same spawn_group_id will use the same script. However, spawngroups are meant to be spawns that use the same x, y, z coords, etc so if you have a spawn script that is truly unique then you would only want to put that specific spawn in the spawngroup. I mentioned early about the possibility of putting quests inside of these SpawnScripts as well to simplify things (instead of having 3 separate script directories). That is the way I am planning unless there are any objections. In fact I have the Spawn Scripts implemented already, so if you have any objections mention them now

Posted: Tue Apr 15, 2008 4:24 pm
by LethalEncounter
Example of spawn scripts:
http://eq2emulator.net/ScreenShots/SpawnScripts.jpg
Script used to generate the screenshot:
Code: Select all
function spawn(NPC)
Say(NPC, "I am spawning!!")
end
function respawn(NPC)
Say(NPC, "I am respawning!!")
end
function attacked(NPC, Spawn)
Say(NPC, "Attack me will you?!?!")
end
function targeted(NPC, Spawn)
FaceTarget(NPC, Spawn)
Say(NPC, "You feeling lucky, punk?!? Well do you..?")
end
function hailed(NPC, Spawn)
FaceTarget(NPC, Spawn)
Emote(NPC, "glares at you.")
Say(NPC, "Yes, Hail to you as well.")
end
function death(NPC, Spawn)
Say(NPC, "Alas, I am dead. :(")
end
function killed(NPC, Spawn)
Say(NPC, "Haha, I killed j00. I am leet!")
end
function aggro(NPC, Spawn)
Say(NPC, "You have ruined your own lands. You shall not ruin mine!!")
end
function healthchanged(NPC)
Say(NPC, "Oh no, I am getting low on health.")
end
Note that aggro and healthchanged aren't implemented yet, but the other types are.
Posted: Tue Apr 15, 2008 4:42 pm
by John Adams
Naw, I am not too confused, just being difficult. Tell you what, I'll wait til you get it 95% implemented, then start complaining about how it works. That is up to par with my being a QA guy IRL, right?

Posted: Tue Apr 15, 2008 4:47 pm
by LethalEncounter
lol, yup. And then say "No, no, no, back to the drawing board! I liked it the way you had it before the changes."
Posted: Wed Apr 16, 2008 5:49 am
by Scatman
chrrox,
I was just curious. Do you have your ranger spells min and max damage being modified by the caster's current strength? I looked at your Searing Shot combat art that you gave out and I noticed you had a definite description of 11-19 heat damage or whatever the values were. Scout CA's min and max damage are modified by the caster's strength and wasn't sure if you had that calculation in there or planned on putting it in there.
Posted: Wed Apr 16, 2008 6:32 am
by LethalEncounter
The randomchat function might need to be handled by the zone instead of with LUA scripts simply because it doesn't make a lot of sense to call a LUA function that does nothing more than call the Say function with what we passed it. Unless of course you want to keep the chat inside of the function and you randomly determine what to say based off of the text inside of the function. If this is the case, then there is not need for a Message parameter on the function.
Posted: Wed Apr 16, 2008 4:31 pm
by LethalEncounter
NPC walking movements will be handled in a loop with each waypoint having a different stop delay. The following is the LUA script code needed to make Paula Marx walk to various locations before returning to her starting location. She starts walking as soon as she spawns. Note that the delays could be off by as much as 10 seconds since I only check for updates every 10 seconds to reduce processing time.
Code: Select all
function spawn(NPC)
--Syntax is NPC, x, y, z, speed, delay (in seconds)
MovementLoopAddLocation(NPC, 22.19, -6.86, 183.95, 2, 30)
MovementLoopAddLocation(NPC, 30.76, -6.33, 196.28, 2, 30)
MovementLoopAddLocation(NPC, 20.70, -6.85, 206.43, 2, 30)
MovementLoopAddLocation(NPC, -.90, -5.47, 212.14, 2, 30)
MovementLoopAddLocation(NPC, 2.35, -4.73, 196.93, 2, 30)
end
I'll open my server up for people to check it out.
Posted: Sun Apr 20, 2008 6:55 pm
by LethalEncounter
I am about to check my changes in. For spawn scripts, be sure that you copy the SpawnScripts directory to your working directory and change the spawn_script field in the spawngroup table to the correct script. Two scripts are included that detail some of the abilities. Like I mentioned earlier, aggro and healthchanged do nothing right now.
If you have any problems, let me know.
Posted: Mon Apr 21, 2008 9:29 am
by John Adams
LE, in regards to NPC movement... is there going to be some function to tell whether or not they are walking, or running? Thinking of some NPCs (Orc Runners, oddly enough) that ... run. I know there are animations for this, but they seem to be running in slow-motion (in place atm).
Posted: Mon Apr 21, 2008 2:35 pm
by LethalEncounter
Your speed value must be wrong. Try a higher speed.