| Blockland Forums > Modification Help |
| On Brick Hit If Projectile |
| << < (6/7) > >> |
| jes00:
--- Quote from: Superb on December 05, 2011, 07:06:58 AM ---Use %col.health -= getRandom(1,5); Also -code- Notice how the parent is called, also notice the code i fixed in the asterisks. --- End quote --- There is still something wrong because when I hit it nothing happens(still). |
| Destiny/Zack0Wack0:
You need to replace all the the %col.getDatablock().Health checks with %col.health as well. |
| jes00:
--- Quote from: Destiny/Zack0Wack0 on December 05, 2011, 05:03:32 PM ---You need to replace all the the %col.getDatablock().Health checks with %col.health as well. --- End quote --- Still does not work ): --- Code: ---function SkillPickaxeProjectile::onCollision(%this,%obj,%col,%fade,%pos,%normal) { if(%col.getClassName() !$= "fxDtsBrick") { parent::onCollision(%this,%obj,%col,%fade,%pos,%normal); if(%col.getDataBlock().isOre) { if(%col..Health >= 1) { %col.health -= getRandom(1,5); commandToClient(%this,'centerPrint',"\c6You swing your pick at the ore.",3); } else if(%col.Health < 1) { %col.Health = %col.getDataBlock().defaultHealth; %col.Disappear(%col.getDatablock().regrowTime); %this.Resources += %col.getDataBlock().oreAmount; messageClient(%this,'',"\c3You have mined some \c6" @ %col.getDataBlock().oreName @ "\c3."); } } } else { parent::onCollision(%this,%obj,%col,%fade,%pos,%normal); } } --- End code --- |
| Superb:
You might also want to package function FxDtsBrick::onPlant(%this,%stuff...) and inside somewhere call %this.health = %this.getDataBlock().defaultHealth; |
| Destiny/Zack0Wack0:
You still have the %col.getDatablock().Health things inside the if checks. |
| Navigation |
| Message Index |
| Next page |
| Previous page |