CustomInventory with Non-Zero Frame Durations
Posted: Wed Jun 25, 2014 1:02 am
CustomInventory has one handicap where both the Pickup and Use states are run at 0 tics regardless of what they are set to.
This is a (slightly hacky) workaround using the PowerTargeter actor to create powerups which have non-zero frame durations. Some uses for this include:
This is a (slightly hacky) workaround using the PowerTargeter actor to create powerups which have non-zero frame durations. Some uses for this include:
- Regeneration powerups that aren't locked at 5 HP/Sec.
- Powerups which regenerate ammo over time.
- Powerups that only affect the player after a given amount of time.
- Flashlights in OpenGL.
Code: Select all
Actor AmmoRegenerator : PowerupGiver
{
Powerup.Type AmmoRegenerator
+AUTOACTIVATE
+ALWAYSPICKUP
}
Actor PowerAmmoRegenerator : PowerTargeter // Needs to inherit from PowerTargeter to work
{
Powerup.Duration 350
States
{
Targeter:
TNT1 AA 0 // These 2 frames prevent accuracy upgrades from affecting the powerup
TNT1 A 0 A_GiveInventory("Clip", 10)
TNT1 A 0 A_GiveInventory("Shell", 4)
TNT1 A 0 A_GiveInventory("RocketAmmo", 1)
TNT1 A 35 A_GiveInventory("Cell", 20)
Loop
}
}