Crash Adding New LUA Function
Posted: Wed Dec 10, 2008 10:47 am
LE, I added the following LUA spell:
Sorry, Fileshare wouldn't let me upload a file then let you view it, you had to download it to view it. We tested a script out last night that used KillSpawn() and it all worked except we get a crash at the end. John sent this:
I tried to look up what was going on but couldn't, for the life of me, figure out what was wrong. I tried searching the error and people on forums said this error is usually some kind of warning but it's clearly a crash. 
Code: Select all
Index: LuaFunctions.cpp
===================================================================
--- LuaFunctions.cpp (revision 175)
+++ LuaFunctions.cpp (working copy)
@@ -102,6 +102,16 @@
return 0;
}
+int EQ2Emu_lua_KillSpawn(lua_State* state) {
+ Spawn* dead = lua_interface->GetSpawn(state);
+ Spawn* killer = lua_interface->GetSpawn(state, 2);
+
+ if (dead && dead->GetZone())
+ dead->GetZone()->KillSpawn(dead, killer);
+
+ return 0;
+}
+
int EQ2Emu_lua_KillSpawnByDistance(lua_State* state){
Spawn* spawn = lua_interface->GetSpawn(state);
float max_distance = lua_interface->GetFloatValue(state, 2);
Index: LuaFunctions.h
===================================================================
--- LuaFunctions.h (revision 175)
+++ LuaFunctions.h (working copy)
@@ -65,6 +65,7 @@
int EQ2Emu_lua_GetLootCoin(lua_State* state);
int EQ2Emu_lua_GetSpawn(lua_State* state);
int EQ2Emu_lua_SpawnSet(lua_State* state);
+int EQ2Emu_lua_KillSpawn(lua_State* state);
int EQ2Emu_lua_KillSpawnByDistance(lua_State* state);
int EQ2Emu_lua_SpawnSetByDistance(lua_State* state);
int EQ2Emu_lua_SetRequiredQuest(lua_State* state);
Index: LuaInterface.cpp
===================================================================
--- LuaInterface.cpp (revision 175)
+++ LuaInterface.cpp (working copy)
@@ -447,6 +447,7 @@
lua_register(state, "StartConversation", EQ2Emu_lua_StartConversation);
lua_register(state, "SpawnSet", EQ2Emu_lua_SpawnSet);
lua_register(state, "SpawnSetByDistance", EQ2Emu_lua_SpawnSetByDistance);
+ lua_register(state, "KillSpawn", EQ2Emu_lua_KillSpawn);
lua_register(state, "KillSpawnByDistance", EQ2Emu_lua_KillSpawnByDistance);
lua_register(state, "SetRequiredQuest", EQ2Emu_lua_SetRequiredQuest);
Code: Select all
> EQ2WorldDebug.exe!operator delete(void * pUserData=0xdddddddd) Line 52 + 0x3 bytes C++
EQ2WorldDebug.exe!Timer::`scalar deleting destructor'() + 0x25 bytes C++
EQ2WorldDebug.exe!ZoneServer::CheckSpawnScriptTimers() Line 1755 + 0x35 bytes C++
EQ2WorldDebug.exe!ZoneServer::Process() Line 653 C++
EQ2WorldDebug.exe!ZoneLoop(void * tmp=0x06f48540) Line 2504 + 0x8 bytes C++
EQ2WorldDebug.exe!_callthreadstart() Line 293 + 0xf bytes C
EQ2WorldDebug.exe!_threadstart(void * ptd=0x06f49110) Line 277 C
kernel32.dll!77e64829()
[Frames below may be incorrect and/or missing, no symbols loaded for kernel32.dll]