Page 1 of 1

Turning medkit and stimpack into inventory items.

Posted: Fri May 31, 2013 9:40 pm
by Michael_M88
So, I want to do a simple item edit. I want to change the medkits and stimpacks so that instead of instantly using them, you can hold them and stack them in the inventory and use them when needed. I think it's possible, I just can't figure it out. I use SLumpEd, XWE, and Zandronum if that helps. Sorry if this a stupid question, thanks in advance.

RE: Turning medkit and stimpack into inventory items.

Posted: Fri May 31, 2013 10:22 pm
by Ænima
Armed Recruit does this.


Open it up and see how it's done.

RE: Turning medkit and stimpack into inventory items.

Posted: Fri May 31, 2013 11:15 pm
by Michael_M88
Still having a little trouble. Here's what I've got in my wad:

ACTOR Medikit2 : CustomInventory Replaces Medikit
{
Inventory.PickupMessage "Picked up a medikit."
States
{
Spawn:
STIM A 10
STIM A 1 bright
Loop
Pickup:
TNT1 A 0 A_GiveInventory ("Medikit2")
Stop
}
}

Zandronum crashes once I pick it up. I'm not that great with scripting, any one know of any solution?

RE: Turning medkit and stimpack into inventory items.

Posted: Fri May 31, 2013 11:27 pm
by Ænima
Yeah it's crashing because you created an infinite loop there. Picking up Medikit2 gives you a Medikit2, which gives you a Medikit2, which gives you a Medikit2, etc etc etc.

Try this instead:

Code: Select all

ACTOR Medikit2 : CustomInventory Replaces Medikit
{
Inventory.PickupMessage "Picked up a medikit."
States
{
Spawn:
STIM A 10
STIM A 1 bright
Loop
Use:
TNT1 A 0 A_GiveInventory ("Health", 25)
Stop
}
}

RE: Turning medkit and stimpack into inventory items.

Posted: Fri May 31, 2013 11:37 pm
by Michael_M88
Ok thank you for the help there, but when I pick up the medikit, I can't use it or find it in my inventory, if that makes any sense. Also, I can only pick up one.


And yea, I have set the controls in my game to use items and switch to them.

RE: Turning medkit and stimpack into inventory items.

Posted: Sat Jun 01, 2013 12:24 am
by Ijon Tichy
you need INVBAR, Inventory.Icon, and Inventory.MaxAmount

Code: Select all

ACTOR Medikit2 : CustomInventory Replaces Medikit
{
    Inventory.PickupMessage "Picked up a medikit."
    Inventory.MaxAmount 10
    Inventory.Icon "MEDIA0"
    +INVBAR

    States
    {
      Spawn:
        STIM A 10
        STIM A 1 bright
        loop

      Use:
        TNT1 A 0 A_GiveInventory ("Health", 25)
        stop
     }
}

RE: Turning medkit and stimpack into inventory items.

Posted: Sat Jun 01, 2013 12:33 am
by Michael_M88
Ha! It worked! Thank you guys so much for your help :)