Post tutorial RSS How to add random weapons and names to AI Single Player

This will show you how to add random Weapons and Names to AI in Single Player

Posted by on - Basic Mapping/Technical

// This is how to add a an AI Random Weapon Script
thread random_weapon( ai, weapon1, weapon2, weapon3, weapon4, weapon5 );
random_weapon( ai, weapon1, weapon2, weapon3, weapon4, weapon5 )
{
weapon = randomint (5);
if (weapon = 1)
{
thread ai_addweapon( ai, weapon1 );
}
else if (weapon = 2)
{
thread ai_addweapon( ai, weapon2 );
}
else if (weapon = 3)
{
thread ai_addweapon( ai, weapon3 );
}
else if (weapon = 4)
{
thread ai_addweapon( ai, weapon4 );
}
else if (weapon = 5)
{
thread ai_addweapon( ai, weapon5 );
}
}

ai_addweapon( ai, weapon1 )
{
ai animscripts\init::initWeapon( weapon1, "primary" );
ai animscripts\shared::placeWeaponOn( weapon1, "right" );
ai.primaryweapon = ai.weapon;
ai.lastweapon = ai.weapon;
}

ai_addweapon( ai, weapon2 )
{
ai animscripts\init::initWeapon( weapon2, "primary" );
ai animscripts\shared::placeWeaponOn( weapon2, "right" );
ai.primaryweapon = ai.weapon;
ai.lastweapon = ai.weapon;
}

ai_addweapon( ai, weapon3 )
{
ai animscripts\init::initWeapon( weapon3, "primary" );
ai animscripts\shared::placeWeaponOn( weapon3, "right" );
ai.primaryweapon = ai.weapon; ai.lastweapon = ai.weapon;
}

ai_addweapon( ai, weapon4 )
{
ai animscripts\init::initWeapon( weapon4, "primary" );
ai animscripts\shared::placeWeaponOn( weapon4, "right" );
ai.primaryweapon = ai.weapon;
ai.lastweapon = ai.weapon;
}

ai_addweapon( ai, weapon5 )
{
ai animscripts\init::initWeapon( weapon5, "primary" );
ai animscripts\shared::placeWeaponOn( weapon5, "right" );
ai.primaryweapon = ai.weapon;
ai.lastweapon = ai.weapon;
}

// E.G. thread random_weapon( level.price, "m4_grunt", "m4_silencer", "m4_grenadier", "ak74u", "ak47" );
// Also here is a script for random names without the Pvt. or Cpl. or Sgt.
thread random_name( ai );
random_name( ai )
{
name = randomint (5);
if (name = 1)
{
ai.name = "name1";
}
else if (name = 2)
{
ai.name = "name2";
}
else if (name = 3)
{
ai.name = "name3";
}
else if (name = 4)
{
ai.name = "name4";
}
else if (name = 5)
{
ai.name = "name5";
}
}

Post a comment
Sign in or join with:

Only registered members can share their thoughts. So come on! Join the community today (totally free - or sign in with your social account on the right) and join in the conversation.