• Unfortunately, we have experienced significant hard drive damage that requires urgent maintenance and rebuilding. The forum will be a state of read only until we install our new drives and rebuild all the configurations needed. Please follow our Facebook pagefor updates, or we will be back up shortly! (The forum could go offline at any given time due to the nature of the failed drives whilst awaiting the upgrades.)

[Release] Animal System

Status
Not open for further replies.
Newbie Spellweaver
Joined
Apr 13, 2013
Messages
54
Reaction score
109
WarZ.sln

AI_Player.cpp

add

Code:
#include "../Gameplay/obj_Animals.h"

find

Code:
if(!((*gameObj)->isObjType(OBJTYPE_Human) || (*gameObj)->isObjType(OBJTYPE_Zombie) || (*gameObj)->Class->Name == "obj_ZombieDummy"))

replace to

Code:
if(!((*gameObj)->isObjType(OBJTYPE_Human) || (*gameObj)->isObjType(OBJTYPE_Zombie) || (*gameObj)->Class->Name == "obj_ZombieDummy" || (*gameObj)->Class->Name == "obj_Animals"))

find

Code:
bool canDamageTarget(const GameObject* obj)
{
    if(obj->isObjType(OBJTYPE_Human))
        return true;

add

Code:
if(obj->Class->Name == "obj_Animals")
        return true;

find

Code:
// if we hit local player, display hit effect
    if(target->isObjType(OBJTYPE_Human))
    {
        AddBloodOnGround(n.hit_pos);
        SpawnImpactParticle(r3dHash::MakeHash("player"), r3dHash::MakeHash(m_Weapons[m_SelectedWeapon]->getDecalSource()), n.hit_pos, dir);


        if(target->NetworkLocal == false || CGL.localPlayer_==NULL) 
            return;


        // if hit local player
        extern void TPSGameHUD_AddHitEffect(GameObject* from);
        TPSGameHUD_AddHitEffect(this);
    }

add

Code:
else if(target->Class->Name == "obj_Animals")
    {
        AddBloodOnGround(n.hit_pos);
        SpawnImpactParticle(r3dHash::MakeHash("player"), r3dHash::MakeHash(m_Weapons[m_SelectedWeapon]->getDecalSource()), n.hit_pos, dir);
    }

find

Code:
if( shootTarget == NULL && shootMaterial == NULL) // hit nothing
    {
        PKT_C2C_PlayerHitNothing_s n;
        p2pSendToHost(owner, &n, sizeof(n), true);
    }

add

Code:
    else if (shootTarget && shootTarget->Class->Name == "obj_Animals")
    {
        SpawnImpactParticle(r3dHash::MakeHash("player"),r3dHash::MakeHash(weaponInfo->m_PrimaryAmmo->getDecalSource()), hitPoint, hitNormal);
        if (ownerPlayer)
        ownerPlayer->AddBloodOnGround(hitPoint);


        //r3dOutToLog("Hit Animals\n");
        //obj_Animals* trgt = (obj_Animals*)shootTarget;


        //if(!trgt->bDead)
        //{
            PKT_C2C_PlayerHitDynamic_s n;
            n.muzzler_pos = muzzlerPosAtFireStart;
            n.hit_pos = hitPoint;
            n.targetId = toP2pNetId(shootTarget->GetNetworkID());
            n.hit_body_part = 0;
            n.hit_body_bone = 0;
            n.damageFromPiercing = damageFromPiercable;
            // NOTE: This can be broken if the player jumps after firing a sniper rifle, but shouldn't happen as it's too fast.
            n.state = 0;
            p2pSendToHost( owner, &n, sizeof(n), true);


            if(ownerPlayer) 
            {
                ownerPlayer->m_HitMarkerFadeout = 1.0f;
            }
        //}
    }

P2PMessages.h

find

Code:
enum pkttype_e
{
  PKT_C2S_ValidateConnectingPeer = r3dNetwork::FIRST_FREE_PACKET_ID,

add

Code:
PKT_S2C_CreateAnimals,
PKT_S2C_AnimalsMove,

add

Code:
struct PKT_S2C_CreateAnimals_s : public DefaultPacketMixin<PKT_S2C_CreateAnimals>
{
gp2pnetid_t    spawnID;
r3dPoint3D    spawnPos;
};
struct PKT_S2C_AnimalsMove_s : public DefaultPacketMixin<PKT_S2C_AnimalsMove>
{
    r3dVector angle;
    r3dPoint3D pos;
    int state;
};

ClientGameLogic.cpp

add

Code:
#include "ObjectsCode/Gameplay/obj_Animals.h"

find

Code:
DEFINE_PACKET_HANDLER(PKT_S2C_CreateZombie);

add

Code:
DEFINE_PACKET_HANDLER(PKT_S2C_CreateAnimals);

find

Code:
IMPL_PACKET_FUNC(ClientGameLogic, PKT_S2C_CreateZombie)
{
    //r3dOutToLog("obj_Zombie %d\n", n.spawnID);
    r3d_assert(GameWorld().GetNetworkObject(n.spawnID) == NULL);


    obj_Zombie* obj = (obj_Zombie*)srv_CreateGameObject("obj_Zombie", "obj_Zombie", n.spawnPos);
    obj->SetNetworkID(n.spawnID);
    obj->NetworkLocal = false;
    memcpy(&obj->CreateParams, &n, sizeof(n));
    obj->OnCreate();


    // set base cell for movement data (must do it AFTER OnCreate())
    obj->netMover.SetStartCell(n.moveCell);
}

add
Code:
IMPL_PACKET_FUNC(ClientGameLogic, PKT_S2C_CreateAnimals)
{
    r3dOutToLog("obj_Animals %d\n", n.spawnID);
    r3d_assert(GameWorld().GetNetworkObject(n.spawnID) == NULL);
    obj_Animals* obj = (obj_Animals*)srv_CreateGameObject("obj_Animals", "Data\\ObjectsDepot\\WZ_Animals\\char_deer_01.sco", n.spawnPos);
    obj->SetNetworkID(n.spawnID);
    obj->NetworkLocal = false;
    //memcpy(&obj->CreateParams, &n, sizeof(n));
    obj->OnCreate();
}
]
ClientGameLogic.h

find

Code:
DEFINE_PACKET_FUNC(PKT_S2C_CreateZombie);

add

Code:
 DEFINE_PACKET_FUNC(PKT_S2C_CreateAnimals);

WarZ_Server.sln

ServerGameLogic.cpp

add

Code:
#include "ObjectsCode/sobj_Animals.h"

find

Code:
bool ServerGameLogic::CanDamageThisObject(const GameObject* targetObj)
{
    if(IsServerPlayer(targetObj))
    {
        return true;
    }

add

Code:
    else if(targetObj->Class->Name == "obj_Animals")
    {
        return true;
    }

find

Code:
if(strncmp(cmd, "/sv", 3) == 0 && plr->profile_.ProfileData.isDevAccount)
        return Cmd_SetVitals(plr, cmd);

add

Code:
            if(strncmp(cmd, "/ani", 5) == 0 && plr->profile_.ProfileData.isDevAccount)
        {
            obj_Animals* obj =     (obj_Animals*)srv_CreateGameObject("obj_Animals", "obj_Animals", plr->GetPosition());
            obj->SetNetworkID(GetFreeNetId());
            obj->NetworkLocal = true;
            obj->hardObjLock = plr->GetSafeID();
            obj->OnCreate();
        }

obj_ServerPlayer.cpp

add

Code:
#include "ObjectsCode/sobj_Animals.h"

find

Code:
if(obj_ServerPlayer* targetPlr = IsServerPlayer(targetObj))
    {
        if(gServerLogic.ApplyDamageToPlayer(this, targetPlr, GetPosition()+r3dPoint3D(0,1,0), damage, n.hit_body_bone, n.hit_body_part, false, m_WeaponArray[m_SelectedWeapon]->getCategory()))
        {
            //HACK: track Kill here, because we can't pass weapon ItemID to ApplyDamageToPlayer yet
            int isKill = ((obj_ServerPlayer*)targetObj)->loadout_->Alive == 0 ? 1 : 0;
            gServerLogic.TrackWeaponUsage(m_WeaponArray[m_SelectedWeapon]->getConfig()->m_itemID, 0, 1, isKill);
        }
    }

add

Code:
else if(targetObj->Class->Name == "obj_Animals")
    {
        obj_Animals* animal = (obj_Animals*)targetObj;
        animal->ApplyDamage(damage,this);
    }

for spawn 1 animal per one zombiespawn

sobj_ZombieSpawn.cpp

add

Code:
#include "../sobj_Animals.h"

find

Code:
extern float _zai_MaxSpawnDelay;
    if(zombieSpawnDelay > _zai_MaxSpawnDelay)
        zombieSpawnDelay = _zai_MaxSpawnDelay;


    GenerateNavPoints();

add

Code:
r3dPoint3D curpos = GetPosition();
        r3dPoint3D pos;
        if (GetFreeNavPointIdx(&pos,true,500,&curpos) != -1)
        {
            obj_Animals* obj =     (obj_Animals*)srv_CreateGameObject("obj_Animals", "obj_Animals", pos);
            obj->SetNetworkID(gServerLogic.GetFreeNetId());
            obj->NetworkLocal = true;
            obj->z = this;
            obj->OnCreate();
        }

Error 2 error C2601: 'ClientGameLogic::OnPKT_S2C_CreateAnimals' : local function definitions are illegal c:\WarZ\src\EclipseStudio\Sources\multiplayer\ClientGameLogic.cpp 953 Eclipse Studio
and another one in obj_animals

Search F: IMPL_PACKET_FUNC(ClientGameLogic, PKT_S2C_CheatWarning)
Code:
[COLOR=#b22222]IMPL_PACKET_FUNC(ClientGameLogic, PKT_S2C_CreateAnimals){
    r3dOutToLog("obj_Animals %d\n", n.spawnID);
    r3d_assert(GameWorld().GetNetworkObject(n.spawnID) == NULL);
    obj_Animals* obj = (obj_Animals*)srv_CreateGameObject("obj_Animals", "Data\\ObjectsDepot\\WZ_Animals\\char_deer_01.sco", n.spawnPos);
[/COLOR][COLOR=#006400]//[/COLOR][COLOR=#b22222]obj->SetNetworkID(n.spawnID);
[/COLOR][COLOR=#006400]//[/COLOR][COLOR=#b22222]obj->NetworkLocal = false;
    [/COLOR][COLOR=#006400]//[/COLOR][COLOR=#b22222]memcpy(&obj->CreateParams, &n, sizeof(n));
    obj->OnCreate();
}[/COLOR]

Error 1 error C3861: 'UpdateAnimalsObstacle': identifier not found c:\WarZ\src\EclipseStudio\Sources\ObjectsCode\Gameplay\obj_Animals.cpp 315 Eclipse Studio
Search F:
Code:
[B][COLOR=#b22222][I]UpdateAnimalsObstacle[/I][/COLOR][COLOR=#333333][I] to [/I][/COLOR][COLOR=#008000][I]//[/I][/COLOR][/B]

Help?

Erro 1 error LNK2001: unresolved external symbol "public: void __thiscall obj_Animals::ApplyDamage(float,class GameObject *)" (?ApplyDamage@obj_Animals@@QAEXMPAVGameObject@@@Z) c:\WarZ\bin\server\WO_GameServer\obj_ServerPlayer.obj 1 WarZ Game Server
Erro 2 fatal error LNK1120: 1 unresolved externals C:\WarZ\bin\server\Release\WZ_GameServer.exe WarZ Game Server

add to this

9D4DtdQ - [Release] Animal System - RaGEZONE Forums


Source files





 

Attachments

You must be registered for see attachments list
Last edited:
Harro
Joined
Mar 29, 2013
Messages
754
Reaction score
284
Awesome thank for you sharing this great release again :D
 
Master Summoner
Joined
Mar 30, 2013
Messages
543
Reaction score
72
One question, are you going to release rent a server system?
 
Harro
Joined
Mar 29, 2013
Messages
754
Reaction score
284
Its cause you didn't add the files he provided properly -> Add existing item.
 
Newbie Spellweaver
Joined
Apr 13, 2013
Messages
54
Reaction score
109
remove it

Code:
if (plr->profile_.ProfileData.isPremium && gServerLogic.ginfo_.ispre)
            {
                plr->loadout_->Stats.XP += 500;
                xp = 500;
            }
            else
 
Experienced Elementalist
Joined
Oct 23, 2013
Messages
289
Reaction score
29
thank you this is very awesome!
Well now we just have to get terrain 3 and emulators will be better than the original Infestation! (ok they are already better :p)
Good job asomin!
 
f793
Joined
May 5, 2013
Messages
827
Reaction score
160
thank you this is very awesome!
Well now we just have to get terrain 3 and emulators will be better than the original Infestation! (ok they are already better :p)
Good job asomin!

They are already better, look at DeadZ :)
 
Newbie Spellweaver
Joined
Feb 26, 2014
Messages
6
Reaction score
0
1>c:\warz\src\eclipsestudio\sources\objectscode\gameplay\obj_Animals.h(43) : error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
1>c:\warz\src\eclipsestudio\sources\objectscode\gameplay\obj_Animals.h(43) : error C2143: syntax error : missing ',' before '&'
1>.\Sources\ObjectsCode\Gameplay\obj_Animals.cpp(315) : error C3861: 'UpdateAnimalsObstacle': identifier not found
1>.\Sources\ObjectsCode\Gameplay\obj_Animals.cpp(632) : error C2065: 'PKT_S2C_AnimalsMove' : undeclared identifier
1>.\Sources\ObjectsCode\Gameplay\obj_Animals.cpp(632) : error C2051: case expression not constant
1>.\Sources\ObjectsCode\Gameplay\obj_Animals.cpp(632) : error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
1>.\Sources\ObjectsCode\Gameplay\obj_Animals.cpp(632) : error C2143: syntax error : missing ';' before '&'
1>.\Sources\ObjectsCode\Gameplay\obj_Animals.cpp(632) : error C2065: 'n' : undeclared identifier
1>.\Sources\ObjectsCode\Gameplay\obj_Animals.cpp(632) : error C2059: syntax error : ')'
1>.\Sources\ObjectsCode\Gameplay\obj_Animals.cpp(632) : error C2065: 'n' : undeclared identifier
1>.\Sources\ObjectsCode\Gameplay\obj_Animals.cpp(632) : error C2070: ''unknown-type'': illegal sizeof operand
1>.\Sources\ObjectsCode\Gameplay\obj_Animals.cpp(632) : error C2065: 'n' : undeclared identifier
1>.\Sources\ObjectsCode\Gameplay\obj_Animals.cpp(637) : error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
1>.\Sources\ObjectsCode\Gameplay\obj_Animals.cpp(637) : error C2143: syntax error : missing ',' before '&'
1>.\Sources\ObjectsCode\Gameplay\obj_Animals.cpp(639) : error C2065: 'n' : undeclared identifier
1>.\Sources\ObjectsCode\Gameplay\obj_Animals.cpp(639) : error C2228: left of '.pos' must have class/struct/union
1> type is ''unknown-type''
1>.\Sources\ObjectsCode\Gameplay\obj_Animals.cpp(641) : error C2065: 'n' : undeclared identifier
1>.\Sources\ObjectsCode\Gameplay\obj_Animals.cpp(641) : error C2228: left of '.angle' must have class/struct/union
1> type is ''unknown-type''
1>.\Sources\ObjectsCode\Gameplay\obj_Animals.cpp(642) : error C2065: 'n' : undeclared identifier
1>.\Sources\ObjectsCode\Gameplay\obj_Animals.cpp(642) : error C2228: left of '.state' must have class/struct/union
1> type is ''unknown-type''
1>.\Sources\ObjectsCode\Gameplay\obj_Animals.cpp(645) : error C2065: 'n' : undeclared identifier
1>.\Sources\ObjectsCode\Gameplay\obj_Animals.cpp(645) : error C2228: left of '.state' must have class/struct/union
1> type is ''unknown-type''
1>HeroConfig.cpp
1>c:\WarZ\src\EclipseStudio\Sources\ObjectsCode/Gameplay/obj_Animals.h(43) : error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
1>c:\WarZ\src\EclipseStudio\Sources\ObjectsCode/Gameplay/obj_Animals.h(43) : error C2143: syntax error : missing ',' before '&'
 
Experienced Elementalist
Joined
Oct 12, 2013
Messages
217
Reaction score
68
On my server the deer are very lagged, they don't run anywhere and you cant kill them. Any ideas ?
 
Status
Not open for further replies.
Back
Top