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] Fast change backpack one click all srcs

Junior Spellweaver
Joined
Jan 19, 2014
Messages
136
Reaction score
126
HI!!! RAGEZONE

Excuse my English ... As you know all the srcs posted here comes full of errors and bugs, and nothing better than picking up what matters and editing in your pet src ... This code speeds the exchange of bags inside the Game with just 1 click, functional in any src currently I tested it in education and it worked.


Search function
Code:
void HUDPause::eventBackpackDrop(r3dScaleformMovie* pMovie, const Scaleform::GFx::Value* args, unsigned argCount)
{
}


Add above
Code:
void HUDPause::ChangePlayerBackpackFast(int ItemID) // jailson mendes
{
      obj_Player* plr = gClientLogic().localPlayer_;
      r3d_assert(plr);
      wiCharDataFull& slot = plr->CurLoadout;
 
      // find inventory slot
      int slotFrom = -1;
      for(int i=0; i<slot.BackpackSize; ++i)
      {
            if(slot.Items[i].itemID == ItemID)
            {
                  slotFrom = i;
                  break;
            }
      }
      if(slotFrom == -1)
            return;
 
      if(plr->ChangeBackpack(slotFrom))
      {
            {
                  Scaleform::GFx::Value var[10];
                  char tmpGamertag[128];
                  if(plr->ClanID != 0)
                        sprintf(tmpGamertag, "[%s] %s", plr->ClanTag, slot.Gamertag);
                  else
                        r3dscpy(tmpGamertag, slot.Gamertag);
                  var[0].SetString(tmpGamertag);
                  var[1].SetNumber(slot.Health);
                  var[2].SetNumber(slot.Stats.XP);
                  var[3].SetNumber(slot.Stats.TimePlayed);
                  var[4].SetNumber(slot.Alive);
                  var[5].SetNumber(slot.Hunger);
                  var[6].SetNumber(slot.Thirst);
                  var[7].SetNumber(slot.Toxic);
                  var[8].SetNumber(slot.BackpackID);
                  var[9].SetNumber(slot.BackpackSize);
                  gfxMovie.Invoke("_root.api.updateClientSurvivor", var, 10);
 
                  if (gClientLogic().localPlayer_)
                        SoundSys.PlayAndForget(SoundSys.GetEventIDByPath("Sounds/UI Events/User_Action/User_Action_Swap_Backpack"), gClientLogic().localPlayer_->GetPosition());
 
            }
            reloadBackpackInfo();
            updateSurvivorTotalWeight();
            gfxMovie.Invoke("_root.api.changeBackpackSuccess", "");
      }     
      else
      {
            UnlockUI(); // Comment this line if you use a src v1
            Scaleform::GFx::Value var[3];
            var[0].SetStringW(gLangMngr.getString("FailedToChangeBackpack"));
            var[1].SetBoolean(true);
            var[2].SetString("$ERROR");
            gfxMovie.Invoke("_root.api.showInfoMsg", var, 3);
      }
}

Now search for
Code:
void HUDPause::eventContextMenu_Action(r3dScaleformMovie* pMovie, const Scaleform::GFx::Value* args, unsigned argCount)

And in case 6, make it look like this.
Code:
case 6:
                  if(bc)
                  {
                        ChangePlayerBackpackFast(wi.itemID);
                        //gfxMovie.Invoke("_root.api.Main.showChangeBackpack", "");
                        return;
                  }
            break;


Finally search for this
Code:
void  eventBackpackGridSwap(r3dScaleformMovie* pMovie, const Scaleform::GFx::Value* args, unsigned argCount);

Add above
Code:
void  ChangePlayerBackpackFast(int ItemID);

Warz_server.sln

Search for:

Code:
void obj_ServerPlayer::OnNetPacket(const PKT_C2S_PlayerChangeBackpack_s& n)


Add after this:
Code:
OnLoadoutChanged();


Code:
[COLOR=#ff0000]PKT_S2C_BackpackUnlock_s n3;    gServerLogic.p2pSendToPeer(peerId_, this, &n3, sizeof(n3));[/COLOR]


Add after this:
Code:
void	eventBackpackGridSwap(r3dScaleformMovie* pMovie, const Scaleform::GFx::Value* args, unsigned argCount);

This↓
Code:
void	ChangePlayerBackpackFast(int ItemID);

Have FUN!!!
 
Last edited:
Newbie Spellweaver
Joined
Sep 15, 2007
Messages
44
Reaction score
7
Your tutorial need a hotfix to works. Yes, Does not work as you taught.
 
Newbie Spellweaver
Joined
Jul 25, 2017
Messages
35
Reaction score
1
fix to fast change backpack (tested in untouched source)
open the warz_server
###LOOK FOR THIS###

void obj_ServerPlayer::RepairItemWithKit(int slot, bool isPremium)


###ADD THIS ABOVE###

OnLoadoutChanged();

//changebackpackfast
PKT_S2C_BackpackUnlock_s n3;
gServerLogic.p2pSendToPeer(peerId_, this, &n3, sizeof(n3));

return;
}


####I GO TO MAKE THE COMPLETE TUTORIAL SOON####
 
Last edited:
Back
Top