A MonsterRefire: Difference between revisions
Jump to navigation
Jump to search
m (Needs to be < 40 but >= 30, so just 10.) |
No edit summary |
||
| (12 intermediate revisions by 5 users not shown) | |||
| Line 1: | Line 1: | ||
{{DISPLAYTITLE:A_MonsterRefire}} |
{{DISPLAYTITLE:A_MonsterRefire}} |
||
'''{{class|Actor}}''' |
|||
'''A_MonsterRefire''' (int ''chancecontinue'', str "''abortstate''") {{svn|1642}} |
|||
{{c|native State '''A_MonsterRefire''' (int ''chance'', statelabel ''label'')}} |
|||
'''A_CPosRefire'''<br /> |
|||
(no parameters)<br /> |
|||
'''A_SpidRefire'''<br /> |
|||
(no parameters)<br /> |
|||
'''A_SentinelRefire'''<br /> |
|||
(no parameters)<br /> |
|||
== Usage == |
|||
Calls [[A_FaceTarget]] and then checks whether the monster should abort its attack sequence and go |
Calls [[A_FaceTarget]] and then checks whether the monster should abort its attack sequence and go to a different [[Actor states|state]]. If the target is out of sight or dead, has a '''chance'''/255 chance to not jump to the ''label'' state sequence. Also aborts the attack if it hit the monster's ally. |
||
Monster-specific functions such as [[A_CPosRefire]], [[A_CrusaderRefire]], [[A_SpidRefire]] and [[A_SentinelRefire]], are variations of this function with predetermined chances (they also all jump to the "See" state sequence if the attack is to be aborted). |
|||
The monster-specific functions use the following parameters: |
|||
:<code>A_CPosRefire</code>: 40, "See" |
|||
:<code>A_SpidRefire</code>: 10, "See" |
|||
:<code>A_SentinelRefire</code>: 30, "See" |
|||
=== Parameters === |
|||
All these functions jump to the “'''See'''” [[Actor states|state]] if the attack is to be aborted. The loop has to be explicitly coded in the actor definition. <code>A_SentinelRefire</code> also has a 10/256 chance of aborting the attack even if the target is still in sight. |
|||
*{{c|int '''chance'''}} |
|||
:Chance in the 0-255 range that the actor will ''continue'' attacking even if its target is dead or out of sight. |
|||
*{{c|StateLabel '''label'''}} |
|||
:Name of the state sequence to go to if the actor aborts its attack, for example {{c|"See"}}. |
|||
== Example == |
== Example == |
||
Class SuperZombie : {{Class|ZombieMan}} |
|||
{ |
{ |
||
States |
States |
||
{ |
{ |
||
Missile: |
Missile: |
||
POSS E 10 [[A_FaceTarget]] |
POSS E 10 [[A_FaceTarget]]; |
||
MissileLoop: {{comment|Intentional fall-through}} |
|||
POSS FE 2 Bright [[A_PosAttack]] |
POSS FE 2 Bright [[A_PosAttack]]; |
||
POSS F 1 [[A_MonsterRefire]]( |
POSS F 1 [[A_MonsterRefire]](128, "See"); {{comment|50% chance to jump to "See" if target is out of sight.}} |
||
Goto Missile+1 // Looping back to the attack state to allow the actual refire! |
|||
loop; {{comment|If the jump ''doesn't'' happen, loops back to the start of MissileLoop}} |
|||
} |
} |
||
} |
} |
||
[[category:Decorate Generic Attack functions]] |
[[category:Decorate Generic Attack functions]]{{DEFAULTSORT:MonsterRefire}} |
||
Latest revision as of 12:18, 30 November 2024
native State A_MonsterRefire (int chance, statelabel label)
Usage
Calls A_FaceTarget and then checks whether the monster should abort its attack sequence and go to a different state. If the target is out of sight or dead, has a chance/255 chance to not jump to the label state sequence. Also aborts the attack if it hit the monster's ally.
Monster-specific functions such as A_CPosRefire, A_CrusaderRefire, A_SpidRefire and A_SentinelRefire, are variations of this function with predetermined chances (they also all jump to the "See" state sequence if the attack is to be aborted).
Parameters
- int chance
- Chance in the 0-255 range that the actor will continue attacking even if its target is dead or out of sight.
- StateLabel label
- Name of the state sequence to go to if the actor aborts its attack, for example "See".
Example
Class SuperZombie : ZombieMan { States { Missile: POSS E 10 A_FaceTarget; MissileLoop: // Intentional fall-through POSS FE 2 Bright A_PosAttack; POSS F 1 A_MonsterRefire(128, "See"); // 50% chance to jump to "See" if target is out of sight. loop; // If the jump doesn't happen, loops back to the start of MissileLoop } }