Weapon Grant + Removal Bug [message #454842] |
Fri, 16 September 2011 17:53 |
|
halo2pac
Messages: 659 Registered: December 2006 Location: Near Cleveland, Ohio
Karma: 0
|
Colonel |
|
|
This is part of the first set of many bugs I have found I would like to report.
Take code such as:
Commands->Give_PowerUp(Killer, "POW_Pistol_Player", false);
Commands->Give_PowerUp(Killer, "CnC_POW_Ammo_ClipMax", false);
Commands->Select_Weapon(Killer, "Weapon_Pistol_Player");
then later on do this:
Commands->Give_PowerUp(Killer, "POW_AutoRifle_Player", false);
Commands->Give_PowerUp(Killer, "CnC_POW_Ammo_ClipMax", false);
Commands->Select_Weapon(Killer, "Weapon_AutoRifle_Player");
Create_2D_WAV_Sound_Player(Killer, "m00pwar_aqob0004i1evag_snd.wav");
The icon for the gun in the bottom right, stays a pistol.. and then you CANNOT access any weapon, or c4 via the 1234567890 keys.
(you normally can even with 1 weapon.)
Rene-Buddy | Renegade X
Join the fight against Obsessive-Compulsive Posting Disorder. Cancel is ur friend.
*Renegade X Dev Team Member*
|
|
|
Re: Weapon Grant + Removal Bug [message #455411 is a reply to message #454842] |
Tue, 20 September 2011 19:31 |
|
Can I get some more information on this please?
Jonathan Wilson aka Jonwil
Creator and Lead Coder of the Custom scripts.dll
Renegade Engine Guru
Creator and Lead Coder of TT.DLL
Official member of Tiberian Technologies
|
|
|
Re: Weapon Grant + Removal Bug [message #455577 is a reply to message #455411] |
Wed, 21 September 2011 19:18 |
|
halo2pac
Messages: 659 Registered: December 2006 Location: Near Cleveland, Ohio
Karma: 0
|
Colonel |
|
|
Ok lets say I attach a script to a player. The script hooks the on kill event.
I place this code in the on join event:
Commands->Clear_Weapons(PLayerOBject);
Commands->Give_PowerUp(PLayerOBject, "POW_Pistol_Player", false);
Commands->Give_PowerUp(PLayerOBject, "CnC_POW_Ammo_ClipMax", false);
Commands->Select_Weapon(PLayerOBject, "Weapon_Pistol_Player");
and on the on kill event:
this code (or simular)
Commands->Clear_Weapons(Killer);
Commands->Give_PowerUp(Killer, "POW_AutoRifle_Player", false);
Commands->Give_PowerUp(Killer, "CnC_POW_Ammo_ClipMax", false);
Commands->Select_Weapon(Killer, "Weapon_AutoRifle_Player");
Create_2D_WAV_Sound_Player(Killer, "m00pwar_aqob0004i1evag_snd.wav");
The Pistol and the C4 Do not clear.
Half the time you cannot select ANY weapon from your inventory.
!00% of the time the Icon.. the one that tells you what gun you have selected (via bottom right of your screen) Stays the last weapon you had before that code above.
Rene-Buddy | Renegade X
Join the fight against Obsessive-Compulsive Posting Disorder. Cancel is ur friend.
*Renegade X Dev Team Member*
[Updated on: Wed, 21 September 2011 19:18] Report message to a moderator
|
|
|
Re: Weapon Grant + Removal Bug [message #455582 is a reply to message #454842] |
Wed, 21 September 2011 20:15 |
|
Which scripts version are the clients in this situation running?
Some of the logic behind Clear_Weapons, Select_Weapon and stuff will only function correctly if the client has a recent enough scripts build (4.0 will work, 3.4.4 may work, not sure about anything < 3.4.4)
Jonathan Wilson aka Jonwil
Creator and Lead Coder of the Custom scripts.dll
Renegade Engine Guru
Creator and Lead Coder of TT.DLL
Official member of Tiberian Technologies
|
|
|
|
Re: Weapon Grant + Removal Bug [message #455687 is a reply to message #454842] |
Thu, 22 September 2011 20:13 |
|
Can you paste the complete code for this script and not just the fragments you have pasted so far?
Jonathan Wilson aka Jonwil
Creator and Lead Coder of the Custom scripts.dll
Renegade Engine Guru
Creator and Lead Coder of TT.DLL
Official member of Tiberian Technologies
|
|
|
|
|
Re: Weapon Grant + Removal Bug [message #456027 is a reply to message #454842] |
Sun, 25 September 2011 17:46 |
|
Gen_Blacky
Messages: 3250 Registered: September 2006
Karma: 1
|
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 107 times)
[Updated on: Sun, 25 September 2011 18:16] Report message to a moderator
|
|
|
|
Re: Weapon Grant + Removal Bug [message #456113 is a reply to message #454842] |
Mon, 26 September 2011 20:49 |
|
For the problem where removing a weapon (or all weapons) and then adding weapons causes failures on the client, try having a timer with a very small tick between the "remove weapon" and "add weapon" commands. This will cause the netcode to sync up to the "remove weapon" commands and then to the "add weapon" commands properly.
Jonathan Wilson aka Jonwil
Creator and Lead Coder of the Custom scripts.dll
Renegade Engine Guru
Creator and Lead Coder of TT.DLL
Official member of Tiberian Technologies
|
|
|
|