Jump to content
Sign in to follow this  
tracy_t

Zombie addon source code for you...

Recommended Posts

Dear all,

as promised:

Zombies in OFP. Copy both config.cpp and initzombie.sqs to a directory called ScottsAddon. Use MakePbo or StuffPbo to compile the directory into a Pbo file (which must also be called ScottsAddon.)

Yes, scott is my first name, lol!

Please, if you use this code, credit me, Scott "Tracy" T (and D. Murphy Man, who's original zombie code I nicked originally)!

I realise it may not be the done thing to release code on this forum, but I hope this code can help budding addon makers (and zombie fans.)

Note: This is a work in progress, and I will be updating the code as I go along. I will replace hard-coded values with the #defines in due course - don't panic, I'm a C++ programmer by trade, lol  (Visual C++ 6 IDE rules for creating config.cpp files.)

Any questions? Feel free to PM me.

Config.cpp:

<table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">

#define TEast 0

#define TWest 1

#define TGuerrila 2

#define TCivilian 3

#define TSideUnknown 4

#define TEnemy 5

#define TFriendly 6

#define TLogic 7

#define true 1

#define false 0

// type scope

#define private 0

#define protected 1

#define public 2

class CfgPatches

{

       class ScottT_Zombies

       {

       units[]={Zombie, Zombie2, Zombie3, Zombie4, Zombie5, Zombie6, Zombie7, ZombieWoman1,ZombieWoman2,ZombieWoman3, ZombieWoman4, ZombieWoman5};

       requiredversion=1.750000;

       };

};

class CfgVehicles

{

class All {};

class AllVehicles: All {};

class Land: AllVehicles{};

class Man: Land{};

   class Civilian: Man{};

   class Civilian1: Civilian {};

class Civilian2: Civilian {};

class Civilian3: Civilian {};

class Civilian4: Civilian {};

class Civilian5: Civilian {};

class Civilian6: Civilian {};

class Civilian7: Civilian {};

class Civilian8: Civilian {};

class Civilian9: Civilian {};

class Civilian10: Civilian {};

class Civilian11: Civilian {};

class Woman1: Civilian{};

class Woman2: Civilian{};

class Woman3: Civilian{};

class Woman4: Civilian{};

class Woman5: Civilian{};

class Zombie: Civilian

{

       side=0;

armor=100;

armorhead=0.2;

armorbody=500.0;

armorhands=500.0;

armorlegs=500.0;

       scope=2;

glasses="None";

displayName="Zombie";

       class eventhandlers

   {

           init = [_this select 0] exec {\scottsaddon\initzombie.sqs};

           

   };

};

class Zombie1: Civilian1

{

armor=100;

armorhead=0.2;

armorbody=500.0;

armorhands=500.0;

armorlegs=500.0;

       scope=2;

glasses="None";

displayName="Zombie 1";

side=0;

       class eventhandlers

   {

           init = [_this select 0] exec {\scottsaddon\initzombie.sqs};

   };

};

class Zombie2: Civilian2

{

armor=100;

armorhead=0.2;

armorbody=500.0;

armorhands=500.0;

armorlegs=500.0;

       scope=2;

glasses="None";

side=0;

displayName="Zombie 2";

       class eventhandlers

   {

           init = [_this select 0] exec {\scottsaddon\initzombie.sqs};

   };    

   };

class Zombie3: Civilian3

{

armor=100;

armorhead=0.2;

armorbody=500.0;

armorhands=500.0;

armorlegs=500.0;

       scope=2;

side=0;

glasses="None";

displayName="Zombie 3";

       class eventhandlers

   {

           init = [_this select 0] exec {\scottsaddon\initzombie.sqs};

   };

   };

class Zombie4: Civilian4

{

armor=100;

armorHead=0.2;

armorbody=500.0;

armorhands=500.0;

armorlegs=500.0;

       scope=2;

glasses="None";

side=0;

displayName="Zombie 4";

       class eventhandlers

   {

           init = [_this select 0] exec {\scottsaddon\initzombie.sqs};

   };

   };

class Zombie5: Civilian5

{

armor=100;

armorhead=0.2;

armorbody=500.0;

armorhands=500.0;

armorlegs=500.0;

       scope=2;

glasses="None";

side=0;

displayName="Zombie 5";

       class eventhandlers

   {

           init = [_this select 0] exec {\scottsaddon\initzombie.sqs};

   };

   };

class Zombie6: Civilian6

{

armor=100;

armorhead=0.2;

armorbody=500.0;

armorhands=500.0;

armorlegs=500.0;

       scope=2;

glasses="None";

side=0;

displayName="Zombie 6";

       class eventhandlers

   {

           init = [_this select 0] exec {\scottsaddon\initzombie.sqs};

   };

   };

class Zombie7: Civilian7

{

armor=100;

armorhead=0.2;

armorbody=500.0;

armorhands=500.0;

armorlegs=500.0;

       scope=2;

       glasses = "None";

       side=0;

   displayName="Zombie 7";

       

       class eventhandlers

   {

           init = [_this select 0] exec {\scottsaddon\initzombie.sqs};

   };

   };

class ZombieWoman1: Woman1

{

armor=100;

armorhead=0.2;

armorbody=500.0;

armorhands=500.0;

armorlegs=500.0;

       scope=2;

       side=0;

       displayName="Zombie Woman 1";

       class eventhandlers

   {

           init = [_this select 0] exec {\scottsaddon\initzombie.sqs};

   };

};

class ZombieWoman2: Woman2

{

armor=100;

armorhead=0.2;

armorbody=500.0;

armorhands=500.0;

armorlegs=500.0;

       scope=2;

   side=0;

   displayName="Zombie Woman 2";

       class eventhandlers

   {

           init = [_this select 0] exec {\scottsaddon\initzombie.sqs};

   };

   };

class ZombieWoman3: Woman3

{

armor=100;

armorhead=0.2;

armorbody=500.0;

armorhands=500.0;

armorlegs=500.0;

       scope=2;

   side=0;

   displayName="Zombie Woman 3";

       class eventhandlers

   {

           init = [_this select 0] exec {\scottsaddon\initzombie.sqs};

   };

   };

class ZombieWoman4: Woman4

{

armor=100;

armorhead=0.2;

armorbody=500.0;

armorhands=500.0;

armorlegs=500.0;

       scope=2;

   side=0;

   displayName="Zombie Woman 4";

       class eventhandlers

   {

           init = [_this select 0] exec {\scottsaddon\initzombie.sqs};

   };

   };

class ZombieWoman5: Woman5

{

armor=100;

armorhead=0.2;

armorbody=500.0;

armorhands=500.0;

armorlegs=500.0;

   scope=2;

       side=0;

       displayName="Zombie Woman 5";

       class eventhandlers

   {

           init = [_this select 0] exec {\scottsaddon\initzombie.sqs};

   };

};

};

class CfgGroups

{

  class East

  {

     name="East"

     class Scott_T_Zombies

     {

        name="Zombies";

        class ZombieGroup

        {

           name="Group of zombies";

class Unit0{name="1";side=0;vehicle="Zombie1";rank="Lieutnant";position[]={0,0,0};};

class Unit1{name="2";side=0;vehicle="Zombie2";rank="Sergeant";position[]={-8,-3,0};};

class Unit2{name="3";side=0;vehicle="Zombie3";rank="Sergeant";position[]={-6,-3,0};};

class Unit3{name="4";side=0;vehicle="Zombie4";rank="Corporal";position[]={-4,-3,0};};

class Unit4{name="5";side=0;vehicle="Zombie5";rank="Corporal";position[]={-2,-3,0};};

class Unit5{name="6";side=0;vehicle="ZombieWoman1";rank="Corporal";position[]={0,-3,0};};

class Unit6{name="7";side=0;vehicle="Zombie6";rank="Private";position[]={2,-3,0};};

class Unit7{name="8";side=0;vehicle="ZombieWoman2";rank="Private";position[]={4,-3,0};};

        class Unit8{name="9";side=0;vehicle="Zombie7";rank="Private";position[]={6,-3,0};};

};

     };

   };

};

Initzombie.sqs

<table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">

_zombie = _this select 0

_zombie setdamage 0.8

_zombie SetBehaviour "CARELESS"

_zombie DisableAI "TARGET"

_zombie DisableAI "AUTOTARGET"

_zombie allowfleeing 0

_zombie SetMimic "Agresive"

exit

Share this post


Link to post
Share on other sites

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now
Sign in to follow this  

×