Announcement

Collapse
No announcement yet.

need help with ai

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    need help with ai

    Well I did have it setup to have a crowd like system of zombies running at the player and eating them, but the latest build of udk f'ed me over on that my zombies wont spawn with the arch type list and when i make them spawn as bots they wont kill the player and drain the health to -50. So I,m forced to make them bots T_T that only fake damage the player. So was woundering if anyone knows any simple. AI tutorials that make a bot ( or crowds that would be sweet to have again love fighting off thousands of zombies) find the play, and I don't just mean oh ill stand here till I see a player, actually find and move to the player and slowly damage them. Or if someone wanted write one that would be nice cause I'm horrible. With AI programming that would be great. But any help with this matter would be greatly appreciated.

    Ill be posting my code of my bots current script allong with its pawn and mybe someone can tell me what I would need to do with it to get compatible with the crowd system and possibly improving. It. But it will take a bit I'm on a mobile device

    #2
    The bot script I was using

    class TestZombiePawn extends UTPawn
    Placeable;

    var Pawn P; // variable to hold the pawn we bump into

    // members for the custom mesh
    var SkeletalMesh defaultMesh;
    var MaterialInterface defaultMaterial0;
    var AnimTree defaultAnimTree;
    var array<AnimSet> defaultAnimSet;
    var AnimNodeSequence defaultAnimSeq;
    var PhysicsAsset defaultPhysicsAsset;

    simulated function SetCharacterClassFromInfo(class<UTFamilyInfo> Info)
    {
    Mesh.SetSkeletalMesh(defaultMesh);
    Mesh.SetMaterial(0,defaultMaterial0);
    Mesh.SetPhysicsAsset(defaultPhysicsAsset);
    Mesh.AnimSets=defaultAnimSet;
    Mesh.SetAnimTreeTemplate(defaultAnimTree);

    }

    simulated event Bump( Actor Other, PrimitiveComponent OtherComp, Vector HitNormal )
    {
    `Log("Bump");

    Super.Bump( Other, OtherComp, HitNormal );

    if ( (Other == None) || Other.bStatic )
    return;

    P = Pawn(Other); //the pawn we might have bumped into

    if ( P != None) //if we hit a pawn
    {
    if (P.Health >1) //as long as pawns health is more than 1
    {
    P.Health --; // eat brains! mmmmm
    }
    }
    }

    defaultproperties
    {
    defaultMesh=SkeletalMesh'CH_IronGuard_Male.Mesh.SK _CH_IronGuard_MaleA'
    defaultAnimTree=AnimTree'CH_AnimHuman_Tree.AT_CH_H uman'
    defaultAnimSet(0)=AnimSet'CH_AnimHuman.Anims.K_Ani mHuman_BaseMale'
    defaultPhysicsAsset=PhysicsAsset'CH_AnimCorrupt.Me sh.SK_CH_Corrupt_Male_Physics'

    Begin Object Name=WPawnSkeletalMeshComponent
    AnimTreeTemplate=AnimTree'CH_AnimHuman_Tree.AT_CH_ Human'
    End Object

    RagdollLifespan=180.0

    ControllerClass=class'TestZombieBot'

    Comment


      #3
      My bad the above script is the pawn I was using here is the AI

      class TestZombieBot extends GameAIController;

      var Pawn thePlayer; //variable to hold the target pawn

      simulated event PostBeginPlay()
      {
      super.PostBeginPlay();

      }

      event SeePlayer(Pawn SeenPlayer) //bot sees player
      {
      if (thePlayer ==none) //if we didnt already see a player
      {
      thePlayer = SeenPlayer; //make the pawn the target
      GoToState('Follow'); // trigger the movement code
      }
      }

      state Follow
      {

      Begin:

      if (thePlayer != None) // If we seen a player
      {

      MoveTo(thePlayer.Location); // Move directly to the players location
      GoToState('Looking'); //when we get there
      }

      }

      state Looking
      {
      Begin:
      if (thePlayer != None) // If we seen a player
      {

      MoveTo(thePlayer.Location); // Move directly to the players location
      GoToState('Follow'); // when we get there
      }

      }

      defaultproperties
      {

      }

      Comment

      Working...
      X