Prespawn this a good idea or no?
Before NPCs spawn I want to set entity variables to them if they have certain special attacks.. that way I can just use the entity variables to dictate what special attacks I want to add to them if any...
My Perl script works well with this so far as in it skips mobs that already have Special attacks set in the database and adds special attacks to the mobs that do not have any (usually trash mobs). The second loop is only to check if they have ANY of them so that my scaling script will skip them in the process of adding special attacks to NPCs. My question is... would this bog down the server at all adding that many entity variables to an NPC? Mainly the first loop that adds the specific entity variables based on the type they have. Code:
|
I suppose it depends on how many NPC's have special attacks and how much memory you have. In any case I wouldn't expect it to increase your memory usage per NPC in a really significant way and I don't think the processing overhead would be noticeable unless you were repopping a large zone.
I don't have the big picture here, but what you're storing appears to be redundant. There are quest functions for getting and setting special attacks already. Is there a particular reason you want it stored that way? |
I don't see anything for getting NPC special attacks in perl... or am I missing it?
nvm... I was missing it by a mile.. HasNPCSpecialAtk("Z") Found it lol thank you! :) (I didn't think there was a function for this.. now I know!) I still need the second part though so I know if NPCs have ANY special attack that way I dont overwrite them when I scale the zone. |
I kept looking for it under a different name, but it's there.
$mob->HasNPCSpecialAtk("<flags>") |
Natedog, this is a bad idea
|
Second part a bad idea? May I ask why? :p
(just this part.. I want to know if they have special abilities before I start messing with them in perl) Code:
void NPC::mod_prespawn(Spawn2 *sp) |
I was being a smart ass by not offering any help or suggestion.
If I were to get special attacks in the zone I would do it via DBI this way. It really doesn't make a whole lot of sense to try and push entity variables into memory when you can do it simply via another means. Query the zone NPC types data and push it into a 3D hash that you can quickly reference. Assuming you have some sort of controller NPC that is handling scaling you can do something like: Code:
sub LoadMysql{ When you want to reference it in script you can then set entity variables during the load, after the load or however. For example, let's say I already did sub LoadStaticZoneScaling in my EVENT_SPAWN I can do: Code:
my @NLIST = $entity_list->GetNPCList(); With this you run into the issue of NPC's spawning and needing that data again. You will need to do something in global_npc.pl to trigger a fetch for the data again - you can toss it around a few different ways. Hopefully that helps and gives you an idea - that will help you prevent overwriting an NPC's special attacks if they have them already. |
Ah thanks Akkadius that actually seems like a better idea :)
|
Quote:
$query_handle = $connect->prepare($query); $query_handle->execute(); Otherwise most of it should be fairly accurate. Hopefully it helps |
All times are GMT -4. The time now is 11:00 PM. |
Powered by vBulletin®, Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.