Somethingonplayer: Difference between revisions
No edit summary  | 
				No edit summary  | 
				||
| Line 3: | Line 3: | ||
To kill the slimer from code, we can't just apply [[htextra]] as we would expect, the correct way to kill a facehugging slimer is this:  | To kill the slimer from code, we can't just apply [[htextra]] as we would expect, the correct way to kill a facehugging slimer is this:  | ||
<  | <pre>  | ||
     ifn player[].somethingonplayer -1  |      ifn player[].somethingonplayer -1  | ||
     {  |      {  | ||
| Line 10: | Line 10: | ||
         setp[].somethingonplayer -1  |          setp[].somethingonplayer -1  | ||
     }  |      }  | ||
</  | </pre>  | ||
[[Category:Player structure members]]  | [[Category:Player structure members]]  | ||
Latest revision as of 14:08, 3 December 2023
If a slimer is currently attached to the player, this holds the slimer's sprite ID. Otherwise, this is -1.
To kill the slimer from code, we can't just apply htextra as we would expect, the correct way to kill a facehugging slimer is this:
    ifn player[].somethingonplayer -1
    {
        seta[player[].somethingonplayer].htextra 1
        seta[player[].somethingonplayer].htg_t 0 0
        setp[].somethingonplayer -1
    }