| Blockland Forums > Modification Help |
| Sword not shooting projectiles at all |
| << < (4/4) |
| YoshiDude:
--- Quote from: Space Guy on June 18, 2011, 03:57:44 AM ---Why have you commented out stateScript[3] = "onFire"; - it needs that to work. Even if you're not making a custom onFire function you'll need a state with that so it uses the default WeaponImage::onFire function. The problem could also be with the rest of your states if it's still not working after that. For the second post, the default WeaponImage::onFire function goes something like this: (from the TGE weapon example and a bit for scaled-up projectiles) --- Code: ---function WeaponImage::onFire(%this,%obj,%slot) { %projectile = %this.projectile; if(%this.melee) %initPos = %obj.getEyeTransform(); else %initPos = %obj.getMuzzlePoint(%slot); %muzzleVector = %obj.getMuzzleVector(%slot); %scale = getWord(%obj.getScale(),2); %vector1 = VectorScale(%muzzleVector, %projectile.muzzleVelocity * %scale); %objectVelocity = %obj.getVelocity(); %vector2 = VectorScale(%objectVelocity, %projectile.velInheritFactor); %muzzleVelocity = VectorAdd(%vector1, %vector2); %p = new (%this.projectileType)() { dataBlock = %projectile; initialVelocity = %muzzleVelocity; initialPosition = %initPos; originPoint = %initPos; //it's in the Tank, not sure if needed sourceObject = %obj; sourceSlot = %slot; client = %obj.client; }; if(isObject(%p)) { %p.setScale(%scale SPC %scale SPC %scale); MissionCleanup.add(%p); return %p; } return -1; } --- End code --- It's not exact but should work in the same way for however you need to edit it. --- End quote --- Thanks a lot. Locking. I did try enabling onFire a few times, though, but defining the script manually apparently fixed it. |
| Navigation |
| Message Index |
| Previous page |