Dayz Build 1.29.163047, Scripts Rev. 123548
Dayz Code Explorer by Zeroy
Loading...
Searching...
No Matches
bot_stancerandomizer.c
Go to the documentation of this file.
1class BotStanceRandomizer extends BotStateBase
2{
4
5 float m_dtAccumulator = 0.0;
6
7 void BotStanceRandomizer(Bot bot = NULL, BotStateBase parent = NULL)
8 {
9 }
10
11 override void OnEntry (BotEventBase e)
12 {
13 m_dtAccumulator = 0.0;
14
15 super.OnEntry(e);
16 }
17
18 override void OnExit (BotEventBase e)
19 {
20 m_dtAccumulator = 0.0;
21
22 super.OnExit(e);
23 }
24
25 override void OnUpdate (float dt)
26 {
27 super.OnUpdate(dt);
28
29 m_dtAccumulator += dt;
30
31 GetPlayerOwner().GetMovementState(m_State);
32
33 HumanCommandMove cm = GetPlayerOwner().GetCommand_Move();
34 if (cm && !cm.IsChangingStance())
35 {
36 if (m_State.m_iStanceIdx == DayZPlayerConstants.STANCEIDX_PRONE)
37 {
38 cm.ForceStance(DayZPlayerConstants.STANCEIDX_ERECT);
39 }
40 else
41 {
42 cm.ForceStance(DayZPlayerConstants.STANCEIDX_PRONE);
43 }
44 }
45 }
46};
represents event that triggers transition from state to state
Definition botevents.c:5
Definition bot.c:19
represent weapon state base
Definition bot_hunt.c:16
ref HumanMovementState m_State
void BotStanceRandomizer(Bot bot=NULL, BotStateBase parent=NULL)
void BotStateBase(Bot bot=NULL, BotStateBase parent=NULL)
nested state machine (or null)
Definition botstates.c:17
PlayerBase GetPlayerOwner()
Definition botstates.c:19
float m_dtAccumulator
Definition bot_hunt.c:18
override void OnExit(BotEventBase e)
override void OnEntry(BotEventBase e)
override void OnUpdate(float dt)
proto native void ForceStance(int pStanceIdx)
pStanceIds is one of STANCEIDX_ERECT,STANCEIDX_CROUCH,STANCEIDX_PRONE,STANCEIDX_RAISEDERECT,...
proto native bool IsChangingStance()
returns true if character is changing stance
DayZPlayerConstants
defined in C++
Definition dayzplayer.c:602