Full sauce; minimal function !
Edit: Guess it was a silly way of doing it. If you find a better one please post that tutorial you mentioned at some point
Player:
Code: Select all
Class SpecMarine : DoomPlayer
{
statelabel wepstate; //you need to set this to something by overriding postbeginplay if you want the overlay-weapons to work before you ready a weapon-weapon :P
}
weapon:
Code: Select all
class overlayshotgun : shotgun replaces shotgun
{
default
{
weapon.ammouse 0;
}
states
{
Ready:
TNT1 A 0
{
let ownr = SpecMarine(invoker.owner); // Auto casts to the specified actor.
if (ownr) // Make sure it exists.
{
ownr.wepstate = "wepready";
}
else
{
a_log("wepstate ready set fail");
}
}
goto ready2;
ready2:
SHTG A 1 A_WeaponReady;
Loop;
Deselect:
SHTG A 1 A_Lower;
Loop;
Select:
SHTG A 1 A_Raise;
Loop;
Fire:
SHTG A 0
{
let ownr = SpecMarine(invoker.owner);
if (ownr)
{
ownr.wepstate = "wepfire";
}
else
{
a_log("wepstate fire set fail");
}
}
SHTG A 3;
SHTG A 7;
SHTG A 0 A_FireBullets (5.6, 0, 7, 5, "BulletPuff");
SHTG A 0 A_PlaySound ("weapons/shotgf", CHAN_WEAPON);
SHTG BC 5;
SHTG D 4;
SHTG CB 5;
SHTG A 3;
SHTG A 7;
Goto Ready;
Spawn:
SHOT A -1;
Stop;
}
}
overlay items:
Code: Select all
class extrashotgun : custominventory
{
statelabel nextstate;
default
{
Inventory.Amount 1;
inventory.maxamount 50;
+INVENTORY.ALWAYSPICKUP;
+INVENTORY.AUTOACTIVATE;
}
states
{
use:
TNT1 A 0
{
statelabel initstate = "remove";
let ownr = specmarine(invoker.owner);
if (ownr)
{
initstate = "startoverlay";
}
return resolvestate(initstate);
}
stop;
remove:
stop;
startoverlay:
TNT1 A 0
{
int layer = 5;
A_OverLay(layer,"wepready");
A_OverlayOffset(layer,64,32);
}
wait;
wepready:
SHTG A 1;
SHTG A 0
{
let ownr = SpecMarine(invoker.owner);
if (ownr)
{
invoker.nextstate = ownr.wepstate;
}
return resolvestate (invoker.nextstate);
}
SHTG A 1 A_log("Overlay Wepready state error");
stop;
wepfire: //this must has the exact same amount of frames as the corresponding state in the actual weapon.
SHTG A 3;
SHTG A 7;
SHTG A 0 A_FireBullets (5.6, 0, 7, 5, "BulletPuff");
SHTG A 0 A_PlaySound ("weapons/shotgf", CHAN_WEAPON);
SHTG BC 5;
SHTG D 4;
SHTG CB 5;
SHTG A 3;
SHTG A 7;
SHTG A 0
{
let ownr = SpecMarine(invoker.owner);
if (ownr)
{
invoker.nextstate = ownr.wepstate;
}
return resolvestate (invoker.nextstate);
}
TNT1 A 0 A_log("wepfire resolvestate fail");
stop;
Spawn:
SHOT A -1;
Stop;
}
}
class extrashotgun2 : extrashotgun
{
states
{
startoverlay:
TNT1 A 0
{
int layer = 6;
//i tried putting random(5,500) here in the
//above item, but several instances of the same
//class of custom inventory item with overlays
//do not work together :(
A_OverLay(layer,"wepready");
A_OverlayOffset(layer,-64,32);
}
}
}