R4L wrote:Wouldn't be because your script is named "reload" and your calling "reloader" in your Reload state, would it?
Oops, thats a typo. Let me correct it.
Moderator: GZDoom Developers
R4L wrote:Wouldn't be because your script is named "reload" and your calling "reloader" in your Reload state, would it?
Blue Shadow wrote:Could you post the whole code of the weapon?
ACTOR RifleMag : Ammo
{
Inventory.Amount 25
Inventory.MaxAmount 25
+IGNORESKILL
}
ACTOR ShotgunTube : Ammo
{
Inventory.Amount 8
Inventory.MaxAmount 8
+IGNORESKILL
}
ACTOR RocketMag : Ammo
{
Inventory.Amount 3
Inventory.MaxAmount 3
+IGNORESKILL
}
ACTOR RifleMode : Inventory{}
ACTOR ShotgunMode : Inventory{}
ACTOR RocketMode : Inventory{}
ACTOR OICW : Weapon
{
Tag "OICW"
Inventory.PickupMessage ""
Inventory.PickupSound ""
Weapon.SlotNumber 2
Weapon.SelectionOrder 2
+NOAUTOFIRE
States
{
Spawn:
PLAS A -1
Loop
Ready:
PLSG A 1 A_WeaponReady(WRF_ALLOWRELOAD)
Loop
Deselect:
PLSG A 1 A_Lower //PLSG A
Loop
Select:
PLSG A 1 A_Raise //PLSG A
Loop
Fire:
TNT1 A 0 A_JumpIfInventory("RifleMode", 1, "RifleFire")
TNT1 A 0 A_JumpIfInventory("ShotgunMode", 1, "ShotgunFire")
TNT1 A 0 A_JumpIfInventory("RocketMode", 1, "RocketFire")
Goto Ready
//------------------------------
// 9.5x25mm Caseless Rifle Mode
//------------------------------
RifleFire:
OICW A 1 A_JumpIfNoAmmo("Reload")
OICW A 1 BRIGHT A_FireProjectile("ARBullet", frandom(-1.7, 1.7), 1, 0, 0, 0, frandom(-1.7, 1.7))
OICW A 1 A_TakeInventory("RifleMag", 1)
OICW A 1 A_Refire
Goto Ready
//-----------------------
// 10 Gauge Shotgun Mode
//-----------------------
ShotgunFire:
OICW A 1 A_JumpIfNoAmmo("Reload")
OICW A 15 A_FireShotgun2
OICW A 1 A_TakeInventory("ShotgunTube", 1)
Goto Ready
//---------------------------------
// 20mm Smart Rocket Launcher Mode
//---------------------------------
RocketFire:
OICW A 1 A_JumpIfNoAmmo("Reload")
OICW A 20 A_FireMissile
OICW A 1 A_TakeInventory("RocketMag", 1)
Goto Ready
AltFire:
OICW A 1 ACS_NamedExecute("Cycler", 0, 0, 0, 0)
TNT1 A 0 A_PlaySound("weapons/shotgr", CHAN_AUTO, 50.0)
Goto Ready
Reload:
OICW A 1 ACS_NamedExecute("Reloader", 0, 0, 0, 0)
TNT1 A 0 A_PlaySound("weapons/shotgr", CHAN_AUTO, 50.0)
Goto Ready
}
}
#library "cyclr"
script "Cycler" (void)
{
if (CheckWeapon("OICW") == 1)
{
if(CheckInventory("RocketMode")==1 && CheckInventory("RifleMode")==0)
//If Rocket Mode is ACTIVE and RifleMode is INACTIVE
{
TakeInventory("RocketMode", 1);
GiveInventory("RifleMode", 1);
Print(s:"9.5x25mm Caseless Rifle Mode: ACTIVE.");
}
else if(CheckInventory("RifleMode")==1 && CheckInventory("ShotgunMode")==0)
//If Rifle Mode is ACTIVE and Shotgun Mode is INACTIVE
{
TakeInventory("RifleMode", 1);
GiveInventory("ShotgunMode", 1);
Print(s:"10ga Shotgun Mode: ACTIVE.");
}
else if(CheckInventory("ShotgunMode")==1 && CheckInventory("RocketMode")==0)
//If Shotgun Mode is ACTIVE and RocketMode is INACTIVE
{
TakeInventory("ShotgunMode", 1);
GiveInventory("RocketMode", 1);
Print(s:"20mm Smart Rocket Mode: ACTIVE.");
}
}
}
#library "rldr"
script "Reloader" (void)
{
if (CheckWeapon("OICW") == 1)
{
if(CheckInventory("RifleMode")==1)
{ GiveInventory("RifleMag", 25); Print(s:"Rifle Reloaded"); }
else if(CheckInventory("ShotgunMode")==1)
{ GiveInventory("ShotgunTube", 8); Print(s:"Shotgun Reloaded"); }
else if(CheckInventory("RocketMode")==1)
{ GiveInventory("RocketMag", 3); Print(s:"Smart Rocket Reloaded");}
}
}
Blue Shadow wrote:Your weapon is ammo-less (it lacks Weapon.AmmoType). This is why A_JumpIfNoAmmo doesn't work as expected. You may want to use A_JumpIfInventory instead of A_JumpIfNoAmmo.
jdredalert wrote:I made a weapon that could cycle through three different kinds of ammo, it was all made on DECORATE. Maybe you should take a look:
Click me.
Just keep in mind that i'm not actually using real ammo types, but inventory items instead.
Users browsing this forum: No registered users and 1 guest