Posted August 29, 201411 yr I need help, I need to know how to make a mob attack with lightning. (Sorry if there is already a thread for this I searched and didn't see one)
August 29, 201411 yr You mean strike lightnings around it? There must be a method to do that. If you mean like Thaumcraft shock wand focus then it's a problem... Check out my blog! http://www.whov.altervista.org
August 29, 201411 yr Author Yeah I mean like shoot a lightning bolt down at the player / whatever it is fighting I believe one of the modifiers in the Infernal Mobs mod makes the mob strike you with lightning so there must be a way
August 29, 201411 yr Hi It should be relatively straightforward; I imagine your attack code just needs to spawn an EntityLightningBolt at the right location (of the enemy) - on the server side only From WorldServer: this.theProfiler.endStartSection("thunder"); int i1; int j1; int k1; int l1; if (provider.canDoLightning(chunk) && this.rand.nextInt(100000) == 0 && this.isRaining() && this.isThundering()) { this.updateLCG = this.updateLCG * 3 + 1013904223; i1 = this.updateLCG >> 2; j1 = k + (i1 & 15); k1 = l + (i1 >> 8 & 15); l1 = this.getPrecipitationHeight(j1, k1); if (this.canLightningStrikeAt(j1, l1, k1)) { this.addWeatherEffect(new EntityLightningBolt(this, (double)j1, (double)l1, (double)k1)); } } this.theProfiler.endStartSection("iceandsnow"); -TGG
August 30, 201411 yr Author Still having trouble, I'm not exactly sure how to use that code in the method for attacking with a ranged attack (although I may just be stupid and am missing something obvious)
August 30, 201411 yr I believe summoning lightning at a player is easier. int px = worldObj.getClosestPlayerToEntity(this, 64).posX; That gives you the x position of the player. Do the same with the other positions of the player (posY and posZ); worldObj.addWeatherEffect(new EntityLightningBolt(worldObj, px, py, pz)); you could use that in your onUpdate() method.
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.