Author Topic: scripts for bots and playertypes  (Read 838 times)

a script for a playertype that do (a specific)  sound loop when walking
also how to do a code that when a bot is following his enemy and somehow stuck because a brick is in his way to his enemy, will fake kill it or try to move right or left.
Thank you

could try looking at the rampage gamemode or the endlesszombie gamemode

Quote
could try looking at the rampage gamemode or the endlesszombie gamemode
Thanks.
I found a way to make some player types to do special footsteps sound, but I can't find a way to make it work with bots.
I was playing around with the NewEffects Addon:
Code: [Select]
package Dinofootstep
{
function gameConnection::spawnPlayer(%this,%data,%player,%slot,%io, %obj)
{
parent::spawnPlayer(%this);
%this.player.oldDatablock = %this.player.getDatablock();
if(%this.player.oldDatablock == BrachiosaurusJPHoleBot.getID() || %this.player.oldDatablock == IndominusRexHoleBot.getID() || %this.player.oldDatablock == SpinosaurusHoleBot.getID() || %this.player.oldDatablock == TyrannosaurusRexHoleBot.getID())
%this.player.DinofootLoop();
}
function Armor::onNewDataBlock(%this, %obj)
{
Parent::onNewDataBlock(%this, %obj);
%obj.updateDinofootsteps = %obj.schedule(0, "updateDinofootsteps");
}
function Player::updateDinofootsteps(%this, %lastVert)
{
cancel(%this.updateDinofootsteps);

  if (%this.getState() $= "Dead")
  {
  return;
  }

%velocity = %this.getVelocity();

%vert = getWord(%velocity, 2);
%horiz = vectorLen(setWord(%velocity, 2, 0));

if (%lastVert < $Dinofootsteps_MIN_LANDING && %vert >= 0)
{
%this.getDataBlock().onLand(%this);
}

%this.updateDinofootsteps = %this.schedule(32, "updateDinofootsteps", %vert);
}

function player::DinofootLoop(%this)
{
//echo("DinofootLoop WOOOOO!@#@#$@#4");
if($Dinofootsteps)
{
%pos = getWords(%this.getPosition(), 0, 1);
if(%this.f_lastPos $= getWords(%this.getPosition(), 0, 1) || %this.crouch || !%this.isOnGround())
{
//echo("same position");
//do nothing!
}
else if(!%this.isMounted())
{
//echo("diff position");
if(makePositive(getWord(%this.getVelocity(),0)) < 8 && makePositive(getWord(%this.getVelocity(),1)) < 8)
{
%this.playDinofootstep(1);
}
else
{
%this.playDinofootstep(2);
}

%this.f_lastPos = getWords(%this.getPosition(), 0, 1);
}
//echo("@#@#$@#%@#$@#$NUMBER 2");
%this.schedule(870, DinofootLoop);

//windNoiseLoop(%this);
}
}
How should the code look when I do the same for bots? thanks

Never mind, I figured it out by myself..