- View the Rules before making any decision
- EmuDevs is supported by ads and the community. Disable EmuDevs and sites associated with ED on your AdBlock.
- Check EmuDevs' Twitter
- EmuDevs SQL Generator
- Emudevs FAQ
- I had to make a new account, was my old account deleted?
- Give more information about your Support Issue
- Eluna FAQ
- How can I correctly help a member?
Show EmuDevs your new #attitude!
Yeah, there is no stability issue with that. Infact using the same function for multiple NPCs is more efficient since you only need one function instead of X amount of functions. So you save RAM.
And like Grandelf said and Tommy implied, its a good practice not to repeat stuff.
In general there should be no "stability issues" other than from something we have overlooked or your code does wrong in the logic.
There are ways your code could set something in an incoherent state or you could possibly not notice some small detail.
For example you could use async and sync database queries and possibly read old data, save new data and then save the old data you read over the new data.
Or you could set a timed event go forever and ever cancel it. They do keep firing even if the NPC is dead for example.
Or you could use the addvendoritem - or whats the method called - to add items to the vendor to make a "multivendor" but at the same time you destroy the chance for multiple ppl to use the vendor.
Other than that there might be RAM consumed if your code is wrong or needs to hold a lot of DB data. Eluna in itself does need some RAM as well.
Also efficiency can be limiting as checking hooks and such on events is done etc.
One thing new programmers etc. do often miss is that all variables in the scripts are SHARED.
This means that if you do
Then in this case the entry is shared and the value of that variable changes over time depending on which entry NPC was last spawned ingame.Code:local entry function OnSpawn(creature) entry = creature:GetEntry() end RegisterCreatureEvent(ONSPAWN, 123, OnSpawn) RegisterCreatureEvent(ONSPAWN, 564, OnSpawn)
So if you register a timed event that makes the NPCs say the value of the entry variable, they will keep saying different things depending on ingame spawns and they will NOT only say their own entry (even though when testing the script it might seem so)
Also with same logic, passing stuff through the global or locally global scope between different events or functions is not a good idea. Same thing was basically happening with the multivendor example I said above.
If you know of some stability or other issues, do report them :) Preferrably on our issue tracker:
Last edited by Rochet2; 02-20-2016 at 12:39 AM.Awards:
rochet2.github.io - Home of great codes
There are currently 1 users browsing this thread. (0 members and 1 guests)