I have update guardsman to 1.2.5 though it is a basic version only containing two teams and the 3 original guard types. The other 2 guard types listed are coded but can't be spawned without cheating. There is one current know bug and that SMP the team finder doesn't work so guards will kill all players. Suggest server owners wait till i update with patch. Though you can test it and find further bugs or problems. I should have newer version updates fast now that i have all the guard code done. Next thing on the too do list is finishing the other 2 guard types, adding in the other 2 teams, and maybe find a way to define custom teams.
Even though i already solved this i found where the original problem came from.
public EntityGuard(World par1World)
{
this(par1World, 0, 0);
this.moveSpeed = 0.23F;
this.attackStrength = 4;
//nav
this.getNavigator().setBreakDoors(true);
//AI tasks
this.tasks.addTask(0, new EntityAISwimming(this));
if(getProfession() == 1){
this.tasks.addTask(4, new EntityAIArrowAttack(this, this.moveSpeed, 1, 30));}
this.tasks.addTask(1, new EntityAIBreakDoor(this));
this.tasks.addTask(2, new EntityAIAttackOnCollide(this, EntityPlayer.class, this.moveSpeed, false));
this.tasks.addTask(3, new EntityAIAttackOnCollide(this, EntityMob.class, this.moveSpeed, true));
this.tasks.addTask(4, new EntityAIMoveTwardsRestriction(this, this.moveSpeed));
this.tasks.addTask(6, new EntityAIWander(this, this.moveSpeed));
this.tasks.addTask(7, new EntityAIWatchClosest(this, EntityPlayer.class, 8.0F));
this.tasks.addTask(7, new EntityAILookIdle(this));
//AI targets
this.targetTasks.addTask(1, new EntityAIHurtByTarget(this, false));
this.targetTasks.addTask(2, new EntityAINearestAttackableTarget(this, EntityPlayer.class, 16.0F, 0, false));
this.targetTasks.addTask(2, new EntityAINearestAttackableTarget(this, EntityMob.class, 16.0F, 0, true));
}
public EntityGuard(World par1World, int par2, int par3) {
super(par1World, par2, par3);
}
i use a starter constructor (or what every its called) to set the team and type till they can get loaded. Using this causes the AI tasks not too be loaded with it. So to fix the problem i placed the Ai tasks into the starter constructor so when the entity gets made on world load so does his AI task list. Though i think this effect newly made entities in the opposite way.
From what i've been told datawatchers are used to Find and set values so that they can be updated to & from ssp & smp. However i'm unsure on this so what i'm asking can someone explain there use. If the Id # will conflict with other class. If they do is there a list of what minecraft uses and other mods use. If not are they class or entity dependent. Also can other things than Integers be used with dataWatchers like for example arrays or strings.
thank you for trying to help me. I got it working now, though i bet i'll break it a few more time before done. What I did was recode the class into two separate class. Very similar to how EntityMob.class works as a base for EntityZombie.class. Think this will work better out for me anyways by lettering me extend my base class to make new NPC mobs rather than extending creature class and coding in all the same stuff. You think you can help me with a few other things? Even though it works i still can't get the weapons to render in hand, i'm looking for away to get a mob to render like a skeleton, look into how to make an API so players can make there own guards and teams to extend my mod.
didn't effect anything. And to further test i removed all other tasks but target tasks. also i'll toy with the order once i get it fixed for the most realistic reaction order. This is still very odd, my other mobs works just fine but this one fails.
since a player can have a cloak look in the renderPlayer.class, place the code you find in your own custom render. Might also want to check the model class as well. Post what you find here i'm interested myself in how to add cloaks to mobs.
in redstonewire class it checks all side, redstone repeater class does this as well. though i don't understand it enough myself to explain it or point out how to use it. But..
Here is some of the code that might help get you in the right direction
when i started coding them doing the basic set up of a hostile mob i had them attack anything but themselves. This was working just fine and the same after i got some code going. After i started toying with who and how they attacked it stopped working. So i reverted the changes too when it was working, but the guards still wouldn't attack anything. I'm trying to fix it so they go back to attacking anything in sight but themselves. Also figure out why they wouldn't attack in the first place so i can correct next time this happens.
seems the only progress i made today was answering other peoples posts. The progress i have made on the code was to break it further now guard will not wonder around. Its almost as if the AI stopped working in the entity. I would say this would be a problem with my code in general by my other entities attack fine. the code is rather the same for attacking and finding targets. So i'm at a lose on ideals how to fix this today.
this.targetTasks.addTask(2, new EntityAINearestAttackableTarget(this, EntityPlayer.class, 16.0F, 0, false));
16.0F is the distance to find target
0 is chance of targeting according to the code.
false is shouldn't attack instantly, true if should
EntityPlayer.class is the target
i think he is looking for a way to set the drop rate of an item and the drop rate of a rare item from his block.
@Mastermiine try looking at BlockRedstoneOre for random ammount drop and EntitySkeleton for rare drops. Or you could code a method that gets a random number then does a switch statement to match that number to a droped item and ammount
0
0
I have update guardsman to 1.2.5 though it is a basic version only containing two teams and the 3 original guard types. The other 2 guard types listed are coded but can't be spawned without cheating. There is one current know bug and that SMP the team finder doesn't work so guards will kill all players. Suggest server owners wait till i update with patch. Though you can test it and find further bugs or problems. I should have newer version updates fast now that i have all the guard code done. Next thing on the too do list is finishing the other 2 guard types, adding in the other 2 teams, and maybe find a way to define custom teams.
0
0
i use a starter constructor (or what every its called) to set the team and type till they can get loaded. Using this causes the AI tasks not too be loaded with it. So to fix the problem i placed the Ai tasks into the starter constructor so when the entity gets made on world load so does his AI task list. Though i think this effect newly made entities in the opposite way.
0
0
From what i've been told datawatchers are used to Find and set values so that they can be updated to & from ssp & smp. However i'm unsure on this so what i'm asking can someone explain there use. If the Id # will conflict with other class. If they do is there a list of what minecraft uses and other mods use. If not are they class or entity dependent. Also can other things than Integers be used with dataWatchers like for example arrays or strings.
0
0
0
0
Here is some of the code that might help get you in the right direction
par2 is x, par3 is y, par4 is z as far as i know.
usual a method like this will get you those parameters
but i think there are other ways. Try reading down block.class there might be a method in there.
0
0
0
16.0F is the distance to find target
0 is chance of targeting according to the code.
false is shouldn't attack instantly, true if should
EntityPlayer.class is the target
0
@Mastermiine try looking at BlockRedstoneOre for random ammount drop and EntitySkeleton for rare drops. Or you could code a method that gets a random number then does a switch statement to match that number to a droped item and ammount
0