Flee Delay - check code

Bumbulla

Active Member
Hey,

all i did in the past had to to with php/sql, so im not sure if i did it right, pls take a look.
I thought to add a delay, after a nonwhitelisted pilot left system, until the bot start hunting again.

Changed the function ProcessState() in obj_Combat.

Added following on the top of the code, in the objectdef obj_Combat function:

variable bool wait_timex
Old code:

function ProcessState()
{
This.Override:Set[FALSE]

if ${This.CurrentState.NotEqual["INSTATION"]}
{
if ${_Me.ToEntity.IsWarpScrambled}
{
; TODO - we need to quit if a red warps in while we're scrambled -- cybertech
UI:UpdateConsole["Warp Scrambled: Ignoring System Status"]
}
elseif !${Social.IsSafe}
{
call This.Flee
This.Override:Set[TRUE]
}


if (!${Ship.IsAmmoAvailable} && ${Config.Combat.RunOnLowAmmo})
{
; TODO - what to do about being warp scrambled in this case?
call This.Flee
This.Override:Set[TRUE]
}
call This.ManageTank
}

switch ${This.CurrentState}
{
case INSTATION
if ${Social.IsSafe}
{
call Station.Undock
}
break
case IDLE
break
case FLEE
call This.Flee
This.Override:Set[TRUE]
break
case FIGHT
call This.Fight
break
}
}

New:

function ProcessState()
{
This.Override:Set[FALSE]

if ${This.CurrentState.NotEqual["INSTATION"]}
{
if ${_Me.ToEntity.IsWarpScrambled}
{
; TODO - we need to quit if a red warps in while we're scrambled -- cybertech
UI:UpdateConsole["Warp Scrambled: Ignoring System Status"]
}
elseif !${Social.IsSafe}
{
call This.Flee
This.Override:Set[TRUE]
This.wait_timex:Set[TRUE]
}
elseif ${wait_timex} == TRUE
{

wait 6000
This.wait_timex:Set[FALSE]
}



if (!${Ship.IsAmmoAvailable} && ${Config.Combat.RunOnLowAmmo})
{
; TODO - what to do about being warp scrambled in this case?
call This.Flee
This.Override:Set[TRUE]
}
call This.ManageTank
}

switch ${This.CurrentState}
{
case INSTATION
if ${Social.IsSafe}
{
call Station.Undock
}
break
case IDLE
break
case FLEE
call This.Flee
This.Override:Set[TRUE]
break
case FIGHT
call This.Fight
break
}
}
If im right the bot is running the loop again and again. So as long as there is a non listed pilot in system, the variable wait_time will always be set to TRUE, so when the last neutral left system the bot would wait 10 more minutes. Am i right or totaly wrong, or just wrong synthaxes?

regards
 
Last edited:

Bumbulla

Active Member
Just tested it, seems its working. Bot waits for 10min after the last pilot (white/blacklist) left, on ss cloaked until he starts ratting again. When im home i will add a random time, so its not the static 10min delay.
 
Top Bottom