PlayerUse / PlayerBump states

Post a reply

Smilies
:D :) :( :o :shock: :? 8-) :lol: :x :P :oops: :cry: :evil: :twisted: :roll: :wink: :geek: :ugeek: :!: :?: :idea: :arrow: :| :mrgreen: :3: :wub: >:( :blergh:
View more smilies

BBCode is OFF
Smilies are ON

Topic review
   

Expand view Topic review: PlayerUse / PlayerBump states

Re: PlayerUse / PlayerBump states

by Graf Zahl » Fri Oct 09, 2009 10:33 am

Correct! The thread was never flagged as updated so I didn't check.

Re: PlayerUse / PlayerBump states

by Gez » Fri Oct 09, 2009 10:09 am

I suppose I should have made a new post rather than editing the old.

Re: PlayerUse / PlayerBump states

by Gez » Mon Oct 05, 2009 11:56 am

Reworking it.

Reworked it.

Re: PlayerUse / PlayerBump states

by Graf Zahl » Mon Oct 05, 2009 10:49 am

@Gez:

That's much better but I've got one big issue with it. The handling of the USESPECIAL/BUMPSPECIAL flags is inconsistent. If they are specified as part of 'Activation' they don't behave as expected. In fact they can't due to compatibility needs. In such a situation your flag cleanup may be more counterproductive than useful.

Also, your SaveVersion check looks wrong.

Re: PlayerUse / PlayerBump states

by Captain Ventris » Mon Oct 05, 2009 10:12 am

I am fully supporting of this concept. Think of the possibilities with allies! For example, pressing use to set them into some sort of guard state or something?

I have absolutely no input as far as coding, just saying that this would be epically awesome.

Re: PlayerUse / PlayerBump states

by Gez » Mon Oct 05, 2009 10:07 am

I've something that's working, and relies on the Active and Inactive states.

I tested this code with these things in Hexen:

Code: Select all

Actor BumpFireBull : ZFireBullUnlit
{
	+BUMPSPECIAL
	Activation THINGSPEC_Switch
}

Actor UseFireBull : ZFireBullUnlit
{
	+USESPECIAL
	Activation THINGSPEC_Switch
}

Re: PlayerUse / PlayerBump states

by bagheadspidey » Mon Oct 05, 2009 8:56 am

Bumping this. That code sample I made a few posts ago will not work, since A_Jump is not a special... not sure what I was thinking. I'd like to re-open this for consideration as it would provide a way to have things do semi-complex stuff when used / bumped without any need for ACS.

Re: PlayerUse / PlayerBump states

by Graf Zahl » Mon Sep 28, 2009 9:53 am

Gez wrote:Why don't you make this as additional THINGSPEC_ flags, e.g. THINGSPEC_ChangeState? It could go into the normal USESPECIAL/BUMPSPECIAL blocks instead of following them. E.g., something like this I guess:
usestate.zip
(Edit: new version without copy/pasta error. Still untested, though.)

You can't name the state 'use'. Use already has a specific meaning and this might clash in some situations.

Re: PlayerUse / PlayerBump states

by Graf Zahl » Sun Sep 20, 2009 3:38 pm

Gez wrote:Not as far as I know. Also, THINGSPEC_Blah is a bit of a mouthful, so I suppose there could be shorter aliases defined as well. They are activation flags, so maybe AF_Blah? Or maybe do away with the prefix altogether? "activation ThingTargets|ThingActs" would look prettier in the decorate code than what we have right now.

Some prefix must remain. Even though they aren't right now later they will be constants.

Re: PlayerUse / PlayerBump states

by Gez » Sun Sep 20, 2009 3:35 pm

Not as far as I know. Also, THINGSPEC_Blah is a bit of a mouthful, so I suppose there could be shorter aliases defined as well. They are activation flags, so maybe AF_Blah? Or maybe do away with the prefix altogether? "activation ThingTargets|ThingActs" would look prettier in the decorate code than what we have right now.

I'd do that myself but I'm busy trying to understand why I get weird messages such as SC_GetNumber: Bad numeric constant "1,". in my current ZDoom Code Project (tm), as nowhere else does FScanner::MustGetNumber want to include the comma as part of the number, so this puzzles me. DEHSUPP, for example, contains a lot of "1," that are parsed by this function without this odd complaint, so why doesn't my new lump work? :?

Re: PlayerUse / PlayerBump states

by bagheadspidey » Sun Sep 20, 2009 3:16 pm

Actually, I've been thinking about this and I'm not sure it's actually necessary... Not tested, but wouldn't something like this work?

Code: Select all

ACTOR z2 : ZombieMan replaces ZombieMan
{
  
  +BUMPSPECIAL
 
  activation THINGSPEC_ThingActs | THINGSPEC_ThingTargets
    
    States
    {
        Spawn:
            TNT1 A 1
            TNT1 A 0 Thing_SetSpecial (0, A_Jump, 255, "GetBumped")
            goto "ZombieMan::Spawn"
        GetBumped:
            TNT1 A 0 ACS_ExecuteAlways (...)
            TNT1 A 0 A_DoStuffWithTarget
            TNT1 A 0 ...
            goto "ZombieMan::Spawn"
    }

} 
Speaking about THINGSPEC_ flag, I'm thinking that both USESPECIAL and BUMPSPECIAL could be removed as mobj flags and moved there. It'd make sense. Even if the flags remain convenient.
Yeah, I thought that too, makes sense to me...

Another flag that might be good would be a flag to make the thing not execute its special on death... is there already one for that?

Re: PlayerUse / PlayerBump states

by Gez » Sun Sep 20, 2009 12:42 pm

Why don't you make this as additional THINGSPEC_ flags, e.g. THINGSPEC_ChangeState? It could go into the normal USESPECIAL/BUMPSPECIAL blocks instead of following them. E.g., something like this I guess:
usestate.zip
(Edit: new version without copy/pasta error. Still untested, though.)

Speaking about THINGSPEC_ flag, I'm thinking that both USESPECIAL and BUMPSPECIAL could be removed as mobj flags and moved there. It'd make sense. Even if the flags remain convenient.

PlayerUse / PlayerBump states

by bagheadspidey » Fri Sep 18, 2009 4:26 pm

This patch adds two new states, "PlayerUse" and "PlayerBump."

- If a thing has a "PlayerUse" state, it will jump to it when a player presses "use" on the thing (unless the thing has the USESPECIAL flag).
- If a thing has a "PlayerBump" state, it will jump to it when a player bumps into the thing.

Reasoning: this allows for activatible /bumpable items without requiring the use of ACS (SetThingSpecial) or placing specials on things in a map editor.
use_bump_states_r1857.patch.txt
(948 Bytes) Downloaded 36 times
edit - this version honors the Activation flags THINGSPEC_ThingTargets and THINGSPEC_TriggerTargets.
use_bump_states_2_r1857.patch.txt
(1.29 KiB) Downloaded 30 times

Top