Ion Fury's pizza health pickup in Doom (+ vending machine ?)

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.

Ion Fury's pizza health pickup in Doom (+ vending machine ?)

Postby Ac!d » Wed Sep 01, 2021 12:10 pm

https://arrangepoint.com.tr/wp-content/uploads/2020/08/IonFury-Inceleme-02.jpg

In Ion Fury, you can interact with pizzas to pick up slices in order to gain a bit of health.
I would like to recreate the same system, in ZScript.

pizza test.pk3

I made some sprites to help you in the process.



Edit : I would like to recreate the same system with "vending machines", interact with the actor and give a specified amount of ammo, until it's run out of ammo.
healthstations.png

Theses sprites are made by LossForWords for helping you.
You do not have the required permissions to view the files attached to this post.
Last edited by Ac!d on Sat Oct 09, 2021 8:57 am, edited 1 time in total.
User avatar
Ac!d
Perfection is a way, not an end. - Korean Proverb
 
Joined: 02 Apr 2019
Location: France
Discord: Ac!d#2732

Re: Ion Fury's pizza health pickup in Doom

Postby Jarewill » Wed Sep 01, 2021 1:52 pm

Here you go.
I created a new actor named PizzaPickup and inside of it I wrote a few properties and a function that deals with eating slices.
Then I created another actor that inherits from PizzaPickup and sets the properties to have 4 slices.
Using the pizza consumes a slice, heals the player a specified amount and plays the ActiveSound of the actor.

Also, the sprites seem to glitch at 2 slices left, but I don't know what to do about that.
You do not have the required permissions to view the files attached to this post.
Jarewill
 
 
 
Joined: 21 Jul 2019

Re: Ion Fury's pizza health pickup in Doom

Postby Ac!d » Wed Sep 01, 2021 3:12 pm

Thank you very much Jarewill !

Also, the sprites seem to glitch at 2 slices left, but I don't know what to do about that.

I messed up with the offsets of the 2 last sprites, they should be at (1, 20) instead of (20, 20).


Edit :

I added some details on the script, such as :
- You can't interact with a slice of pizza if your have 100 HP or above.
- A "pickup message".

Code: Select allExpand view
    Override Bool Used(Actor User)
    {
        If(User && User.Player && User.Player.Health<100 && slices)
        {        
            User
.GiveBody(sliceheal, 100);
            User.A_StartSound(activesound,CHAN_ITEM);
            slices--;
            
            User
.A_Log("Pizza Time!");
        }
        Return Super.Used(User);
    
User avatar
Ac!d
Perfection is a way, not an end. - Korean Proverb
 
Joined: 02 Apr 2019
Location: France
Discord: Ac!d#2732

Re: Ion Fury's pizza health pickup in Doom (+ vending machin

Postby Ac!d » Sat Oct 09, 2021 9:00 am

Edit : I would like to recreate the same system with "vending machines", interact with the actor and give a specified amount of ammo, until it's run out of ammo.

I tried using the same code with some edits, but I don't make it.
User avatar
Ac!d
Perfection is a way, not an end. - Korean Proverb
 
Joined: 02 Apr 2019
Location: France
Discord: Ac!d#2732

Re: Ion Fury's pizza health pickup in Doom (+ vending machin

Postby Jarewill » Sat Oct 09, 2021 10:41 am

Could you show what you tried doing?
In theory it shouldn't require much changes: Replace GiveBody with GiveInventory and change the sprites to fit.

The biggest limiting factor here would be making it variable based on current ammo amount.
While that would be possible in code, world actors don't support overlays, meaning it would take a lot of states for the different possible amounts.
Best choice here would be to give a fixed amount of ammo, such as the clip dispenser giving 50 bullets per use regardless of how much ammo the player is holding.
Jarewill
 
 
 
Joined: 21 Jul 2019

Re: Ion Fury's pizza health pickup in Doom (+ vending machin

Postby Ac!d » Sat Oct 09, 2021 1:55 pm

Spoiler: Code


How could I stop the activation of the actor if the player reach max ammo ? (it also depends if the player has a backpack or not)
User avatar
Ac!d
Perfection is a way, not an end. - Korean Proverb
 
Joined: 02 Apr 2019
Location: France
Discord: Ac!d#2732

Re: Ion Fury's pizza health pickup in Doom (+ vending machin

Postby Jarewill » Sat Oct 09, 2021 2:40 pm

Spoiler:

This is untested, so I am not sure if this will work or not, but it's worth a try.
Jarewill
 
 
 
Joined: 21 Jul 2019

Re: Ion Fury's pizza health pickup in Doom (+ vending machin

Postby Ac!d » Sun Oct 10, 2021 3:45 am

Your code works, but you can still interact with the actor and receive ammo, even if the ammo capacity reach the maximum with or without backpack.
User avatar
Ac!d
Perfection is a way, not an end. - Korean Proverb
 
Joined: 02 Apr 2019
Location: France
Discord: Ac!d#2732

Re: Ion Fury's pizza health pickup in Doom (+ vending machin

Postby Jarewill » Sun Oct 10, 2021 8:52 am

Okay, it was my mistake.
I forgot to specify a pointer for FindInventory.
This works:
Code: Select allExpand view
let clip Ammo(user.FindInventory("Clip")); 
Jarewill
 
 
 
Joined: 21 Jul 2019


Return to Scripting

Who is online

Users browsing this forum: No registered users and 1 guest