[DECORATE/ACS] Hard-coded Wings of Wrath in Hexen

Ask about ACS, DECORATE, ZScript, or any other scripting questions here!

Moderator: GZDoom Developers

Forum rules
Before asking on how to use a ZDoom feature, read the ZDoom wiki first. If you still don't understand how to use a feature, then ask here.

Please bear in mind that the people helping you do not automatically know how much you know. You may be asked to upload your project file to look at. Don't be afraid to ask questions about what things mean, but also please be patient with the people trying to help you. (And helpers, please be patient with the person you're trying to help!)
Post Reply
User avatar
Dr_Cosmobyte
Posts: 2847
Joined: Thu Jun 04, 2015 9:07 pm
Preferred Pronouns: He/Him
Location: Killing spiders.
Contact:

[DECORATE/ACS] Hard-coded Wings of Wrath in Hexen

Post by Dr_Cosmobyte »

So, i would like your guys help on this one.

On my upcoming project, the main focus is on magic powers which are powerups or custom projectiles based mainly on elements.

One of the Wind spells in particular (and the whole reason of the thread) grants the player the ability to fly for 10 seconds, and for that to work it gives the player a custom Artifly/Wings of Wrath powerup. Works flawlessly on Heretic and Doom! In Hexen, however, things start to get tough.

It seems PowerFlight/Artifly/Wings of Wrath is hardcoded in Hexen, and once the player casts the spell, the power lasts for a undefined amount of time, even in levels within the same HUB. I've tried to mess with "Inventory.HubMaxAmount", "INVENTORY.INTERHUBSTRIP", Max.Amount and a bunch of flags and properties, but no success. In this thread, user Arctangent suggests that it should be done in ZScript, and i agree that's the easiest way, but i don't want to exclude Zandronum players just yet. I want to see if there's at least a hacky way to get through.

There are three ways to remove the powerup:

1 - Open the console or kill yourself, then resurrect (we obviously don't want this one).
2 - Open the console and type "Fly", then "Fly" again. This unleashes a series of bugs. The WoW icon stops spinning, the Powerup.Color won't fade away, and you can't use other flying powerups. (Obviously we don't want this one too).
3 - Open the console and type "take powerflight". This one seems to work well!

So, would there be a way (with ACS) to "detect" if the player has either a PowerFlight on or, a specific inventory item as a token, count 10 seconds and remove the Power.Flight from the inventory completely? My ACS skills are limited to Booleans, and ends in there.

Just in case somebody wants to see the powerup, here it is:

Code: Select all

ACTOR RDWindPower3 : Artifly
{
	Game Heretic
	-INVENTORY.HUBPOWER
	-INVENTORY.INTERHUBSTRIP
	+INVENTORY.AUTOACTIVATE
	-INVENTORY.PERSISTENTPOWER
	+INVENTORY.FANCYPICKUPSOUND
	Inventory.MaxAmount 0
	Inventory.InterHubAmount 0
	Inventory.Icon "TNT1A0"
	Powerup.Color Green 0.05
	Powerup.Duration -10
	Tag "Caelipteryx"
}
If this REALLY can't be made through ACS/Decorate, then i guess it's ZScript we should go, but otherwise, i think it's worth a try. Thanks in advance.

EDIT: Forgot to mention i am using GZDoom 3.2 and i already tried InfiniteFlightPowerup on MAPINFO, thanks to Rip And Tear for the reminder.
Last edited by Dr_Cosmobyte on Sun Nov 18, 2018 5:45 pm, edited 1 time in total.
User avatar
Rip and Tear
Posts: 186
Joined: Tue May 02, 2017 3:54 pm

Re: [DECORATE/ACS] Hard-coded Wings of Wrath in Hexen

Post by Rip and Tear »

Check InfiniteFlightPowerup in MAPINFO.
User avatar
Dr_Cosmobyte
Posts: 2847
Joined: Thu Jun 04, 2015 9:07 pm
Preferred Pronouns: He/Him
Location: Killing spiders.
Contact:

Re: [DECORATE/ACS] Hard-coded Wings of Wrath in Hexen

Post by Dr_Cosmobyte »

I forgot to mention that, it's hard-coded as well. Setting it to "false", won't cut it in Hexen. =(
Blue Shadow
Posts: 5040
Joined: Sun Nov 14, 2010 12:59 am

Re: [DECORATE/ACS] Hard-coded Wings of Wrath in Hexen

Post by Blue Shadow »

Here's some code:

Code: Select all

// ACS
script "FinitePowerFlight" Enter
{
    while (true)
    {
        if (CheckInventory("PowerTimer"))
        {
            do
            {
                Delay(1);
            }
            while (CheckInventory("PowerTimer"));
            TakeInventory("PowerFlight", 1);
        }

        Delay(1);
    }
}

Code: Select all

// DECORATE
actor PowerTimer : Powerup
{
    Powerup.Duration -10

    +INVENTORY.HUBPOWER
}

actor TimerGiver : PowerupGiver
{
    Powerup.Type "PowerTimer"

    +INVENTORY.AUTOACTIVATE
}
The idea is that the player is given both the flight powerup and the timer item at the same time. The ACS script waits and does nothing if you don't have the timer item. Once you have it, the script waits until it expires and then takes the flight powerup away, then goes back to waiting.
User avatar
Player701
 
 
Posts: 1708
Joined: Wed May 13, 2009 3:15 am
Graphics Processor: nVidia with Vulkan support
Contact:

Re: [DECORATE/ACS] Hard-coded Wings of Wrath in Hexen

Post by Player701 »

Wow, that's really overcomplicated.

I see the question is tagged "DECORATE/ACS", but if you could use ZScript, then making a time-limited flight powerup would be possible with this simple class:

Code: Select all

class MyPowerFlight : PowerFlight
{
    override void Tick()
    {
        Powerup.Tick();
    }
}
PowerFlight circumvents the time limit in its Tick function. In this class, we avoid a call to it by calling the Tick function of the base Powerup class instead. This preserves the entire functionality of PowerFlight - save for its infinite duration, of course. And there is no need to re-implement its behavior from scratch. It is also possible to clear +INVENTORY.HUBPOWER flag for this class to restrict the powerup's effect to a single level.
Blue Shadow
Posts: 5040
Joined: Sun Nov 14, 2010 12:59 am

Re: [DECORATE/ACS] Hard-coded Wings of Wrath in Hexen

Post by Blue Shadow »

Player701 wrote:Wow, that's really overcomplicated.
This is why...
GAA1992 wrote:In this thread, user Arctangent suggests that it should be done in ZScript, and i agree that's the easiest way, but i don't want to exclude Zandronum players just yet. I want to see if there's at least a hacky way to get through.
User avatar
Player701
 
 
Posts: 1708
Joined: Wed May 13, 2009 3:15 am
Graphics Processor: nVidia with Vulkan support
Contact:

Re: [DECORATE/ACS] Hard-coded Wings of Wrath in Hexen

Post by Player701 »

Ah, I see. Sorry, then. "Hacky ways" isn't really my kind of thing. I guess this ACS + DECORATE stuff is the most suitable solution if Zandronum is taken into consideration.
User avatar
Dr_Cosmobyte
Posts: 2847
Joined: Thu Jun 04, 2015 9:07 pm
Preferred Pronouns: He/Him
Location: Killing spiders.
Contact:

Re: [DECORATE/ACS] Hard-coded Wings of Wrath in Hexen

Post by Dr_Cosmobyte »

Hi! Sorry for the delay, i worked overtime and was anxious to get home and test things out.

At first, the ACS got me an error to comply on the while identifier.

Code: Select all

Line 5 in file "C:\Program Files (x86)\SLADE\temp\RDPowerFlight.acs" ...
C:\Program Files (x86)\SLADE\temp\RDPowerFlight.acs:5: true : Identifier has not been declared.
>     while (true) 
>                ^

But after adding #include "zcommon.acs" at the beginning, it could comply the source. However, the script still doesn't work. Have i done something wrong?
Blue Shadow
Posts: 5040
Joined: Sun Nov 14, 2010 12:59 am

Re: [DECORATE/ACS] Hard-coded Wings of Wrath in Hexen

Post by Blue Shadow »

Could you post the relevant DECORATE and the ACS code (in case it has been modified)?

Also, make sure that the ACS code is integrated as a library. See these:
  • [wiki]Libraries[/wiki] (don't mind the importing section; it's not relevant in this case)
  • [wiki]LOADACS[/wiki]
User avatar
Dr_Cosmobyte
Posts: 2847
Joined: Thu Jun 04, 2015 9:07 pm
Preferred Pronouns: He/Him
Location: Killing spiders.
Contact:

Re: [DECORATE/ACS] Hard-coded Wings of Wrath in Hexen

Post by Dr_Cosmobyte »

Sorry about that, i should have known, really. It was indeed the library stuff!!! Thank you very very very much Blue Shadow! Also, as a security matter, i added a inventory check in case the player wants to get down by himself.

Again, Thanks a lot.
Post Reply

Return to “Scripting”