Looking for Resources for your mod/project? Want to share some of your creations so others can use them? Post them here!
-
Popsoap
-
- Posts: 86
- Joined: Mon Jun 04, 2012 2:38 pm
- Location: Inside a wall
#1
Post
by Popsoap » 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:
- 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
}
}
-
Ijon Tichy
- Frequent Poster Miles card holder
- Posts: 901
- Joined: Mon Jun 04, 2012 5:07 am
#2
Post
by Ijon Tichy » Wed Jun 25, 2014 6:38 am
Or you could use an ACS script, which isn't incredibly hacky.
-
Ninjamander
-
- Posts: 66
- Joined: Tue May 13, 2014 6:29 pm
- Location: Canada - New-Brunswick
#3
Post
by Ninjamander » Fri Jun 27, 2014 12:17 am
thanks for the share, nice to know some decorate alternative over some acs one.
-
ZzZombo
- Forum Regular
- Posts: 323
- Joined: Mon Jun 11, 2012 12:11 pm
- Location: Ravenholm
#4
Post
by ZzZombo » Mon Sep 28, 2015 5:00 am
Ijon Tichy wrote:
Or you could use an ACS script, which isn't incredibly hacky.
Never was fond of separating the logic in several places. Also it can't do certain things like checking for actor flags w/o using CustomInventory... or the hassle w/ changing the script, saving, recompiling, saving again. And it doesn't help that you may need to quickly switch between the two lumps continuously.
Last edited by
ZzZombo on Mon Sep 28, 2015 5:00 am, edited 1 time in total.
-
fr blood
- Frequent Poster Miles card holder
- Posts: 995
- Joined: Wed Mar 06, 2013 4:04 pm
- Location: France
#5
Post
by fr blood » Mon Sep 28, 2015 2:37 pm
Thanks a lot for that, this will help me a lot !
-
ZzZombo
- Forum Regular
- Posts: 323
- Joined: Mon Jun 11, 2012 12:11 pm
- Location: Ravenholm
#6
Post
by ZzZombo » Mon Sep 28, 2015 2:44 pm
One last thing: can there be several PowerTargeters at the same time on one unit?
-
Ivan
- Addicted to Zandronum
- Posts: 2229
- Joined: Mon Jun 04, 2012 5:38 pm
- Location: Omnipresent
#7
Post
by Ivan » Mon Sep 28, 2015 3:04 pm
I'd say, given on other powerup behaviors, there can but I wouldn't bet on it. Targeter is a weird powerup specific to Strife so who knows...
Last edited by
Ivan on Mon Sep 28, 2015 3:04 pm, edited 1 time in total.
-
Ænima
- Addicted to Zandronum
- Posts: 3579
- Joined: Tue Jun 05, 2012 6:12 pm
#8
Post
by Ænima » Mon Sep 28, 2015 4:27 pm
I would personally go with ACS only because you can manipulate the duration based on skill level or make "upgrades" for the powerup that would increase the duration if you wanted to.
But if for some reason you wanted a DECORATE-only method then this is nifty. Good find, Popsoap.
Last edited by
Ænima on Mon Sep 28, 2015 4:28 pm, edited 1 time in total.
-
ZzZombo
- Forum Regular
- Posts: 323
- Joined: Mon Jun 11, 2012 12:11 pm
- Location: Ravenholm
#9
Post
by ZzZombo » Tue Sep 29, 2015 12:44 am
A_SetTics() exists :O