AI in Lua
#3
(01-29-2015, 04:35 PM)xoft Wrote: Unfortunately your code as it is won't work and will most likely crash the server quite soon. You're doing something that should never ever be done - you're storing cEntity objects for later usage. If the server destroys the entity in between the calls to AI_OnWorldTick(), your AI_Mob table contains reference to an object that is no longer valid and accessing it in any way is Undefined Behavior, which may result in the code appearing to work or crashing the server or causing a nuclear meltdown or devouring the entire Earth in a black hole. You can only store the UniqueID and look the entity object up again when needed.

The plan is to do the lookup. That is why I store the UUID. I couldn't find the code to look up the entity by UUID. So I did this to test. Smile
Reply
Thanks given by:


Messages In This Thread
AI in Lua - by wudles - 01-29-2015, 09:26 AM
RE: AI in Lua - by xoft - 01-29-2015, 04:35 PM
RE: AI in Lua - by wudles - 01-29-2015, 04:45 PM
RE: AI in Lua - by xoft - 01-29-2015, 04:48 PM
RE: AI in Lua - by tigerw - 01-30-2015, 08:27 AM
RE: AI in Lua - by wudles - 01-30-2015, 08:36 AM
RE: AI in Lua - by xoft - 01-30-2015, 08:48 AM
RE: AI in Lua - by wudles - 01-31-2015, 03:36 AM
RE: AI in Lua - by DiamondToaster - 02-02-2015, 05:10 AM
RE: AI in Lua - by wudles - 02-02-2015, 05:41 AM
RE: AI in Lua - by DiamondToaster - 02-02-2015, 06:01 AM
RE: AI in Lua - by jsebean - 06-18-2015, 06:35 AM
RE: AI in Lua - by warmist - 06-19-2015, 01:24 AM
RE: AI in Lua - by worktycho - 06-19-2015, 01:27 AM
RE: AI in Lua - by warmist - 06-19-2015, 01:58 AM
RE: AI in Lua - by worktycho - 06-19-2015, 03:18 AM
RE: AI in Lua - by SamJBarney - 06-19-2015, 03:30 AM
RE: AI in Lua - by warmist - 06-19-2015, 03:50 AM
RE: AI in Lua - by SamJBarney - 06-19-2015, 04:01 AM



Users browsing this thread: 2 Guest(s)