PerformCameraShake
Posted: Tue Oct 31, 2017 6:19 pm
so there is an PerformCameraShake opcode that wasnt setup in worldstruct, or in code anywhere, and i need it for some zone stuff i am working on,
anyway i test the shake manully with a /test command, and i could barely stay on the boat, so i wanted to add a lua function to use it in this fashin
the first number should be the player( ofrom what i see its the only way the function in code and get your client) the other 2 numbers are the 2 int16s that the packet requires
i think i am missing something in the server console i see an error lua:51 attempt to call global 'PerformCaneraShake' ( a nil value)
I noticed it does not even make it to the lua code in the luafunctions.cpp when i put a breakpoint on if (!lua_interface)
here is my lua function
anyway i test the shake manully with a /test command, and i could barely stay on the boat, so i wanted to add a lua function to use it in this fashin
Code: Select all
PerformCameraShake(Spawn,52429,15948)
PerformCameraShake(Spawn,52429,15820)
PerformCameraShake(Spawn,52429,15820)i think i am missing something in the server console i see an error lua:51 attempt to call global 'PerformCaneraShake' ( a nil value)
I noticed it does not even make it to the lua code in the luafunctions.cpp when i put a breakpoint on if (!lua_interface)
here is my lua function
Code: Select all
int EQ2Emu_lua_PerformCameraShake(lua_State* state){
if (!lua_interface)
return 0;
Client* client = 0;
Spawn* player = lua_interface->GetSpawn(state);
if (player->GetZone())
client = player->GetZone()->GetClientBySpawn(player);
if (!client){
lua_interface->LogError("LUA PerformCameraShake command error: could not find client");
return 0;
}
int16 value1 = lua_interface->GetInt16Value(state,1);
int16 value2 = lua_interface->GetInt16Value(state,2);
PacketStruct* packet = configReader.getStruct("WS_PerformCameraShakeMsg", client->GetVersion());
if (packet){
packet->setDataByName("unknown1", value1);
packet->setDataByName("unknown2", value2);
client->QueuePacket(packet->serialize());
safe_delete(packet);
}
}