| Blockland Forums > Modification Help |
| Anti-QQ glitch. |
| << < (3/4) > >> |
| Chrono:
--- Quote from: Lord Tony² on March 07, 2012, 06:45:01 PM ---I added this and it doesn't work. --- End quote --- Are you using a custom OnFire function? |
| phflack:
doesn't all of the default stuff have this built in? i remember looking through the code once and seeing something about sim time which made it work |
| Chrono:
--- Quote from: phflack on March 08, 2012, 11:57:03 PM ---doesn't all of the default stuff have this built in? i remember looking through the code once and seeing something about sim time which made it work --- End quote --- You can only do it the way the default stuff does it if you use the default onFire function. @Tony, try looking at this: http://forum.returntoblockland.com/dlm/viewFile.php?id=13 |
| phflack:
this? i think this is what i saw before, i was looking at the spread for something --- Code: ---function shotgunImage::onFire(%this,%obj,%slot) { if((%obj.lastFireTime+%this.minShotTime) > getSimTime()) return; %obj.lastFireTime = getSimTime(); --- End code --- just the top of the function |
| Lord Tony²:
--- Code: ---// Weapon Image datablock ShapeBaseImageData(sfRevolverImage) { // Basic Item properties shapeFile = "./revolver.dts"; emap = true; // Specify mount point & offset for 3rd person, and eye offset // for first person rendering. mountPoint = 0; offset = "0 0 0"; eyeOffset = 0; //"0.7 1.2 -0.5"; rotation = eulerToMatrix( "0 0 0" ); // When firing from a point offset from the eye, muzzle correction // will adjust the muzzle vector to point to the eye LOS point. // Since this weapon doesn't actually fire from the muzzle point, // we need to turn this off. correctMuzzleVector = true; // Add the WeaponImage namespace as a parent, WeaponImage namespace // provides some hooks into the inventory system. className = "WeaponImage"; // Projectile && Ammo. item = BowItem; ammo = " "; projectile = sfRevolverProjectile; projectileType = Projectile; //melee particles shoot from eye node for consistancy melee = false; //raise your arm up or not armReady = true; minShotTime = 1000; //minimum time allowed between shots (needed to prevent equip/dequip exploit) doColorShift = false; //casing = " "; // Images have a state system which controls how the animations // are run, which sounds are played, script callbacks, etc. This // state system is downloaded to the client so that clients can // predict state changes and animate accordingly. The following // system supports basic ready->fire->reload transitions as // well as a no-ammo->dryfire idle state. // Initial start up state stateName[0] = "Activate"; stateTimeoutValue[0] = 0.15; stateTransitionOnTimeout[0] = "Ready"; stateSound[0] = weaponSwitchSound; stateName[1] = "Ready"; stateTransitionOnTriggerDown[1] = "Fire"; stateAllowImageChange[1] = true; stateSequence[1] = "Ready"; stateName[2] = "Fire"; stateTransitionOnTimeout[2] = "Smoke"; stateTimeoutValue[2] = 0.14; stateFire[2] = true; stateAllowImageChange[2] = false; stateSequence[2] = "Fire"; stateScript[2] = "onFire"; stateWaitForTimeout[2] = true; stateEmitter[2] = sfRevolverFlashEmitter; stateEmitterTime[2] = 0.06; stateEmitterNode[2] = "muzzleNode"; stateSound[2] = sfRevolverShotSound; stateEjectShell[2] = true; stateName[3] = "Smoke"; stateEmitter[3] = sfRevolverSmokeEmitter; stateEmitterTime[3] = 0.05; stateEmitterNode[3] = "muzzleNode"; stateTimeoutValue[3] = 0.5; stateTransitionOnTimeout[3] = "Reload"; stateName[4] = "Reload"; stateSequence[4] = "Reload"; stateTransitionOnTriggerUp[4] = "Ready"; stateSequence[4] = "Ready"; }; //----------------------------------------------------------------------------- // Script function SFRevolverImage::onFire(%this,%obj,%slot) { if(%obj.getDamagePercent() < 1.0) %obj.playThread(2, shiftAway); %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 --- Can anyone see what's wrong with it? |
| Navigation |
| Message Index |
| Next page |
| Previous page |