Renegade Public Forums
C&C: Renegade --> Dying since 2003™, resurrected in 2024!
Home » Tiberian Technologies / Blackhand Studios » Tiberian Technologies Forum » Weapon Grant + Removal Bug
Re: Weapon Grant + Removal Bug [message #456027 is a reply to message #454842] Sun, 25 September 2011 17:46 Go to previous messageGo to previous message
Gen_Blacky is currently offline  Gen_Blacky
Messages: 3250
Registered: September 2006
Karma:
General (3 Stars)
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.
  • Attachment: test2.jpg
    (Size: 386.40KB, Downloaded 111 times)


http://s18.postimage.org/jc6qbn4k9/bricks3.png

[Updated on: Sun, 25 September 2011 18:16]

Report message to a moderator

 
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: TTFS folder?
Next Topic: Missing Textures ingame, which are present in LE
Goto Forum:
  


Current Time: Fri Dec 20 17:03:13 MST 2024

Total time taken to generate the page: 0.00808 seconds