EVENT USESTEROIDS: Difference between revisions

From EDukeWiki
Jump to navigation Jump to search
mNo edit summary
Clarify description of return value and add example
 
Line 4: Line 4:
This [[event]] is called when the player presses the button assigned to Use Steroids (''R'' key by default).
This [[event]] is called when the player presses the button assigned to Use Steroids (''R'' key by default).


Set gamevar [[RETURN]] to any non-zero value to ignore the key.
Set gamevar [[RETURN]] to any non-zero value to skip the hardcoded effects of the steroids activation. However, note that you can still define your own behavior for the Steroids item within the event.
 
The following CON code would replicate the hardcoded Steroids behavior:
 
  var temp_steroids 0 0
 
  onevent EVENT_USESTEROIDS
      ife player[].steroids_amount 400
      {
          getp[].steroids_amount temp_steroids
          sub temp_steroids 1
          setp[].steroids_amount temp_steroids
          sound DUKE_TAKEPILLS
          quote 12
      }
 
      ifg player[].steroids_amount 0
          setp[].inven_icon 2
 
      set RETURN 1
  endevent


[[Category:Events]]
[[Category:Events]]

Latest revision as of 12:31, 6 April 2024

Event ID player# THISACTOR RETURN
EVENT_USESTEROIDS player that executed the input player->i 1 value

EVENT_USESTEROIDS is a Game Event.

This event is called when the player presses the button assigned to Use Steroids (R key by default).

Set gamevar RETURN to any non-zero value to skip the hardcoded effects of the steroids activation. However, note that you can still define your own behavior for the Steroids item within the event.

The following CON code would replicate the hardcoded Steroids behavior:

 var temp_steroids 0 0
 
 onevent EVENT_USESTEROIDS
     ife player[].steroids_amount 400
     {
         getp[].steroids_amount temp_steroids
         sub temp_steroids 1
         setp[].steroids_amount temp_steroids
         sound DUKE_TAKEPILLS
         quote 12
     }
 
     ifg player[].steroids_amount 0
         setp[].inven_icon 2
 
     set RETURN 1
 endevent