| Blockland Forums > Modification Help |
| Sword Snapping (EDITED!) |
| (1/1) |
| takato14:
Trying to make my sword appear to snap in two after swing it so many times. I have chosen to do this by Setting a global variable and increasing it everytime the sword is swung. Additionally, anytime the projectile collides with something, I want it to increase it even more. Once it overflows 100, it changes the image and swaps out the item datablock for a different one. This script just doesnt quite work. --- Code: ---$Swings = 0; function GKnifeImage::onSwing(%this, %obj, %slot) { $Swings++; if($Swings >= 100) { %obj.mountImage(GKnifeBrokenImage); serverPlay3d(GKnifeSnapSound,%obj.getTransform()); %obj.tool[%currSlot] = GknifeBrokenItem; } } function GKnifeProjectile::onCollision(%this,%obj,%col,%fade,%pos,%norm) { if(%col.getClassName() $= "Player") { $Swings = $Swings + 3; } else { $Swings = $Swings + 34; } Parent::onCollision(%this,%obj,%col,%fade,%pos,%norm); } --- End code --- Halp? EDIT: Apparently, I forgot to make the "GKnifeProjectile" datablock. Almost all of the function works; The only thing I got wrong was the part that replaces the item. I need help on that. |
| takato14:
Guys, cmon... I know this is a slow board but my topic shouldnt be moving down this fast :/ |
| Navigation |
| Message Index |