Hey guys. Why doesn't this work? It's NEVER worked since the Bot update happened.
//Avoid close range fights if you don't have melee
if(%obj.hAvoidCloseRange)
{
//convert to brick units
%range = brickToMetric( %obj.hTooCloseRange )*%scale;
//Make the bot backpedal if he's too close and the weapon he's using isn't melee based.
if( %targDist <= %range && !%obj.getMountedImage(0).Melee)//vectordist(%obj.getPosition(),%targ.getPosition())
{
// %obj.setMoveY(-0.5);
%obj.setMoveY( -%obj.hMaxMoveSpeed/2 );
}
//even if it's melee, still don't want to be point blank most of the time
if(%obj.getMountedImage(0).melee)
{
%range = 2;
if( %targDist <= %range)// vectordist(%obj.getPosition(),%targ.getPosition())
{
%obj.setMoveY(-0.1);
}
}
}
}
Also, is there a way to do this while the bot is attacking it's target, therefore making it back-pedal as it shoots?
function AIPlayer::hRunAwayFromPlayer(%obj,%target)
{
%obj.clearAim();
%pos = %obj.getPosition();
%bPos = %target.getPosition();
%dif = vectorScale( vectorNormalize( vectorSub(%pos,%bPos) ),100);//was 50
//%vec = vectorNormalize( vectorSub(%pos,%bPos) );
%final = vectorAdd(%pos, getWords(%dif,0,1) SPC "0");
%final = vectorAdd(%final,"0 0 2");
%final = vectorAdd(%final, vectorScale(getRandom(-10,10) SPC getRandom(-10,10) SPC 0, 6) );
//setAimVector(%obj,%vec);
%obj.setAimLocation(%final);
%obj.setMoveY(%obj.hMaxMoveSpeed);
%obj.hDetectWall(1);
//hSpamHandsLoop(%obj);
}
And is it even possible to edit any of this since Blockland rewrites the code here to what it was before it was augmented? I think it does this because it's a core feature that Badspot doesn't want us screwin' up. Kinda sucks though. :(