Jump to content
Search In
  • More options...
Find results that contain...
Find results in...

My entities won't move with AI. I'm stumped...


Recommended Posts

So, I figured out on my own that entities need to make yet another initialization call.

For example:

    protected void func_110147_ax()

    {

        super.func_110147_ax();

        this.func_110148_a(SharedMonsterAttributes.field_111267_a).func_111128_a(this.getMaxHealth()); //Health

        this.func_110148_a(SharedMonsterAttributes.field_111263_d).func_111128_a(this.moveSpeed); //Movespeed

        this.func_110148_a(SharedMonsterAttributes.field_111264_e).func_111128_a(12.0D); //Attack Strength

    }

 

I think I pretty much nailed what each of the fields are, with 111263_d being move speed.

The EntityAI functions are getting called, and I traced waaaaay down into them to verify that

yes indeed a valid path is returned and set. The problem, I found, is that when it gets back up

to onLivingUpdate in EntityLivingBase the motionX and motionZ fields are 0. Hence, no movement.

 

What am I missing to make my entities move?

This all worked just fine in 1.5.

It looked like all I had to do was add the func_110147_ax() routine.

 

Yes, I figured out the rendering. They all now render and just stand there looking around.

But they won't move... :(

 

Help?

 

Odds are good I've been programming since before you were born. Yeah. I'm OLD school.

Link to post
Share on other sites

I don't think the problem is with func_110147_ax(), I've played around with that quite a bit and never had any problems. AI appears to work somewhat differently now, I suspect your problem has to do with that.

Link to post
Share on other sites

The only work I did with AI was taking existing mobs and removing AI rules or adding ones in I found in another existing mob (or tweaking the values passed).

 

By calling the superclass's AI setups, you've probably buggered something.  Just go into the super class and copy what you need (and ONLY what you need) to your class.

Apparently I'm a complete and utter jerk and come to this forum just like to make fun of people, be confrontational, and make your personal life miserable.  If you think this is the case, JUST REPORT ME.  Otherwise you're just going to get reported when you reply to my posts and point it out, because odds are, I was trying to be nice.

 

Exception: If you do not understand Java, I WILL NOT HELP YOU and your thread will get locked.

 

DO NOT PM ME WITH PROBLEMS. No help will be given.

Link to post
Share on other sites

I just started modding and 1.6 is the only place I know a little. I'm planning to play with the AI and if it's possible to do what I want, maybe I'll work on it.

 

I think you should be more specific about what are you trying to do. It's seems you're moving in something deeper in the internals and it might bug something as Draco18s said.

 

I've extended an EntityCreature and added a few AI tasks (as Villager). In few steps a managed to create a FollowTarget AI that makes the mob follow a PlayerEntity if it come close enough. The behavior is just the opposite of AvoidEntity AI. Btw you can pass the speed to those AI.

 

You may know all that, but I don't follow your problem...

 

 

Link to post
Share on other sites

I found that you are now required to add more move code:

 

    /**

    * Called to update the entity's position/logic.

    */

    public void onUpdate()

    {

    //RESET SPEED BECAUSE SOMEONE CLEARS IT EVERY ITERATION -- BUG!!!!

    this.func_110148_a(SharedMonsterAttributes.field_111263_d).func_111128_a(this.moveSpeed); //Movespeed

    super.onUpdate();

    }

 

Where this.moveSpeed is private float moveSpeed = 0.35f; //Whatever speed you want.

 

The EntityAI*() routines are now RELATIVE speeds. Instead of passing in a speed like they used to,

they now take a multiplier. Greater than 1 for faster (IE 1.25d), or less than one for slower (IE 0.75d).

 

 

 

Odds are good I've been programming since before you were born. Yeah. I'm OLD school.

Link to post
Share on other sites

The EntityAI*() routines are now RELATIVE speeds. Instead of passing in a speed like they used to,

they now take a multiplier. Greater than 1 for faster (IE 1.25d), or less than one for slower (IE 0.75d).

 

About time.  It makes SO much more sense that way.

Apparently I'm a complete and utter jerk and come to this forum just like to make fun of people, be confrontational, and make your personal life miserable.  If you think this is the case, JUST REPORT ME.  Otherwise you're just going to get reported when you reply to my posts and point it out, because odds are, I was trying to be nice.

 

Exception: If you do not understand Java, I WILL NOT HELP YOU and your thread will get locked.

 

DO NOT PM ME WITH PROBLEMS. No help will be given.

Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.



×
×
  • Create New...

Important Information

By using this site, you agree to our Privacy Policy.