by MartinHowe » Fri Aug 19, 2005 2:46 am
No comments after a few days. Well, OK, now that I've had time to think about it a bit more, here's a suggestion for both type and TID based attack filtering and no-enemies interception, without going the whole hog and adding filterscripts and suchlike:
(1)
Define a new DECORATE-level state "Bored".
If declared in DECORATE for a particular actor, this state would be entered by the actor whenever it has just run out of enemies (but not when it has never had any in the first place, that's what A_Look() is for). If not so declared, the actor would do whatever it would currently (.96) does.
(2)
Define a new DECORATE-level state "Angry".
If declared in DECORATE for a particular actor, this state would be entered by the actor whenever it is about to switch to a target because of just being hit by THAT target (or a projectile that it fired). If not so declared, the actor would do whatever it would currently (.96) does.
(3)
Define a new DECORATE-level state "Vindictive".
If declared in DECORATE for a particular actor, this state would be entered by the actor whenever it is about to switch to a target because of that target being a friend of the enemy (and not because the target is an enemy itself). If not so declared, the actor would do whatever it would currently (.96) does.
(4)
Define a new DECORATE-level state "Targeting"".
If declared in DECORATE for a particular actor, this state would be entered by the actor whenever it is about to switch to a target because of having just found it for the first time after being idle (or after just having defeated its previous enemy). This would leave the SEE state for what it actually is: CHASING an actor once the decision to attack it has actually been taken - the "Targeting" state would allow the decision to attack a target from scratch to be intercepted and, if necessary, overridden). If not so declared, the actor would do whatever it would currently (.96) does
(5)
Allow state jumps to states by label (already in 2.0.10)
(6)
Add an ACS function SetActorState(statelabel). The state would take effect when the script exited.
(7)
Add the following ACS functions: GetCurrentTargetTID(void), GetProspectiveTargetTID(void),GetCurrentTargetType(void), GetProspectiveTargetType(void),GetCurrentTargetSpawnID(void), GetProspectiveTargetSpawnID(void). These would return the TID, DoomEdNum and T_XXXX of the current and prospective targets. Outside the Angry or Vindictive states, the "prospective" functions would return -1.
(8)
Add a function to ACS: RevertCurrentTarget(statelabel). This would cause the actor to reenter the SEE state (or the specified state if statelabel is not "") with the current target, effectively ignoring a particular attack. Thinking about it, this could potentially be an action function as well. ****This is needed to avoid having to give every actor on the map a TID.
(9)
Add a function to ACS: SetTargetByTID(int TID, int statelabel), SetTargetBySpawnID(int SpawnID, int statelabel), SetTargetByType(int DoomEdNum, int statelabel). These would cause the actor to reenter the SEE state (or the specified state if statelabel is not "") with the first-matching actor as a target and would return TRUE if successful or FALSE if not. Note this is NOT Thing_Hate(), it would set the AActor->target field NOT the TIDToHate field.
**** Finally, there is still the problem of writing "truly generic" ACS action functions, that is, functions that can affect any actor, WITHOUT having to give every actor on the map a TID. I don't know how difficult this would be but how about the following: since TIDs are positive, how about modifying all ACS functions that expect a TID to accept a negative number whose absolute value would be the *AActor value for that actor; effectively a handle to an actor, and exposing the AActor->this, AActor->target and "AActor->prospectivetarget" fields with GetActorProperty?
No comments after a few days. Well, OK, now that I've had time to think about it a bit more, here's a suggestion for both type and TID based attack filtering and no-enemies interception, without going the whole hog and adding filterscripts and suchlike:
(1)
Define a new DECORATE-level state "Bored".
If declared in DECORATE for a particular actor, this state would be entered by the actor whenever it has just run out of enemies (but not when it has never had any in the first place, that's what A_Look() is for). If not so declared, the actor would do whatever it would currently (.96) does.
(2)
Define a new DECORATE-level state "Angry".
If declared in DECORATE for a particular actor, this state would be entered by the actor whenever it is about to switch to a target because of just being hit by THAT target (or a projectile that it fired). If not so declared, the actor would do whatever it would currently (.96) does.
(3)
Define a new DECORATE-level state "Vindictive".
If declared in DECORATE for a particular actor, this state would be entered by the actor whenever it is about to switch to a target because of that target being a friend of the enemy (and not because the target is an enemy itself). If not so declared, the actor would do whatever it would currently (.96) does.
(4)
Define a new DECORATE-level state "Targeting"".
If declared in DECORATE for a particular actor, this state would be entered by the actor whenever it is about to switch to a target because of having just found it for the first time after being idle (or after just having defeated its previous enemy). This would leave the SEE state for what it actually is: CHASING an actor once the decision to attack it has actually been taken - the "Targeting" state would allow the decision to attack a target from scratch to be intercepted and, if necessary, overridden). If not so declared, the actor would do whatever it would currently (.96) does
(5)
Allow state jumps to states by label (already in 2.0.10)
(6)
Add an ACS function SetActorState(statelabel). The state would take effect when the script exited.
(7)
Add the following ACS functions: GetCurrentTargetTID(void), GetProspectiveTargetTID(void),GetCurrentTargetType(void), GetProspectiveTargetType(void),GetCurrentTargetSpawnID(void), GetProspectiveTargetSpawnID(void). These would return the TID, DoomEdNum and T_XXXX of the current and prospective targets. Outside the Angry or Vindictive states, the "prospective" functions would return -1.
(8)
Add a function to ACS: RevertCurrentTarget(statelabel). This would cause the actor to reenter the SEE state (or the specified state if statelabel is not "") with the current target, effectively ignoring a particular attack. Thinking about it, this could potentially be an action function as well. ****This is needed to avoid having to give every actor on the map a TID.
(9)
Add a function to ACS: SetTargetByTID(int TID, int statelabel), SetTargetBySpawnID(int SpawnID, int statelabel), SetTargetByType(int DoomEdNum, int statelabel). These would cause the actor to reenter the SEE state (or the specified state if statelabel is not "") with the first-matching actor as a target and would return TRUE if successful or FALSE if not. Note this is NOT Thing_Hate(), it would set the AActor->target field NOT the TIDToHate field.
**** Finally, there is still the problem of writing "truly generic" ACS action functions, that is, functions that can affect any actor, WITHOUT having to give every actor on the map a TID. I don't know how difficult this would be but how about the following: since TIDs are positive, how about modifying all ACS functions that expect a TID to accept a negative number whose absolute value would be the *AActor value for that actor; effectively a handle to an actor, and exposing the AActor->this, AActor->target and "AActor->prospectivetarget" fields with GetActorProperty?