John Adams wrote:
Is it possible/feasible to have a "global script" that has functions that every NPC might use... like the FaceTarget() function when targeted or hailed? I guess that might be ridiculous for badgers and bugs to consciously face you for no apparent reason... so many a toggle in the spawn record to "use globals" blah blah.
It would be possible, but I don't think it is feasible unless you have multiple default files (one for each spawn type), which kinda defeats the purpose. If someone has an idea about how to do this this without adding too much needless complexity I can change it.
John Adams wrote:
Also, proximity reactions - like passing by an NPC who blurts out some sales pitch or annoyingly gleeful greeting.
I could have the code check for proximity and if the spawn is within say 15 feet (half of the chat distance), call a function in the LUA script that could say whatever you wanted.
John Adams wrote:
Can NPCs perform a visual "action" in the script? Like move to x,y,z then start gathering, like Paula is supposed to do.
Currently no, I hadn't anticipated it when I was coding the function although I can easily add it to the function when I get a chance.
John Adams wrote:
For "packs" of NPCs (as I mentioned above) that move together - guards, enemy patrols, etc - could it be made easier to assign them a single script, and they just walk along together in formation based on their destination coords? Rather than give each and every NPC in formation movement commands...
I can see the need for group movement in the LUA code, but instead of adding a complex table to the database we handle it solely from the LUA scripts? IE instead of MovementLoopAddLocation(NPC, x, y, z, speed, delay), have a function called GroupMovementLoopAddLocation(Group Name, x, y, z, speed, delay). Group Name could be any string you wanted to describe the group and would make it a lot easier to keep track of rather than a group number. Have this function called from 1 script as many times as you would like for the locations. Then call a function called GroupMovementAddNPC(Group Name, NPC, x_offset, z_offset) for each NPC that comprises the group. The offsets would be the values added (or subtracted) from the x and z coords to keep them close to each other without overlapping.
So for the 'head' NPC's script:
Code: Select all
function spawn(NPC)
GroupMovementLoopAddLocation("Queen Island Guards", 22.19, -6.86, 183.95, 2, 5)
GroupMovementLoopAddLocation("Queen Island Guards", 30.76, -6.33, 196.28, 2, 5)
GroupMovementLoopAddLocation("Queen Island Guards", 20.70, -6.85, 206.43, 2, 5)
GroupMovementLoopAddLocation("Queen Island Guards", -.90, -5.47, 212.14, 2, 5)
GroupMovementLoopAddLocation("Queen Island Guards", 2.35, -4.73, 196.93, 2, 5)
GroupMovementAddNPC("Queen Island Guards", NPC, 0, 0)
end
For other NPCs in the same group:
Code: Select all
function spawn(NPC)
GroupMovementAddNPC("Queen Island Guards", NPC, 2, 2)
end
function spawn(NPC)
GroupMovementAddNPC("Queen Island Guards", NPC, -2, -2)
end
function spawn(NPC)
GroupMovementAddNPC("Queen Island Guards", NPC, 2, 0)
end
If someone has a better idea, let me know.
John Adams wrote:
This might also be a good time to consider "signaling" between NPCs. Eg., you hail an NPC and start a dialog, and that NPC "signals" another to walk this way, or perform some action, etc.
That could probably be handled easier with a GetNPC(Name) LUA function. That way your script could handle whatever you wanted all from the Hail function.
John Adams wrote:
BUG: Can we stop targeting from generating a Hail? Unless it's a default action and we double-click (Hail) or right-click select Hail, we shouldn't get the hail on single left-click, just target. I think. I like the option of function targeted() where the NPC >could< respond to that... just not the Hail part.
Targeting doesn't generate a Hail unless the default command is "Hail". On live I never had to double click to have it Hail. Every time I single click on a Hail'able spawn on live it Hails it. So I think it is working correctly.
John Adams wrote:
Lastly, can we start early on organizing our scripts folders maybe by zone? Or perhaps that could be left up to the admin to include the path in the spawn_script field? I was just thinking about rats in many zones, will all require their own script. I know you can name the script by the spawnID so they do not accidentally use "a_rat.lua" in every zone for every rat... just a thought.
You should be able to do this right now, just use a / as the directory separator. So if you want your Antonica spawns to be in an Antonica directory inside of the SpawnScripts directory, simply have the spawn_script field in the table set to Antonica/Whateveryouwant.lua
If it doesnt work let me know, but that should work fine.