[Tutorial] how to add gavestone

Joined
Apr 2, 2013
Messages
1,098
Reaction score
5,857
Ok, since the source of amosin, was published by a User, I'm posting the tutorial of gavestone

Credits for aomsin2526



I hope I have not forgotten anything in this tutorial



Open

C:\WarZ\src\EclipseStudio\Sources\ObjectsCode\Gameplay


Add:

obj_Grave.cpp
obj_Grave.h



Open Warz.sln

Open Warz> Eclipse Studio> 2: Game> GameObjects Code> Gameplay> Right click> Add> Existing Item

Add:
C:\WarZ\src\EclipseStudio\Sources\ObjectsCode\Gameplay\obj_Grave.cpp
C:\WarZ\src\EclipseStudio\Sources\ObjectsCode\Gameplay\obj_Grave.h


in AI_Player.CPP

Search for:
#include "ObjectsCode/Gameplay/obj_Note.h"

Add below:
#include "ObjectsCode/Gameplay/obj_Grave.h" // GraveStone

in AI_Player.CPP

Search for:

// send request to pickup weapon
if(pressedKeyTimer > 1.0f)
{
pressedKeyTimer = 0.0f;
if(dropObj->isObjType(OBJTYPE_SharedUsableItem))
((SharedUsableItem*)dropObj)->m_lastPickupAttempt = curTime+1.0f; // do not attempt to pick this item for 1 sec (wait for server)
// hack for notes
if(dropObj->Class->Name == "obj_Note" || dropObj->Class->Name == "obj_PermanentNote")
{
obj_Note* note = (obj_Note*)dropObj;
if(note->m_GotData) // do not send packet to server again
{
hudMain->showReadNote(note->m_Text.c_str());
hudActionUI->Deactivate();
return;
}
}

Add below:

if(dropObj->Class->Name == "obj_Grave") // GraveStone
{
obj_Grave* Grave = (obj_Grave*)dropObj;
if(Grave->m_GotData) // do not send packet to server again
{
hudMain->showGraveNote(Grave->m_plr1.c_str(),Grave->m_plr2.c_str());
hudActionUI->Deactivate();
return;
}
//hudMain->showGraveNote("NooKud","Killed By ABE");
hudActionUI->Deactivate();
}

in HUDDisplay.cpp


Search for:
#include "ObjectsCode/Gameplay/BasePlayerSpawnPoint.h"

Add below:
#include "ObjectsCode/Gameplay/obj_Grave.h" // GraveStone



in HUDDisplay.cpp

Search for:
gfxHUD.RegisterEventHandler("eventNoteClosed", MAKE_CALLBACK(eventNoteClosed));

Add below:
gfxHUD.RegisterEventHandler("eventGraveNoteClosed", MAKE_CALLBACK(eventGraveNoteClosed)); // GraveStone



in HUDDisplay.cpp

Search for:

void HUDDisplay::eventNoteClosed(r3dScaleformMovie* pMovie, const Scaleform::GFx::Value* args, unsigned argCount)
{
r3dMouse::Hide();


writeNoteSavedSlotIDFrom = 0;
timeoutForNotes = r3dGetTime() + .5f;
}

Add above:

void HUDDisplay::eventGraveNoteClosed(r3dScaleformMovie* pMovie, const Scaleform::GFx::Value* args, unsigned argCount) // GraveStone
{
r3dMouse::Hide();


writeNoteSavedSlotIDFrom = 0;
timeoutForNotes = r3dGetTime() + .5f;
}




in HUDDisplay.cpp

Search for:

void HUDDisplay::eventNoteClosed(r3dScaleformMovie* pMovie, const Scaleform::GFx::Value* args, unsigned argCount)
{
r3dMouse::Hide();


writeNoteSavedSlotIDFrom = 0;
timeoutForNotes = r3dGetTime() + .5f;
}

Add below:

void HUDDisplay::showGraveNote(const char* plr,const char* plr2) // GraveStone
{
if(!Inited) return;


r3dMouse::Show();
writeNoteSavedSlotIDFrom = 1; // temp, to prevent mouse from hiding
Scaleform::GFx::Value var[4];
var[0].SetBoolean(true);
var[1].SetString("R.I.P");
var[2].SetString(plr);
var[3].SetString(plr2);
gfxHUD.Invoke("_root.api.showGraveNote", var, 4);
}



in HUDDisplay.h

Search for:
void eventNoteClosed(r3dScaleformMovie* pMovie, const Scaleform::GFx::Value* args, unsigned argCount);


Add below:
void eventGraveNoteClosed(r3dScaleformMovie* pMovie, const Scaleform::GFx::Value* args, unsigned argCount); // GraveStone


in AI_Player.h

Search for:
void showReadNote(const char* msg);


Add below:
void showGraveNote(const char* plr,const char* plr2); // GraveStone



in ClientGameLogic.cpp

Search for:
#include "ObjectsCode/Gameplay/obj_Note.h"

Add below:
#include "ObjectsCode/Gameplay/obj_Grave.h" // GraveStone


in ClientGameLogic.cpp

Search for:

IMPL_PACKET_FUNC(ClientGameLogic, PKT_S2C_CreateDroppedItem)
{
//r3dOutToLog("obj_DroppedItem %d %d\n", n.spawnID, n.Item.itemID);
r3d_assert(GameWorld().GetNetworkObject(n.spawnID) == NULL);

obj_DroppedItem* obj = (obj_DroppedItem*)srv_CreateGameObject("obj_DroppedItem", "obj_DroppedItem", n.pos);
obj->SetNetworkID(n.spawnID);
obj->m_Item = n.Item;
obj->OnCreate();
}

Add below:

IMPL_PACKET_FUNC(ClientGameLogic, PKT_S2C_CreateGrave) // GraveStone
{
r3d_assert(GameWorld().GetNetworkObject(n.spawnID) == NULL);

obj_Grave* obj = (obj_Grave*)srv_CreateGameObject("obj_Grave", "obj_Grave", n.pos);
obj->SetNetworkID(n.spawnID);
obj->OnCreate();
r3dOutToLog("CreateGrave\n");
}




in ClientGameLogic.cpp

Search for:

IMPL_PACKET_FUNC(ClientGameLogic, PKT_S2C_CreateNote)
{
r3dOutToLog("obj_Note %d\n", n.spawnID);
r3d_assert(GameWorld().GetNetworkObject(n.spawnID) == NULL);

obj_Note* obj = (obj_Note*)srv_CreateGameObject("obj_Note", "obj_Note", n.pos);
obj->SetNetworkID(n.spawnID);
obj->OnCreate();
}

Add below:

IMPL_PACKET_FUNC(ClientGameLogic, PKT_S2C_SetGraveData) // GraveStone
{
obj_Grave* obj = (obj_Grave*)fromObj;
r3d_assert(obj);

obj->m_GotData = true;
obj->m_plr1 = n.plr1;
obj->m_plr2 = n.plr2;


hudMain->showGraveNote(obj->m_plr1.c_str(),obj->m_plr2.c_str());
r3dOutToLog("SetGraveData\n");
}


in ClientGameLogic.cpp

Search for:
DEFINE_PACKET_HANDLER(PKT_S2C_CreateNote);

Add below:

DEFINE_PACKET_HANDLER(PKT_S2C_CreateGrave); // GraveStone
DEFINE_PACKET_HANDLER(PKT_S2C_SetGraveData); // GraveStone


in ClientGameLogic.h

Search for:
DEFINE_PACKET_FUNC(PKT_S2C_CreateNote);

Add below:

DEFINE_PACKET_FUNC(PKT_S2C_CreateGrave); // GraveStone
DEFINE_PACKET_FUNC(PKT_S2C_SetGraveData); // GraveStone


in P2PMessages.h

Search for:

struct PKT_S2C_CreateNote_s : public DefaultPacketMixin<PKT_S2C_CreateNote>
{
gp2pnetid_t spawnID;
r3dPoint3D pos;
};

Add above:

struct PKT_S2C_CreateGrave_s : public DefaultPacketMixin<PKT_S2C_CreateGrave> // GraveStone
{
gp2pnetid_t spawnID;
r3dPoint3D pos;
};


in P2PMessages.h

Search for:

struct PKT_S2C_CreateNote_s : public DefaultPacketMixin<PKT_S2C_CreateNote>
{
gp2pnetid_t spawnID;
r3dPoint3D pos;
};
Add below:

struct PKT_S2C_SetGraveData_s : public DefaultPacketMixin<PKT_S2C_SetGraveData> // GraveStone
{
char plr1[128];
char plr2[1024];
};

search for:
PKT_S2C_CreateDroppedItem,

add below:
PKT_S2C_CreateGrave, // GraveStone
PKT_S2C_SetGraveData, // GraveStone


in WarZ_Server.sln


Open

C:\WarZ\bin\server\WO_GameServer\Sources\ObjectsCode


Add:
sobj_Grave.cpp
sobj_Grave.h



Open WarZ_Server.sln

Open Warz Game Server> 3: ​​Server> GameObjects Code> Right click> Add> Existing Item

Add:
C:\WarZ\bin\server\WO_GameServer\Sources\ObjectsCode\sobj_Grave.cpp
C:\WarZ\bin\server\WO_GameServer\Sources\ObjectsCode\sobj_Grave.h



in P2PMessages.h

Search for:

struct PKT_C2S_CreateNote_s : public DefaultPacketMixin<PKT_C2S_CreateNote>
{
static const int DEFAULT_PLAYER_NOTE_EXPIRE_TIME = 60*24; // in minutes (24 hours of real time (not in-game) expire time)
BYTE SlotFrom; // backpack slot
r3dPoint3D pos;
int ExpMins;
char TextFrom[128];
char TextSubj[1024];
};

Add below:

struct PKT_S2C_CreateGrave_s : public DefaultPacketMixin<PKT_S2C_CreateGrave> // GraveStone
{
gp2pnetid_t spawnID;
r3dPoint3D pos;
};



in P2PMessages.h

Search for:

struct PKT_S2C_CreateNote_s : public DefaultPacketMixin<PKT_S2C_CreateNote>
{
gp2pnetid_t spawnID;
r3dPoint3D pos;
};
Add below:

struct PKT_S2C_SetGraveData_s : public DefaultPacketMixin<PKT_S2C_SetGraveData> // GraveStone
{
char plr1[128];
char plr2[1024];
};

in obj_ServerPlayer.cpp

Search for:
#include "ObjectsCode/sobj_Note.h"
Add below:
#include "ObjectsCode/sobj_Grave.h" // GraveStone


in ServerGameLogic.cpp

Search for:
#include "ObjectsCode/sobj_Note.h"
Add below:
#include "ObjectsCode/sobj_Grave.h" // GraveStone


in ServerGameLogic.cpp

Search for:


void ServerGameLogic::DoKillPlayer(GameObject* sourceObj, obj_ServerPlayer* targetPlr, STORE_CATEGORIES weaponCat, bool forced_by_server, bool fromPlayerInAir, bool targetPlayerInAir )
{
r3dOutToLog("%s killed by %s, forced: %d\n", targetPlr->userName, sourceObj->Name.c_str(), (int)forced_by_server);

Add below:

char plr2msg[128] = {0}; // GraveStone
obj_Grave* obj = (obj_Grave*)srv_CreateGameObject("obj_Grave", "obj_Grave", targetPlr->GetPosition());
obj->SetNetworkID(GetFreeNetId());
obj->NetworkLocal = true;
// vars
if(IsServerPlayer(sourceObj))
{
obj_ServerPlayer * killedByPlr = ((obj_ServerPlayer*)sourceObj);
if (targetPlr->profile_.CustomerID == killedByPlr->profile_.CustomerID)
{
sprintf(plr2msg, "Commit Suicide");
}
else
{
sprintf(plr2msg, "KILLED BY %s", killedByPlr->loadout_->Gamertag);
}
}
else if(sourceObj->isObjType(OBJTYPE_Zombie))
{
sprintf(plr2msg, "EATEN BY ZOMBIE");
}
else
{
sprintf(plr2msg, "Commit Suicide");
}




obj->m_Note.NoteID = 0;
_time64(&obj->m_Note.CreateDate);
obj->m_Note.plr1 = targetPlr->userName;
obj->m_Note.plr2 = plr2msg;
obj->m_Note.ExpireMins = 60;
obj->OnCreate();


in ServerGameLogic.cpp

Search for:

else if(base->Class->Name == "obj_Note")
{
obj_Note* obj = (obj_Note*)base;
obj->NetSendNoteData(peerId);
}

Add below:

else if(base->Class->Name == "obj_Grave") // GraveStone
{
obj_Grave* obj = (obj_Grave*)base;
obj->NetSendGraveData(peerId);
}
 
Last edited:
Getting unresolved external on server. Error 60 error LNK2001: unresolved external symbol "public: void __thiscall obj_Grave::NetSendGraveData(unsigned long)" (?NetSendGraveData@obj_Grave@@QAEXK@Z) ServerGameLogic.obj WarZ Game Server
 
Getting unresolved external on server. Error 60 error LNK2001: unresolved external symbol "public: void __thiscall obj_Grave::NetSendGraveData(unsigned long)" (?NetSendGraveData@obj_Grave@@QAEXK@Z) ServerGameLogic.obj WarZ Game Server

you added sobj_Grave.cpp and sobj_Grave.h inside the folder WarZ\bin\server\WO_GameServer\Sources\ObjectsCode ?

and included within your solution?
 
Last edited:
What's gavestone

gavestone

Lh7knOY - [Tutorial] how to add gavestone - RaGEZONE Forums


C8lI43I - [Tutorial] how to add gavestone - RaGEZONE Forums
 
Last edited:
Back