Welcome!

Join our community of MMO enthusiasts and game developers! By registering, you'll gain access to discussions on the latest developments in MMO server files and collaborate with like-minded individuals. Join us today and unlock the potential of MMO server development!

Join Today!

[Tutorial]Switching Weapons while running & place old ammo back in backpack

Initiate Mage
Joined
Feb 17, 2014
Messages
4
Reaction score
6
Heya,

first of all, i dont know if something like this already exists

Switch Weapons while running:
Search in WarZ.sln in AI_Player.cpp for:
Code:
else if(InputMappingMngr->wasPressed(r3dInputMappingMngr::KS_NEXTITEM))
and scroll up until u see something like that:
Code:
if(PlayerState != PLAYER_MOVE_SPRINT )
and remove that check and the else (there r 2 of that (for final & release))

place old ammo in backpack instead of dropping it:
in WarZ_Server.sln in obj_ServerPlayer.cpp search for:
Code:
void obj_ServerPlayer::OnNetPacket(const PKT_C2C_PlayerReload_s& n)
and scroll down until u see something like that:
Code:
    if(wpn->getPlayerItem().Var1 > 0 && wpn->getPlayerItem().Var2 > 0)
    {
        obj_DroppedItem* obj = (obj_DroppedItem*)srv_CreateGameObject("obj_DroppedItem", "obj_DroppedItem", GetRandomPosForItemDrop());
        obj->SetNetworkID(gServerLogic.GetFreeNetId());
        obj->NetworkLocal = true;
        // vars
        obj->m_Item.itemID   = wpn->getPlayerItem().Var2;
        obj->m_Item.quantity = 1;
        obj->m_Item.Var1     = wpn->getPlayerItem().Var1;
    }
and change it to:
Code:
    if(wpn->getPlayerItem().Var1 > 0 && wpn->getPlayerItem().Var2 > 0)
    {
        wiInventoryItem wi;
        wi.itemID   = wpn->getPlayerItem().Var2;
        wi.quantity = 1;
        wi.Var1     = wpn->getPlayerItem().Var1;
        BackpackAddItem(wi);
    }

Have fun, TH4D3U5
 
Initiate Mage
Joined
Aug 25, 2016
Messages
4
Reaction score
1
I have absolutely no clue what i should change to fix this. can someone please send me the code?
for fixing the switch while sprinting. TY
 
Back
Top