Blockland Welcome, Guest. Please login or register.
Did you miss your activation email?
November 19, 2017, 11:43:51 AM

Home Help Login Register
+  Blockland Forum
|-+  Blockland Forums
| |-+  Modification Help
| | |-+  Too close range?
Pages: [1]
Author Topic: Too close range?  (Read 456 times)
jackrobbman

« July 15, 2017, 09:36:43 PM »

Hey guys. Why doesn't this work? It's NEVER worked since the Bot update happened.

Code:
//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?

Code:
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. :(
Logged
Ad Bot

Full members do not see ads

Conan

« July 15, 2017, 11:53:20 PM »

this isnt a core feature, this is an addon written by rotondo. this is just how he wrote the bot code.

the avoid melee is purely for bots that 1) dont have a weapon that does damage and 2) dont have hMelee on (eg cant damage automatically with melee).

hRunAwayFromPlayer makes the bot turn around and run away so it wouldnt work in making bots keep range between themselves and a player they're fighting.

the reason your "augmentations" are being overwritten is probably cause you use the launcher, which overwrites all default stuff with the default versions every time you use it. you can make your changes stay by setting the .zip to read-only, or bypassing the launcher.
« Last Edit: July 16, 2017, 09:47:23 AM by Conan » Logged
jackrobbman

« July 16, 2017, 12:12:14 AM »

Oh. So the
Code:
hAvoidCloseRange = 1;
thing in the cs file for any bot is only for...melee wielders?
Logged
Conan

« July 16, 2017, 09:46:41 AM »

actually im conpletely wrong regarding avoid close range. its there in that code, very clealry commented.
Logged
jackrobbman

« July 16, 2017, 04:43:59 PM »

actually im conpletely wrong regarding avoid close range. its there in that code, very clealry commented.
Oh....hey...are you being sarcastic? I legit can't tell. XD
Logged
Conan

« July 16, 2017, 11:48:10 PM »

not sarcastic its my mistake

Code:
//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())
{

i didnt think it handled backpedaling i thought it just had bots run away.

set hAvoidCloseRange to 1 and it should work
Logged
jackrobbman

« July 17, 2017, 10:26:25 AM »

Yeah...that's actually the issue. It's already set to one on nearly every bot I have with the tooCloseRange set to seven, but it never works. I've tried increasing the tooCloseRange to like THIRTY and it still won't work. It only worked this one time when I'd changed a bot's playertype into a humongous mech (And I do mean humongous. Probably the biggest thing any player has ever seen in Blockland.) and it was still inconsistent at that. I think it may have only been back-pedaling because it's size made it difficult to see me. I done a lot of messing around but can't get them to quit strafe ramming me and other bot's I've evented to harm them on contact. (The onbotTouched event only works when the bot is touched by a player, so I have to start a slayer minigame and make slayer-bots. The game thankfully recognizes these as players. )

Is it possible for a code to execute too slow so that when the distance checks can't keep up with the bot's movement? Or is it the strafing?  I'll try turning the strafing off to see if that has any effect on the distance checks.
Logged
Conan

« July 17, 2017, 10:33:31 AM »

strafing wont mess with distance checking, but iirc the bot logic loop works on a 3 second timer (eg it decides something new to do/something to do differently every 3 seconds). and if im right, i know you can adjust this with some field on the bot datablock.

also note it does brickToMetric which might reduce the value of tooCloseRange. 7 TU is 14 studs, but 7m is like half that since iirc the default metric conversion is 1 blockhead's height = 2m
Logged
jackrobbman

« July 18, 2017, 12:56:13 PM »

strafing wont mess with distance checking, but iirc the bot logic loop works on a 3 second timer (eg it decides something new to do/something to do differently every 3 seconds). and if im right, i know you can adjust this with some field on the bot datablock.

also note it does brickToMetric which might reduce the value of tooCloseRange. 7 TU is 14 studs, but 7m is like half that since iirc the default metric conversion is 1 blockhead's height = 2m

Gotcha. I'll look into it.
Logged
Pages: [1]  


Login with username, password and session length

Powered by SMF 1.1.20 | SMF © 2013, Simple Machines
Page created in 0.02 seconds with 19 queries.