Generic useable items (and other stuff).

Moderator: GZDoom Developers

User avatar
Killo Zapit
Posts: 292
Joined: Wed Jul 16, 2003 9:26 pm
Location: Most likely sleeping.

Generic useable items (and other stuff).

Post by Killo Zapit »

I think I have mentioned this before, but since it doesn’t have it's own thread here (and no one ever seemed to notice anyway) I thought I would post it again, even though everyone will probably ignore it like most of my other posts.

Anyway, the problem is this: Although DECORATE will soon allow the creation of new inventory items, it is my understanding that the use action will probably not be customizable anytime soon. However, since most of the time people might just want to shoot a projectile or throw a grenade or something like that and most other actions could be accomplished with ACS anyway, customization of this kind would be sort of unnecessary. Instead all you would need is a type of inventory item that could be subclassed that would read some DECORATE parameter for. BTW, this same basic idea was suggested here but shot down. However I think there was a misunderstanding about exactly what the idea meant. This is not about a way to replace an item's "Use" function in decorate. This is just creating new items that have a built-in "Use" function that performs some generic action, like shooting a projectile, throwing a grenade, running a script, ect. using parameters set in DECORATE.

Also: I would like a way to unset the special flag so that I can create destroyable items.

Also Also: Concerning strife’s dialog system: I am not exactly sure if any plans are underway to port it for use in doom levels, but IMHO, just creating an ACS command that calls up the conversation screen with whatever options such as ConversationMenu (text, option1, option2, option3, option4) and returns the option picked would be much better then using strife’s clunky scripting system (also, for people who like making their own dialog screens, why not a ACS command that returns which direction/movement buttons are pressed?).
User avatar
Graf Zahl
Lead GZDoom+Raze Developer
Lead GZDoom+Raze Developer
Posts: 48537
Joined: Sat Jul 19, 2003 10:19 am
Location: Germany

Re: Generic useable items (and other stuff).

Post by Graf Zahl »

Killo Zapit wrote: This is not about a way to replace an item's "Use" function in decorate. This is just creating new items that have a built-in "Use" function that performs some generic action, like shooting a projectile, throwing a grenade, running a script, ect. using parameters set in DECORATE.
You mean like this:

Code: Select all

ACTOR ArtiEgg : Inventory 30
{
	SpawnID 14
	Inventory_MaxAmount -1
	+FLOATBOB +COUNTITEM +PICKUPFLASH +INVBAR +FANCYPICKUPSOUND
	PickupSound "misc/p_pkup"
	PickupMsg "Morph Ovum"
	Icon ARTIEGGC
	States
	{
	Spawn:
		EGGC ABCB 6
		Loop
	Use:
		TNT1 A 0 A_FireCustomMissile("EggFX", -15, 1)
		TNT1 A 0 A_FireCustomMissile("EggFX", -7.5, 1)
		TNT1 A 0 A_FireCustomMissile("EggFX", 0, 1)
		TNT1 A 0 A_FireCustomMissile("EggFX", 7.5, 1)
		TNT1 A 0 A_FireCustomMissile("EggFX", 15, 1)
		Stop
	}
}
whichg would be functionally equivalent to the internal artifact if the use state worked.
User avatar
Killo Zapit
Posts: 292
Joined: Wed Jul 16, 2003 9:26 pm
Location: Most likely sleeping.

Post by Killo Zapit »

No that's not what I meant at all! The whole point is that you said stuff like that is imposable. So avoid it entirely!

I mean like this:

Code: Select all

ACTOR  : ScriptItem
{
   PickupSound "misc/p_pkup"
   PickupMsg "Run a script!"
   Icon ARTISTNG
   Inventory.Script 200
}
Or this:

Code: Select all

ACTOR  : ProjectileItem
{
   PickupSound "misc/p_pkup"
   PickupMsg "SHOOTER"
   Icon ARTIBLAH
   Inventory.MissleType "FooShot"
}
The whole point is so you don't HAVE to redefine an actors use state! Just make new items that hack around it!

... But your idea works too. If you can do it that is. Quite frankly, I think it would be hard. A item's use function is just that: A function. It would probably be easier just to generate a code pointer table for use functions and let the player set what the use function points too. But whatever.
User avatar
Graf Zahl
Lead GZDoom+Raze Developer
Lead GZDoom+Raze Developer
Posts: 48537
Joined: Sat Jul 19, 2003 10:19 am
Location: Germany

Post by Graf Zahl »

Sorry, far too specialized and limited. Actually some use state sequence is much easier to implement and much more flexible. What you suggest requires rather specialized coding for much more limited use.

Quite frankly, I think it would be hard. A item's use function is just that: A function.
It would probably be easier just to generate a code pointer table for use functions and let the player set what the use function points too. But whatever.
You are right. And that's what the states would be used for. Just containers for the code pointers to be called, nothing more. There is no way to handle them like 'normal' states,
actor or weapon.

As for implementation, how about this:

Code: Select all

bool AInventory::DoUse (bool pickup)
{
	FState * usestate = UseState;
	bool result=false;

	if (usestate)
	{
		result=false;
		while (usestate)
		{
			if (usestate->Action) 
			{
				Owner->result=true;
				usestate->CallActionFunction(Owner); // this line is not real code!
				result|=Owner->result;
			}
			usestate=usestate->GetNextState();
		}
	}
	result |= Use (pickup);
	return result;
}
and add some result setting to those functions where it might be useful (like A_GiveInventory for example.)
User avatar
Killo Zapit
Posts: 292
Joined: Wed Jul 16, 2003 9:26 pm
Location: Most likely sleeping.

Post by Killo Zapit »

Neat! You know, at first I thought you were going to try some wacky stunt that would run the items frames similarly to weapon frames or something. ...Which actually would be neat, you could have a timed sequence of actions and stuff. But I didn't expect it to actually be useable in the near future. I didn’t think you could simply cycle though the states like that. That’s why you’re the king, and I’m just a smuck.
User avatar
TheDarkArchon
Posts: 7656
Joined: Sat Aug 07, 2004 5:14 am
Location: Some cold place

Re: Generic useable items (and other stuff).

Post by TheDarkArchon »

Graf Zahl wrote:

Code: Select all

+FANCYPICKUPSOUND
What does that do?
User avatar
Graf Zahl
Lead GZDoom+Raze Developer
Lead GZDoom+Raze Developer
Posts: 48537
Joined: Sat Jul 19, 2003 10:19 am
Location: Germany

Post by Graf Zahl »

It plays the pickup sound in surround. It's one of those 'useless' little enhancements ZDoom did.

Code: Select all

void AInventory::PlayPickupSound (AActor *toucher)
{
	S_SoundID (toucher, CHAN_PICKUP, PickupSound, 1,
		(ItemFlags & IF_FANCYPICKUPSOUND) &&
		(toucher == NULL || toucher->CheckLocalView (consoleplayer))
		? ATTN_SURROUND : ATTN_NORM);
}
That's all.
User avatar
Daniel
Posts: 811
Joined: Sun Jul 04, 2004 3:21 pm

Post by Daniel »

Is this "Use" state available on the "Santa Version" ZDoom?

I was editing ZDoom.exe with Edit.com, and I found a state called "Wound". What does it work for?
User avatar
wildweasel
Moderator Team Lead
Posts: 21590
Joined: Tue Jul 15, 2003 7:33 pm
Preferred Pronouns: He/Him
Operating System Version (Optional): Win10 22H2, Win11 22H2, macOS 11.7
Graphics Processor: nVidia with Vulkan support

Post by wildweasel »

Daniel: If you would read the Wiki, you'd know. I just saw it in there - apparently it's used if a monster is between 0 and 6 hitpoints remaining (so they can sit there and choke or something like in Strife).
User avatar
Graf Zahl
Lead GZDoom+Raze Developer
Lead GZDoom+Raze Developer
Posts: 48537
Joined: Sat Jul 19, 2003 10:19 am
Location: Germany

Post by Graf Zahl »

wildweasel wrote:(so they can sit there and choke or something like in Strife).
Exactly that!
User avatar
Graf Zahl
Lead GZDoom+Raze Developer
Lead GZDoom+Raze Developer
Posts: 48537
Joined: Sat Jul 19, 2003 10:19 am
Location: Germany

Post by Graf Zahl »

Daniel wrote:Is this "Use" state available on the "Santa Version" ZDoom?

I was editing ZDoom.exe with Edit.com, and I found a state called "Wound". What does it work for?
No, it was just something I slapped together when I saw this thread. But it's not a big issue to implement.
User avatar
Daniel
Posts: 811
Joined: Sun Jul 04, 2004 3:21 pm

Post by Daniel »

Thanks! I don't know Strife very well, but I think this state can bring some interesting ideas...
User avatar
Anakin S.
Posts: 1067
Joined: Fri Nov 28, 2003 9:39 pm
Location: A long time ago in a galaxy far, far away...

Re: Generic useable items (and other stuff).

Post by Anakin S. »

Graf Zahl wrote:You mean like this:

Code: Select all

ACTOR ArtiEgg : Inventory 30
{
	SpawnID 14
	Inventory_MaxAmount -1
	+FLOATBOB +COUNTITEM +PICKUPFLASH +INVBAR +FANCYPICKUPSOUND
	PickupSound "misc/p_pkup"
	PickupMsg "Morph Ovum"
	Icon ARTIEGGC
	States
	{
	Spawn:
		EGGC ABCB 6
		Loop
	Use:
		TNT1 A 0 A_FireCustomMissile("EggFX", -15, 1)
		TNT1 A 0 A_FireCustomMissile("EggFX", -7.5, 1)
		TNT1 A 0 A_FireCustomMissile("EggFX", 0, 1)
		TNT1 A 0 A_FireCustomMissile("EggFX", 7.5, 1)
		TNT1 A 0 A_FireCustomMissile("EggFX", 15, 1)
		Stop
	}
}
whichg would be functionally equivalent to the internal artifact if the use state worked.
So do the sprites that get played behave just like weapon animations? That would be great. Then we could make the fighter look like he's actually tossing flechettes when he uses them.
User avatar
Graf Zahl
Lead GZDoom+Raze Developer
Lead GZDoom+Raze Developer
Posts: 48537
Joined: Sat Jul 19, 2003 10:19 am
Location: Germany

Post by Graf Zahl »

No, they won't be displayed at all. They are just containers to store the code pointer and the parameter list but that's it.
User avatar
Belial
Posts: 1616
Joined: Wed Feb 09, 2005 3:09 pm

Post by Belial »

Hmmm... the animated items brought an idea... things like those used in Deus Ex, i.e. animated useable lockpicks and multitools. Would that be possible?

Return to “Closed Feature Suggestions [GZDoom]”