[Tutorial] PVE Mode

Junior Spellweaver
Joined
Mar 31, 2013
Messages
140
Reaction score
94
First, the credits are going to iKasu and D3VCOR3
  1. Open up warz_server.sln and search for
  2. PHP:
    bool ServerGameLogic::ApplyDamageToPlayer
  3. You will see a code like that:
  4. PHP:
    bool ServerGameLogic::ApplyDamageToPlayer(GameObject* fromObj, obj_ServerPlayer* targetPlr, const r3dPoint3D& dmgPos, float damage, int bodyBone, int bodyPart, bool force_damage, STORE_CATEGORIES damageSource, int airState )
    {
        r3d_assert(fromObj);
        r3d_assert(targetPlr);
        if(targetPlr->loadout_->Alive == 0)
            return false;
            
        // can't damage players in safe zones (postbox now act like that)
        if(((targetPlr->loadout_->GameFlags & wiCharDataFull::GAMEFLAG_NearPostBox) || (targetPlr->loadout_->GameFlags & wiCharDataFull::GAMEFLAG_SpawnProtection)) && !force_damage)
            return false;
  5. After that "if" add this code
    PHP:
        if(targetPlr->loadout_->GameMapId == GBGameInfo::MAPID_WZ_Colorado)
            return false;
So, in this map player's don't will receive damage
P.S: In InvassionMMO source already have this code, i only changed the code from a != to a ==, for in the following map players don't receive damage
 
would look like this?

Code:
[COLOR=#000000][COLOR=#007700]if([/COLOR][COLOR=#0000BB]targetPlr[/COLOR][COLOR=#007700]->[/COLOR][COLOR=#0000BB]loadout_[/COLOR][COLOR=#007700]->[/COLOR][COLOR=#0000BB]GameMapId [/COLOR][COLOR=#007700]== [/COLOR][COLOR=#0000BB]GBGameInfo[/COLOR][COLOR=#007700]::[/COLOR][COLOR=#0000BB]MAPID_WZ_Colorado[/COLOR][COLOR=#007700] && [/COLOR][/COLOR]fromObj->isObjType(OBJTYPE_Human)[COLOR=#000000][COLOR=#007700]) [/COLOR][/COLOR]
        return false;
 
would look like this?

Code:
[COLOR=#000000][COLOR=#007700]if([/COLOR][COLOR=#0000BB]targetPlr[/COLOR][COLOR=#007700]->[/COLOR][COLOR=#0000BB]loadout_[/COLOR][COLOR=#007700]->[/COLOR][COLOR=#0000BB]GameMapId [/COLOR][COLOR=#007700]== [/COLOR][COLOR=#0000BB]GBGameInfo[/COLOR][COLOR=#007700]::[/COLOR][COLOR=#0000BB]MAPID_WZ_Colorado[/COLOR][COLOR=#007700] && [/COLOR][/COLOR]fromObj->isObjType(OBJTYPE_Human)[COLOR=#000000][COLOR=#007700]) [/COLOR][/COLOR]
        return false;

it will be lke this if you don't want to take damage from zombies, in te original code you only don't will take damage from a player
 
final code ??

LoL
Example
Code:
[COLOR=#007700]if([/COLOR][COLOR=#0000BB]targetPlr[/COLOR][COLOR=#007700]->[/COLOR][COLOR=#0000BB]loadout_[/COLOR][COLOR=#007700]->[/COLOR][COLOR=#0000BB]GameMapId [/COLOR][COLOR=#007700]== [/COLOR][COLOR=#0000BB]GBGameInfo[/COLOR][COLOR=#007700]::[/COLOR][COLOR=#0000BB]MAPID_WZ_Colorado[/COLOR][COLOR=#007700])
        return [/COLOR][COLOR=#0000BB]false[/COLOR][COLOR=#007700];
 
to

if([COLOR=#0000BB]targetPlr[/COLOR]->[COLOR=#0000BB]loadout_[/COLOR]->[COLOR=#0000BB]GameMapId [/COLOR]== [COLOR=#0000BB]GBGameInfo[/COLOR]::[COLOR=#0000BB]MAPID_ServerTest[/COLOR])
        return [COLOR=#0000BB]false[/COLOR];
[/COLOR]
 
Back