Thought I would go ahead and post anyways.
Same thing happens with B_Clear_Weapons as Commands->Clear_Weapons.
In the screen shot the player had their weapons removed and was given a auto rifle and pistol. I was never given the pistol and I can't see anything in the weapon list after it disappears like halo2pac said.
void Soldier::Created(GameObject *obj)
{
if (Commands->Is_A_Star(obj))
{
B_Clear_Weapons(obj);
Commands->Give_PowerUp(obj, "POW_Pistol_Player", false);
Commands->Select_Weapon(obj, "Weapon_Pistol_Player");
}
}
void Soldier::Killed(GameObject *obj,GameObject *killer)
{
if (Commands->Is_A_Star(killer))
{
if ( temp == 0 )
{
B_Clear_Weapons(killer);
Commands->Give_PowerUp(killer, "POW_AutoRifle_Player", false);
Commands->Give_PowerUp(obj, "POW_Pistol_Player", false);
Commands->Give_PowerUp(killer, "CnC_POW_Ammo_ClipMax", false);
Commands->Select_Weapon(killer, "POW_Pistol_Player");
temp = 1;
}
else
{
B_Clear_Weapons(killer);
Commands->Give_PowerUp(killer, "POW_AutoRifle_Player", false);
Commands->Select_Weapon(killer, "POW_AutoRifle_Player");
temp = 0;
}
}
}
void B_Clear_Weapons(GameObject *obj) // Weapon Removal Test
{
if (!obj || !Commands->Get_ID(obj))
{
return;
}
PhysicalGameObj *o2 = ((ScriptableGameObj *)obj)->As_PhysicalGameObj();
if (!o2)
{
return;
}
ArmedGameObj *o3 = o2->As_ArmedGameObj();
if (!o3)
{
return;
}
WeaponBagClass *w = o3->Get_Weapon_Bag();
int x = w->Get_Count();
for (int i = 0;i < x;i++)
{
if (w->Peek_Weapon(i))
{
//w->Remove_Weapon(i);
Remove_Weapon( obj, w->Peek_Weapon(i)->Get_Name() );
}
}
}
Edit:
Commands->Give_PowerUp doesn't work after the players weapons have been cleared and granted one power up. The player has to be destroyed first.
[Updated on: Sun, 25 September 2011 18:16]
Report message to a moderator