Originally Posted by
1337Smithy
I quickly tested my code and it worked for me so you must not be testing properly. I feel like I'm repeating myself. What did I say about braces? What did I say about the redundant switch? And here you removed the switch and braces but left the cases for some reason so it makes things extra redundant. Go back and re read all my comments as I'm not going to go round in circles lol.
Appologies my friend im fairly new to this coding and stilll learning heres how i called for your code
main:
thread spring
end
spring:
if (!self || self.dmteam == "spectator" || self.mef_spectator == 1) {
end
}
if (self.raising == 1) {
end
}
self.raising = 1
local.weaponName = "weapon" + self.entnum
self weaponcommand mainhand targetname (local.weaponName)
local.weapon = $(local.weaponName)
if (local.weapon){
local.weapon.targetname = ""
switch (local.weapon.model) {
case "models/weapons/bazooka.tik":
case "models/weapons/colt45.tik":
case "models/weapons/m2frag_grenade.tik":
case "models/weapons/RDG-1_Smoke_grenade.tik":
self take "models/weapons/bazooka.tik"
self take "models/weapons/colt45.tik"
self take "models/weapons/m2frag_grenade.tik"
self take "models/items/binoculars.tik"
self take "models/weapons/RDG-1_Smoke_grenade.tik"
self give "models/weapons/springfield.tik"
waitframe
self useweaponclass rifle
}
}
self.raising = 0
end
//==============================================================================
//==============================================================================
//
// RAISE_WEAPON
//
//==============================================================================
state RAISE_WEAPON
{
movetype legs
entrycommands
{
viewmodelanim pullout
// just to make sure nothing funky's
// attached that shouldn't be.
correctweaponattachments
}
states
{
RAISE_KAR98_FOR_M1 : IS_NEW_WEAPON "mainhand" "M1 Garand"
RAISE_MOSIN_FOR_SPRING : IS_NEW_WEAPON "mainhand" "Springfield '03 Sniper" //| This Mosin is causing the bazooka to pull up the Mosin as well
RAISE_ENFIELD_FOR_THOMP : IS_NEW_WEAPON "mainhand" "Thompson"
RAISE_KSNIPER_FOR_BAR : IS_NEW_WEAPON "mainhand" "BAR"
RAISE_SPRING_FOR_BAZOOKA : IS_NEW_WEAPON "mainhand" "Bazooka" //|New raise added here
RAISE_KAR98_FOR_SHOTGUN : IS_NEW_WEAPON "mainhand" "Shotgun"
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_REAL"
}
// states
// {
// STAND_REAL : default
// }
}
state RAISE_SPRING_FOR_BAZOOKA
{
movetype legs
entrycommands
{
exec global/weapScr/bazooka.scr //|exec here
}
states
{
STAND : !NEW_WEAPON
}
}
if this is the incorrect way to use it please help to understand how