Author Topic: "NetConnection::ghostPushNonZero - bad arrayIndex" [bot hole]  (Read 996 times)

i've been attempting making bot holes that use the Sports Playertype, where the bot can hold right-click to go faster.



however, as it plays, i keep getting a console notice saying
Quote
NetConnection::ghostPushNonZero - bad arrayIndex



what does it mean? is it a problem? can it be fixed? should it?
it's a bit worrying for me


show us your code

datablock fxDTSBrickData (BrickTestBot_HoleSpawnData)
{
   brickFile = "Add-ons/Bot_Hole/4xSpawn.blb";
   category = "Special";
   subCategory = "Holes";
   uiName = "Test Hole";
   iconName = "Add-Ons/Bot_Blockhead/icon_Test";

   bricktype = 2;
   cancover = 0;
   orientationfix = 1;
   indestructable = 1;

   isBotHole = 1;
   holeBot = "PlayerSportHoleBot";
};

datablock PlayerData(PlayerSportHoleBot : PlayerStandardArmor)
{
      isSportPlayer = 1;
   runForce = 50 * 90;
   runEnergyDrain = 0;
   minRunEnergy = 0;
   maxForwardSpeed = 8;
   maxBackwardSpeed = 5;
   maxSideSpeed = 5;

   maxForwardCrouchSpeed = 3;
   maxBackwardCrouchSpeed = 2;
   maxSideCrouchSpeed = 2;

   jumpForce = 9 * 90; //8.3 * 90;
   jumpEnergyDrain = 0;
   minJumpEnergy = 0;
   jumpDelay = 0;

   runSurfaceAngle  = 55;
   jumpSurfaceAngle = 55;

   minJetEnergy = 10;
   jetEnergyDrain = 10;
   canJet = 0;

   rechargeRate = 0.5;

   uiName = "Sport Player";
   showEnergyBar = true;

   attackpower = 10;
   rideable = false;
   canRide = true;

   maxdamage = 100;//Bot Health
   jumpSound = "";//Removed due to bots jumping a lot
   
   //Hole Attributes
   isHoleBot = 1;

   //Spawning option
   hSpawnTooClose = 0;//Doesn't spawn when player is too close and can see it
     hSpawnTCRange = 8;//above range, set in brick units
   hSpawnClose = 0;//Only spawn when close to a player, can be used with above function as long as hSCRange is higher than hSpawnTCRange
     hSpawnCRange = 32;//above range, set in brick units

   hType = Enemy; //Enemy,Friendly, Neutral
     hNeutralAttackChance = 0; //0 to 100, Chance that this type will attack neutral bots, ie horses/vehicles/civilians
   //can have unique types, national socialists will attack zombies but national socialists will not attack other bots labeled national socialist
   hName = "Blockhead";//cannot contain spaces
   hTickRate = 3000;
   
   //Wander Options
   hWander = 1;//Enables random walking
     hSmoothWander = 1;//This is in addition to regular wander, makes them walk a bit longer, and a bit smoother
     hReturnToSpawn = 1;//Returns to spawn when too far
     hSpawnDist = 48;//Defines the distance bot can travel away from spawnbrick
     hGridWander = 0;//Locks the bot to a grid, overwrites other settings
   
   //Searching options
   hSearch = 1;//Search for Players
     hSearchRadius = 64;//in brick units
     hSight = 1;//Require bot to see player before pursuing
     hStrafe = 1;//Randomly strafe while following player
   hSearchFOV = 0;//if enabled disables normal hSearch
     hFOVRange = 0.7; // determines the angle we can see the player at, 0.7 is about normal fov for players, if 0 we can see all in front, if 1 we could only see someone perfectly ahead, can be negative
     // hFOVRadius = 6; // no longer used, we now use searchRadius
     hHearing = 1;//If it hears a player it'll look in the direction of the sound

     hAlertOtherBots = 1;//Alerts other bots when he sees a player, or gets attacked

   //Attack Options
   hMelee = 0;//Melee
     hAttackDamage = 15;//Melee Damage
   hShoot = 1;
     hWep = "gunItem";
     hShootTimes = 4;//Number of times the bot will shoot between each tick
     hMaxShootRange = 256;//The range in which the bot will shoot the player
     hAvoidCloseRange = 1;//
      hTooCloseRange = 7;//in brick units

   //Misc options
   hActivateDirection = 0; // 0 1 2, determines the direction you have to face the bot to activate him, both, front back
   hMoveSlowdown = 0; // bool, determines wether the bot will slow down when following enemies
   hAvoidObstacles = 1;
   hSuperStacker = 0;//When enabled makes the bots stack a bit better, in other words, jumping on each others heads to get to a player
   hSpazJump = 0;//Makes bot jump when the user their following is higher than them

   hAFKOmeter = 1;//Determines how often the bot will wander or do other idle actions, higher it is the less often he does things

   hIdle = 1;// Enables use of idle actions, actions which are done when the bot is not doing anything else
     hIdleAnimation = 1;//Plays random animations/emotes, sit, click, love/hate/etc
     hIdleLookAtOthers = 1;//Randomly looks at other players/bots when not doing anything else
       hIdleSpam = 1;//Makes them spam click and spam hammer/spraycan
     hSpasticLook = 1;//Makes them look around their environment a bit more.
   hEmote = 1;
};

function PlayerSportHoleBot::onAdd(%this,%obj)
{
   armor::onAdd(%this,%obj);

   //Appearance Blockhead
   %obj.llegColor =  "0.2 0 0.8 1";
   %obj.secondPackColor =  "0 0.435 0.831 1";
   %obj.lhand =  "0";
   %obj.hip =  "0";
   %obj.faceName =  "smiley";
   %obj.rarmColor =  "0.9 0 0 1";
   %obj.hatColor =  "1 1 1 1";
   %obj.hipColor =  "0.2 0 0.8 1";
   %obj.chest =  "0";
   %obj.rarm =  "0";
   %obj.packColor =  "0.2 0 0.8 1";
   %obj.pack =  "0";
   %obj.decalName =  "AAA-None";
   %obj.larmColor =  "0.9 0 0 1";
   %obj.secondPack =  "0";
   %obj.larm =  "0";
   %obj.chestColor =  "1 1 1 1";
   %obj.accentColor =  "0.990 0.960 0 0.700";
   %obj.rhandColor =  "1 0.878 0.611 1";
   %obj.rleg =  "0";
   %obj.rlegColor =  "0.2 0 0.8 1";
   %obj.accent =  "1";
   %obj.headColor =  "1 0.878 0.611 1";
   %obj.rhand =  "0";
   %obj.lleg =  "0";
   %obj.lhandColor =  "1 0.878 0.611 1";
   %obj.hat =  "0";

   GameConnection::ApplyBodyParts(%obj);
   GameConnection::ApplyBodyColors(%obj);
}

function PlayerSportHoleBot::onBotLoop( %this, %obj )
{
   // echo( "Blockhead onLoop" );
   //parent::onBotLoop( %this, %obj );
   //%obj.hJet(2000);
   //Called every cycle
   //Useful for doing unique behaviors during normal loop
}

function PlayerSportHoleBot::onBotCollision( %this, %obj, %col, %normal, %speed )
{
   // echo( "Blockhead onCollision" );
   //Called once every second the object is colliding with something
}

function PlayerSportHoleBot::onBotFollow( %this, %obj, %targ )
{
   // echo( "Blockhead onFollow" );
   //Called when the target follows a player each tick, or is running away
}

function PlayerSportHoleBot::onBotDamage( %this, %obj, %source, %pos, %damage, %type )
{
   // echo( "Blockhead onDamage" );
   //Called when the bot is being damaged
}




















//sports player functionality
//Sport player datablock, can jet while jumping and crouching, "tackling" so to speak

function PlayerSportHoleBot::onTrigger(%this, %obj, %trigger, %val)
{
   if(%trigger == 4 && %val == 1 && !%obj.hasSportBall)
   {
      %obj.hesOnFire = 1;
      delaySportPlayerCheck(%obj, 1);
   }

   parent::onTrigger(%this, %obj, %trigger, %val);
}

// shoe fire effect
datablock ShapeBaseImageData( HesOnFireLImage )
{
   shapeFile = "base/data/shapes/empty.dts";
   emap = false;

   mountPoint = 4;//$HeadSlot;

   offset = "0 -0.3 0.1";
   rotation = "1 0 0 180";

   stateName[0]               = "Ready";
   stateTransitionOnTimeout[0]      = "FireA";
   stateTimeoutValue[0]         = 0.01;

   stateName[1]               = "FireA";
   stateTransitionOnTimeout[1]      = "Ready";
   stateWaitForTimeout[1]         = True;
   stateTimeoutValue[1]         = 35;
   stateEmitter[1]               = PlayerJetEmitter;
   stateEmitterTime[1]            = 35;

   // stateName[2]               = "Done";
   // stateScript[2]               = "onDone";
};

datablock ShapeBaseImageData( HesOnFireRImage )
{
   shapeFile = "base/data/shapes/empty.dts";
   emap = false;

   mountPoint = 3;//$HeadSlot;

   offset = "0 -0.3 0.1";
   rotation = "1 0 0 180";

   stateName[0]               = "Ready";
   stateTransitionOnTimeout[0]      = "FireA";
   stateTimeoutValue[0]         = 0.01;

   stateName[1]               = "FireA";
   stateTransitionOnTimeout[1]      = "Ready";
   stateWaitForTimeout[1]         = True;
   stateTimeoutValue[1]         = 35;
   stateEmitter[1]               = PlayerJetEmitter;
   stateEmitterTime[1]            = 35;

   // stateName[2]               = "Done";
   // stateScript[2]               = "onDone";
};

datablock PlayerData(PlayerSportTurboHoleBot : PlayerStandardArmor)
{
   isTurboSportPlayer = 1;
   runForce = 100 * 90;
   runEnergyDrain = 0;
   minRunEnergy = 0;
   maxForwardSpeed = 12;
   maxBackwardSpeed = 8;
   maxSideSpeed = 12;

   maxForwardCrouchSpeed = 7;
   maxBackwardCrouchSpeed = 6;
   maxSideCrouchSpeed = 6;

   jumpForce = 12 * 90; //8.3 * 90;
   jumpEnergyDrain = 0;
   minJumpEnergy = 0;
   jumpDelay = 0;

   runSurfaceAngle  = 55;
   jumpSurfaceAngle = 55;

   minJetEnergy = 10;
   jetEnergyDrain = 8;
   canJet = 0;

   rechargeRate = -1.0;

   uiName = "";
   showEnergyBar = true;
};
function PlayerSportTurboHoleBot::onTrigger(%this, %obj, %trigger, %val)
{
   if(%trigger == 4 && %val == 0)
   {
      delaySportPlayerCheck(%obj);
      %obj.hesOnFire = 0;
   }
   parent::onTrigger(%this, %obj, %trigger, %val);
}

//
function delaySportPlayerCheck( %obj, %type )
{
   // make sure we're not dead
   if(%obj.isDisabled())
      return;

   // cancel the last sport schedule if there was one
   cancel(%obj.sportPlayerSched);
  
   %dataBlock = %obj.getDataBlock();
  
   if( %type != 1 && %dataBlock != PlayerSportTurboHoleBot.getID() )
   {
      // he's not on fire :(
      %obj.unMountImage( 2 );
      %obj.unMountImage( 3 );
      
      return;
   }
  
   if(%type == 1)
   {
      %obj.setDataBlock("PlayerSportTurboHoleBot");
      
      // color the shoes & peglegs nba jam style
      // should maybe add some effect?
      %obj.setNodeColor("lshoe", "1 0 0 1");
      %obj.setNodeColor("rshoe", "1 0 0 1");
      
      %obj.setNodeColor("lpeg", "1 0 0 1");
      %obj.setNodeColor("rpeg", "1 0 0 1");
      
      // he's on fire!
      %obj.mountImage( HesOnFireLImage, 2 );
      %obj.mountImage( HesOnFireRImage, 3 );
      
      %obj.sportPlayerSched = schedule(%obj.getEnergyLevel()*32.5, %obj, delaySportPlayerCheck,%obj);
   }
   else
   {
      // set the player back to normal
      %obj.setDataBlock("PlayerSportHoleBot");
      //%obj.client.applyBodyColors(); //don't need it for some reason
      
      // he's not on fire :(
      %obj.unMountImage( 2 );
      %obj.unMountImage( 3 );
   }
}

Not the answer to your problem, but you definitely don't want to overwrite the delaySportPlayerCheck function, because then the regular sport player isn't going to function properly.

Not the answer to your problem, but you definitely don't want to overwrite the delaySportPlayerCheck function, because then the regular sport player isn't going to function properly.
yeah i want to use the idea of sports player for other bot concepts




but first i have to know the truth about this error

note:


i found out that this also occurs if you enable Item_Sports, and make events to change the playertype of a bot to the Sports Player from Item_Sports


then you'll see netconnection::ghostpushnonzero and such


so i'm pretty sure that this error isn't necessarily harmful, i suppose