I thought I'd post this for the newer people on here looking around for a good weapons trade script it works every time, with no waiting for weapons to switch. I got it from TMT site part of this is in another post on these forums but this has all the weapons set up just to make it easier for new people to use. You can also do this for the pistols, just make a new entry in torso file and a trade script.
In the mike_torso.st file add this:
Code:
// RAISE_WEAPON
//
//==============================================================================
state RAISE_WEAPON
{
movetype legs
entrycommands
{
exec player_thread.scr
viewmodelanim pullout
// just to make sure nothing funky's
// attached that shouldn't be.
correctweaponattachments
}
states
{
////////////////////// ADD THIS /////////////////////////////////////////
RAISE_THEM1 : IS_NEW_WEAPON "mainhand" "M1 Garand"
RAISE_THEMP40 : IS_NEW_WEAPON "mainhand" "MP40"
RAISE_THEThompson : IS_NEW_WEAPON "mainhand" "Thompson"
RAISE_THEBAR : IS_NEW_WEAPON "mainhand" "BAR"
RAISE_THEStG44 : IS_NEW_WEAPON "mainhand" "StG 44"
RAISE_THEBazooka : IS_NEW_WEAPON "mainhand" "Bazooka"
RAISE_THEPanzerschreck : IS_NEW_WEAPON "mainhand" "Panzerschreck"
RAISE_THEShotgun : IS_NEW_WEAPON "mainhand" "Shotgun"
/////////////////////// ABOVE HERE //////////////////////////////////////////
RAISE_PISTOL : IS_NEW_WEAPONCLASS "mainhand" "pistol"
RAISE_RIFLE : IS_NEW_WEAPONCLASS "mainhand" "rifle"
RAISE_GRENADE : IS_NEW_WEAPONCLASS "mainhand" "grenade"
RAISE_SMG : IS_NEW_WEAPONCLASS "mainhand" "smg"
RAISE_MG : IS_NEW_WEAPONCLASS "mainhand" "mg"
// RAISE_PISTOL : IS_NEW_WEAPONCLASS "mainhand" "item" // hold all items like a pistol for now
RAISE_HEAVY : IS_NEW_WEAPONCLASS "mainhand" "heavy"
RAISE_PAPERS : IS_NEW_WEAPON "mainhand" "Papers"
// RAISE_RIFLE : default
RAISE_NOANIM : default
}
}
state RAISE_NOANIM
{
entrycommands
{
// delay the activation for a frame so that the player
// spends at least one frame without a weapon, thus
// letting the legs state know that we've switched
commanddelay 0.05 activatenewweapon
commanddelay 0.05 forcetorsostate "STAND"
}
// states
// {
// STAND : default
// }
}
/////////////////////// ADD THIS ////////////////////////////////////////////////////
state RAISE_THEM1
{
movetype legs
entrycommands
{
exec mods/weapons/trade_m1.scr
}
states
{
STAND : !NEW_WEAPON
}
}
state RAISE_THEMP40
{
movetype legs
entrycommands
{
exec mods/weapons/trade_mp40.scr
}
states
{
STAND : !NEW_WEAPON
}
}
state RAISE_THEThompson
{
movetype legs
entrycommands
{
exec mods/weapons/trade_thompson.scr
}
states
{
STAND : !NEW_WEAPON
}
}
state RAISE_THEBAR
{
movetype legs
entrycommands
{
exec mods/weapons/trade_bar.scr
}
states
{
STAND : !NEW_WEAPON
}
}
state RAISE_THEStG44
{
movetype legs
entrycommands
{
exec mods/weapons/trade_stg44.scr
}
states
{
STAND : !NEW_WEAPON
}
}
state RAISE_THEBazooka
{
movetype legs
entrycommands
{
exec mods/weapons/trade_bazooka.scr
}
states
{
STAND : !NEW_WEAPON
}
}
state RAISE_THEPanzerschreck
{
movetype legs
entrycommands
{
exec mods/weapons/trade_panzerschreck.scr
}
states
{
STAND : !NEW_WEAPON
}
}
state RAISE_THEShotgun
{
movetype legs
entrycommands
{
exec mods/weapons/trade_shotgun.scr
}
states
{
STAND : !NEW_WEAPON
}
}
/////////////////////////// ABOVE HERE ///////////////////////////////////////////////////////////////
state RAISE_RIFLE
{
movetype legs
action
Change this to where you put your trade scripts:
entrycommands
{
exec mods/weapons/trade_m1.scr
}
Now make your trade scripts:
Code:
///////////////////////////// SAMPLE TRADE SCRIPT FOR M1 //////////////////////////////////////////////
main:
local.player = parm.other
local.player take "models/weapons/m1_garand.tik"
wait .1
local.player give "models/weapons/KAR98.tik"
waitframe
local.player useweaponclass rifle
local.player iprint "Your Weapon Was Changed To A Kar98"
end