Custom regeneration items?

Handy guides on how to do things, written by users for users.

Moderators: GZDoom Developers, Raze Developers

Forum rules
Please don't start threads here asking for help. This forum is not for requesting guides, only for posting them. If you need help, the Editing forum is for you.

Custom regeneration items?

Postby XASSASSINX » Sat May 09, 2020 3:33 pm

Hello guys, been some good time since i posted here. Anyways, i have a question in regards with Custom Inventory:

How do i make a certain item that has a custom regeneration function? As in, it takes for instance 70 tics (2 seconds) to start giving health, but before that, it gives small doses of health, say, 1 per 10 tics. after that, it gives alot of health quickly? I've tried alot, from doing stuff like this:
Code: Select allExpand view
ACTOR SSTimpakSlow : CustomInventory
{
   Game Doom
   States
   {
   Pickup:
      MEDI A 15 A_giveInventory("healthbonus", 1)
      MEDI A 15 A_giveInventory("healthbonus", 1)
      MEDI A 15 A_giveInventory("healthbonus", 1)
      MEDI A 15 A_giveInventory("healthbonus", 1)
      Stop
   }
}

(Ignore the health bonus, it was just a test)
To trying to give myself to regenerations powerups at the same time, but it seems like Doom can't handle two regeneration powerups at the same time.

I'm coming back to decorate, any tip on how to do so? Powerup, Custominventory, what is the best DECORATE method?
XASSASSINX
 
Joined: 20 Dec 2016
Location: MURICAA BROTHER! Just kidding, Brazil.

Re: Custom regeneration items?

Postby SanyaWaffles » Sun May 10, 2020 4:40 pm

the problem with CustomInventory is it does everything all at once, ignoring state duration in tics.

There's probably a way to do it combining DECORATE and ACS and there's definitely ways of doing it via ZScript.
User avatar
SanyaWaffles
Wouldn't be an epic gamer if I didn't commit a few war crimes.
 
Joined: 25 Apr 2013
Location: Eastern Ohio
Discord: SanyaWaffles#5095
Twitch ID: sanyawaffles
Operating System: Windows 10/8.1/8/201x 64-bit
OS Test Version: No (Using Stable Public Version)
Graphics Processor: nVidia with Vulkan support

Re: Custom regeneration items?

Postby XASSASSINX » Sun May 10, 2020 5:29 pm

I've used A_GiveInventory to give myself health with te quick stimpak.
I'm trying to do a timer with the stimpak that last 10 seconds, and if you use another stimpak before this timer runs out, you take damage. I've tried alot of stuff, none of this worked.

Code: Select allExpand view
      STIM B 0 A_jumpIfnoammo("ReadyEmpty")
      STIM B 1 A_PlayWeaponSound("StimpakUse")
      STIM C 0 A_ZoomFactor(0.95)
      STIM C 1 A_TakeInventory("Stims", 1)
      STIM C 1 A_JumpIfInventory("StimpakTimer", 1, "Overdose")
      STIM C 0 A_GiveInventory("StimpakTimer")
      STIM C 1 A_SetBlend("Red", 0.5, 70)


Code: Select allExpand view
ACTOR StimpakTimer : PowerupGiver
{
    Inventory.Amount 2
    Powerup.duration -10
   Scale 0.10
   Powerup.type "PowerNothing"
   +INVENTORY.ALWAYSPICKUP
   +INVENTORY.AUTOACTIVATE
   States
   {
   Spawn:
    STIM A -1
    Loop
   }
}


This the the state that is supposed to remove your health, i've removed player health using an invisible explosion that takes your health (and your armor), i think you can only remove health via Zscript and ACS, right? But i have no idea where to start with those.
Not only that, but the item that has the timer also appears on my inventory as a "1" (if put it as a Give.Amount 0 it would dissapear and the state wouldn't consider it in my inventory) and i can use it! I have no idea how to fix this.
Code: Select allExpand view
   Overdose:
      STIM C 10 A_QuakeEx(0.8, 0.8, 1.3, 20, 0, 35, "")
      STIM C 2 A_SetBlend("Black", 1, 35)
      STIM C 3 A_TakeInventory("Health", 3, 0)
      STIM C 3 A_TakeInventory("Health", 3, 0)
      STIM C 3 A_TakeInventory("Health", 3, 0)
      STIM C 3 A_TakeInventory("Health", 3, 0)
      STIM B 3 A_ZoomFactor(1)
      Goto Ready


Any help??
XASSASSINX
 
Joined: 20 Dec 2016
Location: MURICAA BROTHER! Just kidding, Brazil.

Re: Custom regeneration items?

Postby Jarewill » Mon May 11, 2020 12:04 am

Posting snippets like that does make it a bit harder to help.

- Is "PowerNothing" defined anywhere?
- The reason why it appears in your inventory is because of how powerups work. It needs to have Inventory.MaxAmount 0 set up to prevent this.
- The PowerupGiver only gives the powerup and then gets removed, (unless it stays in the inventory) you need to check for PowerNothing for A_JumpIfInventory.
- There are other ways to deal with damaging the player. You could also use A_DamageSelf.
Jarewill
 
 
 
Joined: 21 Jul 2019

Re: Custom regeneration items?

Postby XASSASSINX » Mon May 11, 2020 8:03 am

- Is "PowerNothing" defined anywhere?

Yes, it is. Its simply defined as: "PowerNothing : Powerup {}"

- The reason why it appears in your inventory is because of how powerups work. It needs to have Inventory.MaxAmount 0 set up to prevent this.


Yes, i know, but if i do that, the item goes away and it doesn't count as being in my inventory, therefore the "Overdose" state never happens. It will only happen if it shows directly on my inventory.

- There are other ways to deal with damaging the player. You could also use A_DamageSelf.


What the hell? how didn't i ever NOT find this? This is so useful! thank you so much! It's actually now working, but is there any way to check precisely how much time there is left with a powerup? I know the "printinv" command, but it doens't show the time.

and one last question since i think this is the topic, is there a way to make a health item that heals a bit on a certain period, and after, say, 15 seconds, it heals you alot? CustomInventory gives its item instantly, is there any other way to do so without the use of Zscript?
XASSASSINX
 
Joined: 20 Dec 2016
Location: MURICAA BROTHER! Just kidding, Brazil.

Re: Custom regeneration items?

Postby Jarewill » Tue May 12, 2020 4:23 am

XASSASSINX wrote:and one last question since i think this is the topic, is there a way to make a health item that heals a bit on a certain period, and after, say, 15 seconds, it heals you alot? CustomInventory gives its item instantly, is there any other way to do so without the use of Zscript?

I am not sure about DECORATE, but ACS can deal with it.
You can use HealThing to heal the player in the script and loop it with delays and While loops.
For example:
Spoiler:

Then you can activate the script in a pickup state of a custom inventory with ACS_NamedExecute.

XASSASSINX wrote:Yes, i know, but if i do that, the item goes away and it doesn't count as being in my inventory, therefore the "Overdose" state never happens. It will only happen if it shows directly on my inventory.

Like I said, it's better to make the PowerupGiver always activate itself with Inventory.MaxAmount 0 and check for the PowerNothing in A_JumpIfInventory:
Spoiler:

PowerNothing will instantly disappear from the player's inventory after 10 seconds, while PowerupGiver will be kept there until the player uses it.
Jarewill
 
 
 
Joined: 21 Jul 2019

Re: Custom regeneration items?

Postby XASSASSINX » Tue May 12, 2020 4:44 pm

Alright, thanks! I've been a good since i've done some ACS, and it was basic. You have to create an ACS file, put the "#include zdoom" something on it, and then compile it, right??
I think the process has changed definetly, is there a wiki page on how to do it?
XASSASSINX
 
Joined: 20 Dec 2016
Location: MURICAA BROTHER! Just kidding, Brazil.

Re: Custom regeneration items?

Postby Jarewill » Wed May 13, 2020 12:13 am

You need to put #include "zcommon.acs" at the beginning of the file.
If you are also making a mod that should work with other levels, put the #library "scriptname" above the #include.

As for the wiki page, there's this with a lot of information and tutorials.
Jarewill
 
 
 
Joined: 21 Jul 2019


Return to Tutorials

Who is online

Users browsing this forum: No registered users and 1 guest