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] Pickup item animation for PUBG

Newbie Spellweaver
Joined
Sep 3, 2015
Messages
63
Reaction score
50

P2PMessages.h
Search ;
Code:
PKT_C2C_PlayerJump,
and add this below ;
Code:
// Player Interact Anim  
PKT_C2C_StartPickup,
Now search for this;
Code:
struct PKT_C2C_PlayerJump_s : public DefaultPacketMixin<PKT_C2C_PlayerJump>

{

};
and add this below ;
Code:
///////////////////////// Player Interact Anim    /////////////////////////

struct PKT_C2C_StartPickup_s : public DefaultPacketMixin<PKT_C2C_StartPickup>

{    

//Empty

};


AI_Player.cpp
Search ;
Code:
DEFINE_GAMEOBJ_PACKET_HANDLER(PKT_C2C_PlayerJump);

and add this below ;
Code:
DEFINE_GAMEOBJ_PACKET_HANDLER(PKT_C2C_StartPickup);

Search ;
Code:
void obj_Player::StartJump()

and add this below ;
Code:
void obj_Player::StartPickup()
{
    ChangeWeaponByIndex(HANDS_WEAPON_IDX);
    uberAnim_->StartPickupAnim();
    PKT_C2C_StartPickup_s n;
    p2pSendToHost(this, &n, sizeof(n));        

     // more code is needed -/- random AI dialog sound
    // more code is needed -/- cancel the sound when the AI change the playerstate
    // more code is needed -/- sync animation with the default idl playerstate
}

Search ;
Code:
void obj_Player::OnNetPacket(const PKT_C2C_PlayerJump_s& n)

and add this below ;
Code:
void obj_Player::OnNetPacket(const PKT_C2C_StartPickup_s& n)
{
    uberAnim_->StartPickupAnim();
    return;
}

Search ;
Code:
if(dropObj->Class->Name == "obj_FarmBlock")

Add Below ;
Code:
uberAnim_->StartPickupAnim(); //start pickup animation here - temporal logic

Now look below this;
Code:
// if we picked up weapon with empty hands - switch to it
if(m_SelectedWeapon == HANDS_WEAPON_IDX && (n.SlotTo == wiCharDataFull::CHAR_LOADOUT_WEAPON1 || n.SlotTo == wiCharDataFull::CHAR_LOADOUT_WEAPON2))
{    
ChangeWeaponByIndex(n.SlotTo);
}

hudMain->showMessage(gLangMngr.getString("InfoMsg_NewItemAdded"));

and add this below ;
Code:
uberAnim_->StartPickupAnim(); //start pickup animation here - temporal logic


AI_Player.h
Search ;
Code:
void             OnNetPacket(const PKT_C2C_PlayerJump_s& n);

and add this below ;
Code:
void             OnNetPacket(const PKT_C2C_StartPickup_s& n);

This float search ;
Code:
float        StartFallingTime;

and add this below ;
Code:
// Interact Anim System
    void        StartPickup();


AI_PlayerAnim.cpp

Search;
Code:
void CUberData::LoadDeathAnim()
{
...
}

and add this below ;
Code:
void CUberData::LoadPlayerInteractAnim()
{
    aid_.PlayerInteract[0] = AddAnimation("PickUpItem");
}

Search ;
Code:
LoadHandsAnim();

and add this below ;
Code:
LoadPlayerInteractAnim();

Search ;
Code:
void CUberAnim::StartDeathAnim()

{

...

}

and add this below ;
Code:
///////////////////////////////////////////////////////////// PLAYER INTERACT /////////////////////////////////////////////////////////////
void CUberAnim::StartPickupAnim()
{    

StopReloadAnim();    
    anim.StartAnimation(data_->aid_.PlayerInteract[0], ANIMFLAG_PauseOnEnd | ANIMFLAG_RemoveOtherFade, 0.0f, 1.0f, 0.1f);
}

AI_PlayerAnim.h

Search ;
Code:
int        deaths[20];

and add this below ;
Code:
int        PlayerInteract[20]; // for player Interactive with objs
Search ;
Code:
void         LoadDeathAnim();

and add this below ;
Code:
void         LoadPlayerInteractAnim(); // player interactive with objs
Search ;
Code:
void        StartDeathAnim();

and add this below ;
Code:
        // NEW ANIMATION SYSTEM
    //-------------- Interactive Anim --------------
    void        StartPickupAnim();        

    void        StartPickup();
 
Banned
Banned
Joined
Apr 16, 2018
Messages
466
Reaction score
252
Very Good,Everyone go go download Files Mega and copy code right now.kkk:junglejane:
 
Newbie Spellweaver
Joined
Jul 25, 2017
Messages
35
Reaction score
1
i did not find this code: if(dropObj->Class->Name == "obj_FarmBlock") ????? have other code to search ?
 
Last edited:
Newbie Spellweaver
Joined
Oct 22, 2015
Messages
8
Reaction score
0
if(dropObj->Class->Name == "obj_FarmBlock")

It doesn't exist, where do I need to add it?
 
Back
Top