Page 1 of 1
Scripts dirs
Posted: Fri Aug 29, 2008 7:37 pm
by John Adams
LE,
You know how you provided the ability to put Quests scripts into whatever path we (admins) choose? Is it possible to do the same for Spawn Scripts? Just looking at the stuff we have for the one zone, we're up to 56 scripts and we're not 1/2 way finished.
I hadn't tried actually putting {path}/{script-name} into the DB yet... so maybe that's the simple solution.
Posted: Sat Aug 30, 2008 8:17 am
by LethalEncounter
I doubt it, because they are loaded differently.
Hmm, I just thought of something that might make things easier. Instead of having spawn scripts in zonespawngroup, we could create a new table called spawn_scripts with the following fields:
id, spawn_id, spawnentry_id, spawngroup_id, lua_script
Here is how it would work:
1. You could assign a default script based on the spawn_id, leaving the spawnentry_id/spawngroup_id fields 0. This would allow you to spawn a new spawn in the zone and have it immediately perform the spawn script.
2. You could assign one based on the spawnentry_id, leaving spawn_id/spawngroup_id fields 0. Say you have a boss spawn that has placeholders and you only want to run a specific script if it is spawned. This would satisfy that requirement.
3. The third option would probably be the most used, assigning a spawngroup a spawnscript and leaving spawn_id/spawnentry_id fields 0. This would allow you to specify the same script for the entire spawngroup.
I would also allow you to specify the full path to the spawn script.
Posted: Sat Aug 30, 2008 9:50 am
by John Adams
What a brilliant concept. Where have I heard that before? ~grin~
Btw, remember we do have an obsolete table `spawn_script_data` that had some purpose early on that I have forgotten. Maybe we can use that, or replace it with this idea. I like it, either way. Let's do it.
Can I have that in an hour? HAH j/k
Posted: Sat Sep 13, 2008 12:01 pm
by LethalEncounter
OK, this is complete. You can set them in game as follows:
/spawn set spawn_script SpawnScripts/example.lua
/spawn set spawngroup_script SpawnScripts/example.lua
/spawn set spawnentry_script 'SpawnScripts/Murrar Shar.lua'
Note that the spawn will use a spawnentry script before a spawngroup script and a spawngroup script before a spawn script. This is so that you can have generic scripts for a given spawn, but then also have a specific script for a specific spawn group or (spawn entry).
Posted: Sat Sep 13, 2008 12:09 pm
by John Adams
You are the king.
Thank you! We'll check that out soon as I recover my destroyed database server

Posted: Sat Sep 13, 2008 2:20 pm
by John Adams
Couple things, so I understand what to edit.
1. Is the zonespawngroup.spawn_script field still used? If so, where? Wouldn't that conflict with the new spawn_scripts.spawngroup_id value?
2. I am assuming then that we can have a single generic "FaceTarget()" script so every NPC in the game will face the player if they are hailed. Then from there, more granular scripting applies.
2a. Its spawnentry script gets processed first, so it is the most unique script possible. If nothing is there, then
2b. Fall back to its spawngroup script, which could be an aggro cry to attack for any spawn in that location
3. My your usage "/spawn set
SpawnScript/example.lua", does this mean we can now save more detailed paths to scripts so all our scripts for the entire game are not in SpawnScripts?
4. Current public SVN supports this new structure now? Or still in dev? (
I think that's a no! 
)
5. Will there ever be a case (or need support for) one spawn_id to have multiple scripts assigned to it's spawnentry_id? I do not think that makes sense, so perhaps we need to extend the UNIQUE index of this new table across the 3 ID fields?
Scat, we got some serious work to do now lol... I am working on updating the editor, but LE has provided in-game commands to assign scripts to spawns. However, let's come up with a folder structure that makes sense based on the answer to question 3 above.
I'll have more questions, I am sure.

But this looks pretty cool so far.
Posted: Sat Sep 13, 2008 4:27 pm
by LethalEncounter
John Adams wrote:Couple things, so I understand what to edit.
1. Is the zonespawngroup.spawn_script field still used? If so, where? Wouldn't that conflict with the new spawn_scripts.spawngroup_id value?
2. I am assuming then that we can have a single generic "FaceTarget()" script so every NPC in the game will face the player if they are hailed. Then from there, more granular scripting applies.
2a. Its spawnentry script gets processed first, so it is the most unique script possible. If nothing is there, then
2b. Fall back to its spawngroup script, which could be an aggro cry to attack for any spawn in that location
3. My your usage "/spawn set
SpawnScript/example.lua", does this mean we can now save more detailed paths to scripts so all our scripts for the entire game are not in SpawnScripts?
4. Current public SVN supports this new structure now? Or still in dev? (
I think that's a no! 
)
5. Will there ever be a case (or need support for) one spawn_id to have multiple scripts assigned to it's spawnentry_id? I do not think that makes sense, so perhaps we need to extend the UNIQUE index of this new table across the 3 ID fields?
Scat, we got some serious work to do now lol... I am working on updating the editor, but LE has provided in-game commands to assign scripts to spawns. However, let's come up with a folder structure that makes sense based on the answer to question 3 above.
I'll have more questions, I am sure.

But this looks pretty cool so far.
1. Nope, isn't used anymore. I was going to give people a few days to update their code before I have the update server delete the field.
2. Only if you set a spawn script for every NPC

3. Yes, in fact you HAVE to give the absolute path. It will not assume the file is in the SpawnScripts directory.
4. Hasnt been pushed up to public SVN, but it will tomorrow morning. If you need it on public svn I can push it early.
5. Yah we can add 1 unique index that includes all three.
Posted: Sat Sep 13, 2008 5:19 pm
by John Adams
Cool, no I do not need public SVN yet since I could run the dev code, but this will give me time to sort out how to re-assign our 90 scripts to hundreds of NPCs Scat has already done

Poor Scatman.
So then this statement confuses me a little:
Lethalencounter wrote:Note that the spawn will use a spawnentry script before a spawngroup script and a spawngroup script before a spawn script.
In the new spawn_scripts table, I do see the spawnentry_id, and spawngroup_id. Then of course the lua_script that is to be executed.
Where is this "spawn script" assigned, if the old one in zonespawngroup is obsolete? Maybe I missed a table update somewhere.
Posted: Sat Sep 13, 2008 5:21 pm
by John Adams
Oh duh. If there is only a spawn_id, and lua_script = spawn script?

Btw, I think this SQL query will migrate existing zonespawngroup.spawn_script values to the new table structure.
Code: Select all
insert into spawn_scripts (spawngroup_id,lua_script)
select id,concat("SpawnScripts/",spawn_script)
from zonespawngroup
where length(spawn_script) > 1
order by id;
From there, they can be manually configured to be more granular.
Posted: Sat Sep 13, 2008 5:24 pm
by John Adams
LethalEncounter wrote:2. Only if you set a spawn script for every NPC

On this... is it not true that every NPC, hostile or not, turns to face you if you Hail it? If so, maybe this needs to be in the server NPC AI instead of a LUA function.
Is there any condition where a spawn would NOT face a player who hails it?
Posted: Sat Sep 13, 2008 5:53 pm
by LethalEncounter
I am pretty sure that outside of the cities of EQ2, NPCs don't always face you. Animals for instance probably shouldnt.
Posted: Sat Sep 13, 2008 5:58 pm
by John Adams
Oh, you know what I might be thinking, is the "turn head" thing... how most sentient things will cock their head your way when you come by. You're right. I do not remember a grizzly bear ever allowing me to Hail it before we started a conversation

Posted: Sat Sep 13, 2008 6:00 pm
by LethalEncounter
Yah that might have been a one way conversation
