Class UseSlotMachineSpec
Specifies an action that makes an NPC use a slot machine at a scheduled time. Supports single spins, multiple spins, time-based sessions, or gambling until broke.
public sealed class UseSlotMachineSpec : IScheduleActionSpec
- Inheritance
-
UseSlotMachineSpec
- Implements
- Inherited Members
- Extension Methods
Remarks
This action creates a custom schedule entry that makes the NPC walk to a slot machine location and play it according to the specified session mode. The NPC will use cash from their inventory, and any winnings will be added back to their inventory.
Constructors
UseSlotMachineSpec()
public UseSlotMachineSpec()
Properties
BetAmount
Gets or sets the bet amount in dollars.
public int BetAmount { get; set; }
Property Value
- int
The amount to bet per spin, in dollars.
Remarks
Common bet amounts are 5, 10, 25, 50, or 100. The NPC must have this amount in their inventory (as cash items) to use the machine.
Building
Gets or sets the optional building that contains the slot machine.
public Building Building { get; set; }
Property Value
- Building
The building wrapper, or
nullto auto-detect or skip building entry.
Remarks
If specified, the NPC will first enter this building before walking to the slot machine. This is useful when the slot machine is inside a building and the NPC needs to enter first. If not specified, the system will attempt to pathfind directly to the slot machine position.
EndTime
Gets or sets the end time in minutes from midnight when using time-based session modes.
public int EndTime { get; set; }
Property Value
- int
The end time in minutes (0-1439 for a 24-hour day). Default is 0.
Remarks
Used with UntilTime and UntilTimeOrBroke.
MachinePosition
Gets or sets the world position of the slot machine to use.
public Vector3 MachinePosition { get; set; }
Property Value
- Vector3
The 3D position of the slot machine in world space.
Remarks
The NPC will search for the nearest slot machine to this position. Ensure the position is accurate to avoid the NPC using the wrong machine.
MaxSearchDistance
Gets or sets the maximum search distance from the machine position.
public float MaxSearchDistance { get; set; }
Property Value
- float
The search radius in world units. Default is 5.0.
Name
Gets or sets the optional name for this action.
public string Name { get; set; }
Property Value
- string
The action name, or
nullto use the default name "UseSlotMachine".
SessionMode
Gets or sets the gambling session mode.
public GamblingSessionMode SessionMode { get; set; }
Property Value
- GamblingSessionMode
The session mode that determines how long the NPC gambles. Default is SingleSpin.
Remarks
SingleSpin: Play once and stop.
SpinCount: Play until SpinCount spins are completed.
UntilTime: Play until EndTime is reached.
UntilBroke: Play until the NPC can't afford another bet.
UntilTimeOrBroke: Play until EndTime OR out of cash.
SpinCount
Gets or sets the number of spins to play when using SpinCount.
public int SpinCount { get; set; }
Property Value
- int
The number of spins. Default is 1.
StartTime
Gets or sets the time when this action should start, in minutes from midnight.
public int StartTime { get; set; }
Property Value
- int
The start time in minutes (0-1439 for a 24-hour day).
TimeBetweenSpins
Gets or sets the time to wait between spins in seconds.
public float TimeBetweenSpins { get; set; }
Property Value
- float
The delay between spins in seconds. Default is 10.0 seconds.
Remarks
This delay occurs after the slot machine finishes spinning and displaying results, before the NPC starts the next spin. This makes the gambling behavior more realistic.