Generic useable items (and other stuff).
Moderator: GZDoom Developers
-
- Posts: 292
- Joined: Wed Jul 16, 2003 9:26 pm
- Location: Most likely sleeping.
Generic useable items (and other stuff).
I think I have mentioned this before, but since it doesnt 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 strifes 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 strifes 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?).
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 strifes 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 strifes 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?).
-
- Lead GZDoom+Raze Developer
- Posts: 49192
- Joined: Sat Jul 19, 2003 10:19 am
- Location: Germany
Re: Generic useable items (and other stuff).
You mean like this: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.
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
}
}
-
- Posts: 292
- Joined: Wed Jul 16, 2003 9:26 pm
- Location: Most likely sleeping.
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:
Or this:
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.
I mean like this:
Code: Select all
ACTOR : ScriptItem
{
PickupSound "misc/p_pkup"
PickupMsg "Run a script!"
Icon ARTISTNG
Inventory.Script 200
}
Code: Select all
ACTOR : ProjectileItem
{
PickupSound "misc/p_pkup"
PickupMsg "SHOOTER"
Icon ARTIBLAH
Inventory.MissleType "FooShot"
}
... 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.
-
- Lead GZDoom+Raze Developer
- Posts: 49192
- Joined: Sat Jul 19, 2003 10:19 am
- Location: Germany
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.
actor or weapon.
As for implementation, how about this:
and add some result setting to those functions where it might be useful (like A_GiveInventory for example.)
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,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.
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;
}
-
- Posts: 292
- Joined: Wed Jul 16, 2003 9:26 pm
- Location: Most likely sleeping.
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 didnt think you could simply cycle though the states like that. Thats why youre the king, and Im just a smuck.
-
- Posts: 7656
- Joined: Sat Aug 07, 2004 5:14 am
- Location: Some cold place
Re: Generic useable items (and other stuff).
What does that do?Graf Zahl wrote:Code: Select all
+FANCYPICKUPSOUND
-
- Lead GZDoom+Raze Developer
- Posts: 49192
- Joined: Sat Jul 19, 2003 10:19 am
- Location: Germany
It plays the pickup sound in surround. It's one of those 'useless' little enhancements ZDoom did.
That's all.
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);
}
-
- Posts: 811
- Joined: Sun Jul 04, 2004 3:21 pm
-
- Posts: 21706
- Joined: Tue Jul 15, 2003 7:33 pm
- Preferred Pronouns: He/Him
- Operating System Version (Optional): A lot of them
- Graphics Processor: Not Listed
-
- Lead GZDoom+Raze Developer
- Posts: 49192
- Joined: Sat Jul 19, 2003 10:19 am
- Location: Germany
-
- Lead GZDoom+Raze Developer
- Posts: 49192
- Joined: Sat Jul 19, 2003 10:19 am
- Location: Germany
-
- Posts: 811
- Joined: Sun Jul 04, 2004 3:21 pm
-
- 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).
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.Graf Zahl wrote:You mean like this:
whichg would be functionally equivalent to the internal artifact if the use state worked.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 } }
-
- Lead GZDoom+Raze Developer
- Posts: 49192
- Joined: Sat Jul 19, 2003 10:19 am
- Location: Germany
-
- Posts: 1616
- Joined: Wed Feb 09, 2005 3:09 pm