|
|
|
Re: Commands->Select_Weapon doesn't work clientside. [message #487303 is a reply to message #487279] |
Mon, 21 April 2014 17:18 |
|
danpaul88
Messages: 5795 Registered: June 2004 Location: England
Karma: 0
|
General (5 Stars) |
|
|
That is a bit odd, perhaps post the code you're using? For reference, all of the following work in 4.0 and 4.1;
Commands->Select_Weapon ( obj, Get_Powerup_Weapon ( Get_Parameter( "veteran_weaponPowerup" ) ) );
Commands->Select_Weapon ( obj, "Weapon_IFV_None" );
// Set the supercharged state
void dp88_AR_Tesla_Coil::setSuperchargedState(GameObject* obj, bool state)
{
if ( !m_superchargedWeapon.Is_Empty() )
{
// If we are setting supercharged to true then switch weapons
if ( state )
{
Commands->Select_Weapon(obj, m_superchargedWeapon);
primary_maxRange = m_superchargedWeaponRange;
}
else
{
Commands->Select_Weapon(obj, m_defaultWeapon);
primary_maxRange = m_defaultWeaponRange;
}
m_isSupercharged = state;
}
}
[Updated on: Mon, 21 April 2014 17:19] Report message to a moderator
|
|
|
|
Re: Commands->Select_Weapon doesn't work clientside. [message #487363 is a reply to message #487279] |
Fri, 25 April 2014 02:58 |
|
danpaul88
Messages: 5795 Registered: June 2004 Location: England
Karma: 0
|
General (5 Stars) |
|
|
Passing an empty string to Select_Weapon makes them select the first weapon in their weapon bag. If they only have one weapon or the sniper rifle is their primary weapon (index 0) then your code is not causing a weapon switch and thus will not trigger switching time.
void WeaponBagClass::Deselect()
{
this->Select_Index (0);
}
0 is a valid weapon index, thus they select the weapon at position 0.
[Updated on: Fri, 25 April 2014 03:01] Report message to a moderator
|
|
|
Re: Commands->Select_Weapon doesn't work clientside. [message #487367 is a reply to message #487363] |
Fri, 25 April 2014 10:13 |
|
Jerad2142
Messages: 3813 Registered: July 2006 Location: USA
Karma: 6
|
General (3 Stars) |
|
|
danpaul88 wrote on Fri, 25 April 2014 03:58 | Passing an empty string to Select_Weapon makes them select the first weapon in their weapon bag. If they only have one weapon or the sniper rifle is their primary weapon (index 0) then your code is not causing a weapon switch and thus will not trigger switching time.
void WeaponBagClass::Deselect()
{
this->Select_Index (0);
}
0 is a valid weapon index, thus they select the weapon at position 0.
|
Calling it by itself does indeed work, however that doesn't leave them holding the original weapon.
Calling this:
const char *weap = Get_Current_Weapon(obj);
if (weap)
{
Commands->Select_Weapon(obj,"");
Commands->Select_Weapon (obj,weap);
}
Works in both 3.4.4, and 4.1 single player LAN, it only doesn't work in 4.1 when on-line (as a client to the server).
Visit Jerad's deer sweat shop
[Updated on: Fri, 25 April 2014 10:38] Report message to a moderator
|
|
|
Re: Commands->Select_Weapon doesn't work clientside. [message #487370 is a reply to message #487279] |
Fri, 25 April 2014 16:09 |
|
The script M00_Select_Empty_Hands does this
Commands->Select_Weapon(obj,0);
Passing 0 to Select_Weapon will cause WeaponBagClass::Deselect to be called. I should point out that index 0 in a WeaponBagClass is always empty (i.e. "No weapon") because of the code in the WeaponBagClass constructor.
Try passing 0 instead of "" and see what happens. (although from a reading of the code for WeaponBagClass::Select_Weapon_Name it may not make much difference)
Also you could try calling Select_Weapon once, then Send_Object_Update (from engine_tt.cpp) on the object then Select_Weapon another time. Although I dont know how it would work...
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: Commands->Select_Weapon doesn't work clientside. [message #487453 is a reply to message #487450] |
Thu, 01 May 2014 09:53 |
|
Jerad2142
Messages: 3813 Registered: July 2006 Location: USA
Karma: 6
|
General (3 Stars) |
|
|
danpaul88 wrote on Thu, 01 May 2014 10:05 | Why not just select weapon index 0 (empty hands) until they stop running? Then you only get the switch animation when they stop and it re-selects their weapon (plus you get some free post-running cooldown before shooting is allowed for free this way!)
|
Oh its only sniper rifles I was disabling, I'm fine with other weapons, sniper rifle you can walk slowly with, and n00b jet you have to remain stationary.
I'm just not a fan of people back peddling away from bears that only have melee for attack and firing the n00bjet through multiple bears as they do, have to make sure some skill is required.
Visit Jerad's deer sweat shop
|
|
|