Inside3D tutorials.
Created By: James Layman
eMail: drywall@telefragged.com
Difficulty Scale: Easy


Step 1
In this tutorial, you will learn how to make Ogres fire nails and grenades. As always, open up your text editor. Then open up ogre.qc

Step 2
In ogre.qc, right below the void OgreFireGrenade, paste this:
/*
================
OgreFireSpike
================
*/

void() OgreFireSpike =
{
    local vector dir;
    local entity old;

    sound (self, CHAN_WEAPON, "weapons/spike2.wav", 1, ATTN_NORM);
    self.attack_finished = time + 0.2;

    dir = normalize (self.enemy.origin - self.origin);

    launch_spike (self.origin + '0 0 16', dir);

    newmis.touch = superspike_touch;
    setmodel (newmis, "progs/s_spike.mdl");

    setsize (newmis, VEC_ORIGIN, VEC_ORIGIN);
};
Well, what that was was basically a modified version of the player's firespike void. The direction was changed, and a few things were removed, like the ammo reduction.

Step 3
Below the OgreFireSpike void, put in this one. This void will randomize the ogre's choice of attack. I've weighted it twoards the nailgun, but you can change it if you like.
/*
================
=Spikes or Grenades?=
================
*/
void() ChoozAtak =
{
    local float SoG; // creates a variable number, SoG

    SoG = random (); // randomizes SoG

    if (SoG > 0.3) // 70% chance for spike
    {
        OgreFireSpike();
    }
    else
    {
        OgreFireGrenade();
    }
};


Step 4
Ok, now Scroll down to the line:
void() ogre_nail4       =[      $shoot3,                ogre_nail5      ]
{ai_face();OgreFireGrenade();};

And change it to:

void() ogre_nail4       =[      $shoot3,                ogre_nail5      ]
{ai_face();ChoozAtak();};


Step 5
Now, all you have to do is save it and compile.