Does that mean we have custom inventory items (Hexen style) now Graf?Killo Zapit wrote:Yay! Although I have to say, I am surprised about the addition of a PickUp state. I thought you could just make items use themselves automatically on pickup anyway.
A Christmas present for ZDoom
Moderator: GZDoom Developers
- The Ultimate DooMer
- Posts: 2109
- Joined: Tue Jul 15, 2003 5:29 pm
- Location: Industrial Zone
- Graf Zahl
- Lead GZDoom+Raze Developer

- Posts: 49252
- Joined: Sat Jul 19, 2003 10:19 am
- Location: Germany
Yes. You can do anything you can do with code pointers or action specials.
Here's one completely useless test item:
Here's one completely useless test item:
Code: Select all
ACTOR TestItemX : Inventory
{
Inventory.PickupMessage "Picked up some crap!"
+INVBAR
Inventory.Icon MEDIA0
States
{
Spawn:
MEDI A -1
Stop
Use:
TNT1 A 0 A_JumpIfInventory("RedCard", 1, 3)
TNT1 A 0 A_GiveInventory("InvulnerabilitySphere")
TNT1 A 0 A_FireCustomMissile("Rocket", 0, 0)
TNT1 A 0 A_GiveInventory("BlueArmor")
Stop
Pickup:
TNT1 A 0 A_GiveInventory("Megasphere")
TNT1 A 0 Door_Open(3, 150)
TNT1 A 0 A_SelectWeapon("Fist")
Stop
}
}
- David Ferstat
- Posts: 1113
- Joined: Wed Jul 16, 2003 8:53 am
- Location: Perth, Western Australia
- Contact:
- Graf Zahl
- Lead GZDoom+Raze Developer

- Posts: 49252
- Joined: Sat Jul 19, 2003 10:19 am
- Location: Germany
DoomRater wrote:I wanna make a CD player for example, and you use the CD's in your inventory to change the music.
That shouldn't be a problem. The CD player would just be an item with no function. These can't be used and just stay in the inventory as inert items. For the CD's you'd probably need some ACS scripting to do it properly but it is doable.
But before I recompile the new version I'll re-add some code that has been submitted elsewhere and is already in the .97 code base. I think Thursday evening I can send it to those who want to host it. Sorry but tomorrow I won't have any time to do it.
EDIT:
I'll delay this until the weekend. I just tried playing around with Kaiser's dialog compiler for Strife and there is one thing I'd like to add to make it more useful: Special items that perform some actions when dropped by monsters. This is one of the features Strife uses and some DECORATE support for it might be nice.
- DoomRater
- Posts: 8270
- Joined: Wed Jul 28, 2004 8:21 am
- Preferred Pronouns: He/Him
- Location: WATR HQ
- Contact:
ACS scripting I figured would be necessary but then again that's not a problem as long as it's for a TC. And what would be better than a Maniac Mansion TC? (random idea for the day)
Oh, that extra feature is making me drool. I don't know quite what to do with it yet... but unlike DS's extra features, these are more likely to be used.
Oh, that extra feature is making me drool. I don't know quite what to do with it yet... but unlike DS's extra features, these are more likely to be used.
If you still haven't got it compiled, grab it here.
- Killo Zapit
- Posts: 292
- Joined: Wed Jul 16, 2003 9:26 pm
- Location: Most likely sleeping.
I think what he wants is an inventory item that can be used but dosn't go away. The only way I know of to do that is like this:Graf Zahl wrote:DoomRater wrote:I wanna make a CD player for example, and you use the CD's in your inventory to change the music.
That shouldn't be a problem. The CD player would just be an item with no function. These can't be used and just stay in the inventory as inert items. For the CD's you'd probably need some ACS scripting to do it properly but it is doable.
Code: Select all
ACTOR MagicThingy : Inventory
{
+INVBAR
Inventory.MaxAmount 2
states
{
Spawn:
RKEY A 4
BKEY A 4
YKEY A 4
loop
Use:
RKEY A 1 A_GiveInventory("MagicThingy")
RKEY A 1 A_JumpIfInventory("Mana1", 10, 2)
RKEY A 1 A_PlaySound("*usefail")
Stop
RKEY A 1 A_TakeInventory("Mana1", 10)
RKEY A 1 HealThing(5)
Stop
}
}- Graf Zahl
- Lead GZDoom+Raze Developer

- Posts: 49252
- Joined: Sat Jul 19, 2003 10:19 am
- Location: Germany
Yes, that would be a simple solution but there is one problem with it. The GiveInventory call will fail when the user has the maximum amount of items of this kind. I think I need to add a mechanism to notify failure. The simplest thing would be a 'Fail' instead of 'Stop' at the end of the state sequence.
EDIT: done
I needed some handling for states which jump to themselves anyway so I just used that to signal failure. And to make it more intuitive I added 'FAIL' as a synonym for 'WAIT'.
Now you can do:
and the item will stay.
EDIT: done
I needed some handling for states which jump to themselves anyway so I just used that to signal failure. And to make it more intuitive I added 'FAIL' as a synonym for 'WAIT'.
Now you can do:
Code: Select all
ACTOR MagicThingy : Inventory
{
+INVBAR
Inventory.MaxAmount 1
states
{
Spawn:
RKEY A 4
BKEY A 4
YKEY A 4
loop
Use:
RKEY A 1 A_JumpIfInventory("Mana1", 10, 2)
RKEY A 1 A_PlaySound("*usefail")
Fail
RKEY A 1 A_TakeInventory("Mana1", 10)
RKEY A 1 HealThing(5)
Fail
}
}- Anakin S.
- Posts: 1067
- Joined: Fri Nov 28, 2003 9:39 pm
- Location: A long time ago in a galaxy far, far away...
But this wouldn't give the player those items, and instead would give them to the TestItemX, right? Is there a way to make it give the item to the player?Graf Zahl wrote:Yes. You can do anything you can do with code pointers or action specials.
Here's one completely useless test item:
Code: Select all
ACTOR TestItemX : Inventory { Inventory.PickupMessage "Picked up some crap!" +INVBAR Inventory.Icon MEDIA0 States { Spawn: MEDI A -1 Stop Use: TNT1 A 0 A_JumpIfInventory("RedCard", 1, 3) TNT1 A 0 A_GiveInventory("InvulnerabilitySphere") TNT1 A 0 A_FireCustomMissile("Rocket", 0, 0) TNT1 A 0 A_GiveInventory("BlueArmor") Stop Pickup: TNT1 A 0 A_GiveInventory("Megasphere") TNT1 A 0 Door_Open(3, 150) TNT1 A 0 A_SelectWeapon("Fist") Stop } }