#closed because lot of people sent me "please help", "how to add to game"....
is it from the new game file? :rolleyes:Quote:
Hello everybody!
Here the source:
Code:int __fastcall quest__pet_summon(int a1) { //- get datas from lua -- read vnum and name int mobvnum = lua_tonumber(a1, 1); const char* mobname = lua_tostring(a1, 2); //- get character position int spawn_mapindex = *(_DWORD *)(a1 + 220 + 32)/*character_mapindex*/; int spawn_x = *(_DWORD *)(a1 + 220 + 48)/*character_x_on_map*/ + number_ex(-20, 20, (int)"pets", 10)/*random number*/; int spawn_y = *(_DWORD *)(a1 + 220 + 52)/*character_y_on_map*/ + number_ex(-20, 20, (int)"pets", 10)/*random number*/; int spawn_z = *(_DWORD *)(a1 + 220 + 56)/*character_z_on_map*/; int spawn_rotate = *(_DWORD *)(a1 + 220 + 2344) + 180.0/*character_rotate_on_map*/; //- create mob int mobid = CHARACTER_MANAGER__SpawnMob(0,mobvnum,spawn_mapindex,spawn_x,spawn_y,spawn_z,0,spawn_rotate,0); //- set mob name std__string__assign(0, 0, mobid + 260, (int)mobname, strlen(mobname)); //- show mob if (!CHARACTER__Show(mobid,spawn_mapindex,spawn_x,spawn_y,spawn_z,0)) { //- if not showed the mob: //- remove mob CHARACTER_MANAGER__DestroyCharacter(a1, 0, singleton_CHARACTER_MANAGER___ms_singleton, mobid); //- send error to syserr sys_err((int)"PetSummon", 192, "cannot show monster", 137591780); //- return 0 -- exit func return 0; } //- attach mob to character CHARACTER__SetRider(a1, 0, mobid, a1 + 220); //- return whit spawned mob id (id of the mob on map) lua_pushnumber(a1, mobid); return 1; } int __fastcall quest__pet_unsummon(int a1) { //- get datas from lua -- read spawned mob id (id of the mob on map) int mobid = lua_tonumber(a1, 1); //- return if mobid is 0 -- exit func if ( !mobid ) return 0; //- deattach mob from character CHARACTER__SetRider(a1, 0, mobid, 0); //- remove mob CHARACTER_MANAGER__DestroyCharacter(a1, 0, singleton_CHARACTER_MANAGER___ms_singleton, mobid); // return -- end of func return 0; }
Quote:
#closed because lot of people sent me "please help", "how to add to game"....
int __fastcall quest__pet_summon(int a1)
{
//- get datas from lua -- read vnum and name
int mobvnum = lua_tonumber(a1, 1);
const char* mobname = lua_tostring(a1, 2);
//- get character position
int spawn_mapindex = *(_DWORD *)(a1 + 220 + 32)/*character_mapindex*/;
int spawn_x = *(_DWORD *)(a1 + 220 + 48)/*character_x_on_map*/ + number_ex(-20, 20, (int)"pets", 10)/*random number*/;
int spawn_y = *(_DWORD *)(a1 + 220 + 52)/*character_y_on_map*/ + number_ex(-20, 20, (int)"pets", 10)/*random number*/;
int spawn_z = *(_DWORD *)(a1 + 220 + 56)/*character_z_on_map*/;
int spawn_rotate = *(_DWORD *)(a1 + 220 + 2344) + 180.0/*character_rotate_on_map*/;
//- create mob
int mobid = CHARACTER_MANAGER__SpawnMob(0,mobvnum,spawn_mapindex,spawn_x,spawn_y,spawn_z,0,spawn_rotate,0);
//- set mob name
std__string__assign(0, 0, mobid + 260, (int)mobname, strlen(mobname));
//- show mob
if (!CHARACTER__Show(mobid,spawn_mapindex,spawn_x,spawn_y,spawn_z,0))
{
//- if not showed the mob:
//- remove mob
CHARACTER_MANAGER__DestroyCharacter(a1, 0, singleton_CHARACTER_MANAGER___ms_singleton, mobid);
//- send error to syserr
sys_err((int)"PetSummon", 192, "cannot show monster", 137591780);
//- return 0 -- exit func
return 0;
}
//- attach mob to character
CHARACTER__SetRider(a1, 0, mobid, a1 + 220);
//- return whit spawned mob id (id of the mob on map)
lua_pushnumber(a1, mobid);
return 1;
}
int __fastcall quest__pet_unsummon(int a1)
{
//- get datas from lua -- read spawned mob id (id of the mob on map)
int mobid = lua_tonumber(a1, 1);
//- return if mobid is 0 -- exit func
if ( !mobid ) return 0;
//- deattach mob from character
CHARACTER__SetRider(a1, 0, mobid, 0);
//- remove mob
CHARACTER_MANAGER__DestroyCharacter(a1, 0, singleton_CHARACTER_MANAGER___ms_singleton, mobid);
// return -- end of func
return 0;
}
You can get the pseudocode of the gamefile by IDA disassembler.Quote:
How ?
Quote:
PHP Code:int __fastcall quest__pet_summon(int a1)
{
//- get datas from lua -- read vnum and name
int mobvnum = lua_tonumber(a1, 1);
const char* mobname = lua_tostring(a1, 2);
//- get character position
int spawn_mapindex = *(_DWORD *)(a1 + 220 + 32)/*character_mapindex*/;
int spawn_x = *(_DWORD *)(a1 + 220 + 48)/*character_x_on_map*/ + number_ex(-20, 20, (int)"pets", 10)/*random number*/;
int spawn_y = *(_DWORD *)(a1 + 220 + 52)/*character_y_on_map*/ + number_ex(-20, 20, (int)"pets", 10)/*random number*/;
int spawn_z = *(_DWORD *)(a1 + 220 + 56)/*character_z_on_map*/;
int spawn_rotate = *(_DWORD *)(a1 + 220 + 2344) + 180.0/*character_rotate_on_map*/;
//- create mob
int mobid = CHARACTER_MANAGER__SpawnMob(0,mobvnum,spawn_mapindex,spawn_x,spawn_y,spawn_z,0,spawn_rotate,0);
//- set mob name
std__string__assign(0, 0, mobid + 260, (int)mobname, strlen(mobname));
//- show mob
if (!CHARACTER__Show(mobid,spawn_mapindex,spawn_x,spawn_y,spawn_z,0))
{
//- if not showed the mob:
//- remove mob
CHARACTER_MANAGER__DestroyCharacter(a1, 0, singleton_CHARACTER_MANAGER___ms_singleton, mobid);
//- send error to syserr
sys_err((int)"PetSummon", 192, "cannot show monster", 137591780);
//- return 0 -- exit func
return 0;
}
//- attach mob to character
CHARACTER__SetRider(a1, 0, mobid, a1 + 220);
//- return whit spawned mob id (id of the mob on map)
lua_pushnumber(a1, mobid);
return 1;
}
int __fastcall quest__pet_unsummon(int a1)
{
//- get datas from lua -- read spawned mob id (id of the mob on map)
int mobid = lua_tonumber(a1, 1);
//- return if mobid is 0 -- exit func
if ( !mobid ) return 0;
//- deattach mob from character
CHARACTER__SetRider(a1, 0, mobid, 0);
//- remove mob
CHARACTER_MANAGER__DestroyCharacter(a1, 0, singleton_CHARACTER_MANAGER___ms_singleton, mobid);
// return -- end of func
return 0;
}