| Blockland Forums > Modification Help |
| Random bullet projectiles |
| (1/3) > >> |
| Lørd Tøny:
How can I add random bullet projectiles to this? --- Code: ---// Script function RifleImage::onFire(%this,%obj,%slot) { if(%obj.getDamagePercent() < 1.0) %obj.playThread(2, shiftAway); parent::onFire(%this, %obj, %slot); } --- End code --- |
| Iban:
... What? Your sentence does not translate literally in English. You're requesting random bullets. That's it. I don't even know in what way they're random. |
| Lørd Tøny:
I want the projectile direction to become random/inaccurate. |
| Blastdown:
I assume you mean like Kaje's old Minigun. This is its codeblock. --- Code: ---function minigunImage::onFire(%this,%obj,%slot) { %obj.setVelocity(VectorAdd(%obj.getVelocity(),VectorScale(%obj.client.player.getEyeVector(),"-1"))); %projectile = %this.projectile; %spread = 0.00185; %shellcount = 1; for(%shell=0; %shell<%shellcount; %shell++) { %vector = %obj.getMuzzleVector(%slot); %objectVelocity = %obj.getVelocity(); %vector1 = VectorScale(%vector, %projectile.muzzleVelocity); %vector2 = VectorScale(%objectVelocity, %projectile.velInheritFactor); %velocity = VectorAdd(%vector1,%vector2); %x = (getRandom() - 0.5) * 10 * 3.1415926 * %spread; %y = (getRandom() - 0.5) * 10 * 3.1415926 * %spread; %z = (getRandom() - 0.5) * 10 * 3.1415926 * %spread; %mat = MatrixCreateFromEuler(%x @ " " @ %y @ " " @ %z); %velocity = MatrixMulVector(%mat, %velocity); %p = new (%this.projectileType)() { dataBlock = %projectile; initialVelocity = %velocity; initialPosition = %obj.getMuzzlePoint(%slot); sourceObject = %obj; sourceSlot = %slot; client = %obj.client; }; MissionCleanup.add(%p); } return %p; } --- End code --- |
| Lørd Tøny:
Yes that but I don't know how to add it into the current codeblock. If I try I end up having something broken. |
| Navigation |
| Message Index |
| Next page |