Posted November 21, 20168 yr Hello@All, i got a small problem, i got the mod "CustomNPCs" , i created a custom sword which cause "FireDamage" and when i give the sword to the NPC to use, when he hits the enemy he dont get the "caused damage by the sword + firedamage isnt there" , so well the "Sword" dont cause anything ... it is just there as "Dekoration" , so is it my error or just a custom entity cant use a sword with hes abilities? i mean, i would create easy and custom human and give him the weapon in hes hand, but will it cause the damage given by the sword etc...?
November 21, 20168 yr I suggest you create your own damage source with that custom death message and program it into the mob. I haven't done this my self, but it's the most help I can provide you with.
November 21, 20168 yr Author I suggest you create your own damage source with that custom death message and program it into the mob. I haven't done this my self, but it's the most help I can provide you with. hmm i prefer to give him an "itemSword" to use and "onleftclick" it does its effect .... isnt that normaly working?
November 22, 20168 yr @terraya Mobs can't click. If you have a weapon that does something when you hit something else, it won't work when a mob uses it since the mob isn't specifically programmed to do what the sword does. Basically, the swords code only runs if a PLAYER uses it. If you wanted a mob to have the same effect you would have to hard code it into the mob.
November 22, 20168 yr Would it have to be hard coded? Or could an event be used to check "Does the mob hold a weapon, mimic 'player' damage type"? Just a curious bystander Currently updating my Mod to 1.10.2 https://bitbucket.org/hugo_the_dwarf/riseoftristram2016/src?at=master
November 22, 20168 yr Author @terraya Mobs can't click. If you have a weapon that does something when you hit something else, it won't work when a mob uses it since the mob isn't specifically programmed to do what the sword does. Basically, the swords code only runs if a PLAYER uses it. If you wanted a mob to have the same effect you would have to hard code it into the mob. thanks i will try it
November 23, 20168 yr btw. is there a function like "If EntityHit target" ? I would use the LivingAttackEvent to check if the entity attacking from the source is an instanceof EntityLiving and specifically EntityPlayer and then grab the inventory object to see if the item used was yours then apply the effect. VANILLA MINECRAFT CLASSES ARE THE BEST RESOURCES WHEN MODDING I will be posting 1.15.2 modding tutorials on this channel. If you want to be notified of it do the normal YouTube stuff like subscribing, ect. Forge and vanilla BlockState generator.
November 23, 20168 yr Author btw. is there a function like "If EntityHit target" ? I would use the LivingAttackEvent to check if the entity attacking from the source is an instanceof EntityLiving and specifically EntityPlayer and then grab the inventory object to see if the item used was yours then apply the effect. got some problem on starting my mod, but i got the function writting with big hope that this test thing here will work: private void tryAbility(EntityLivingBase mob, EntityLivingBase target) { if ((target == null) || (target.getRidingEntity() != null) || (!mob.canEntityBeSeen(target))) { return; } long time = System.currentTimeMillis(); if ((time > this.nextAbilityUse) && (mob.getDistanceToEntity(target) > 3.0F) && (target.worldObj.canBlockSeeSky(new BlockPos(MathHelper.floor_double(target.posX), MathHelper.floor_double(target.posY), MathHelper.floor_double(target.posZ))))) { this.nextAbilityUse = (time + 15000L); mob.worldObj.addWeatherEffect(new EntityLightningBolt(mob.worldObj, target.posX, target.posY - 1.0D, target.posZ, false)); } } }
November 23, 20168 yr btw. is there a function like "If EntityHit target" ? I would use the LivingAttackEvent to check if the entity attacking from the source is an instanceof EntityLiving and specifically EntityPlayer and then grab the inventory object to see if the item used was yours then apply the effect. got some problem on starting my mod, but i got the function writting with big hope that this test thing here will work: private void tryAbility(EntityLivingBase mob, EntityLivingBase target) { if ((target == null) || (target.getRidingEntity() != null) || (!mob.canEntityBeSeen(target))) { return; } long time = System.currentTimeMillis(); if ((time > this.nextAbilityUse) && (mob.getDistanceToEntity(target) > 3.0F) && (target.worldObj.canBlockSeeSky(new BlockPos(MathHelper.floor_double(target.posX), MathHelper.floor_double(target.posY), MathHelper.floor_double(target.posZ))))) { this.nextAbilityUse = (time + 15000L); mob.worldObj.addWeatherEffect(new EntityLightningBolt(mob.worldObj, target.posX, target.posY - 1.0D, target.posZ, false)); } } } What is the problem? What are you trying to accomplish? Post where the code is being called from. VANILLA MINECRAFT CLASSES ARE THE BEST RESOURCES WHEN MODDING I will be posting 1.15.2 modding tutorials on this channel. If you want to be notified of it do the normal YouTube stuff like subscribing, ect. Forge and vanilla BlockState generator.
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.