| Blockland Forums > Modification Help |
| Ammo Help? |
| << < (2/2) |
| otto-san:
-snip- |
| Extrude:
Can you post the code of all your .cs files? |
| austin615:
Sure --- Code: ---cAddDamageType("G18", '<bitmap:./CI_G18> %1', '%2 <bitmap:./CI_G18> %1',0.75,1); datablock ProjectileData(G18Projectile1 : G18Projectile1) { directDamageType = $DamageType::G18; }; ////////// // item // ////////// datablock ItemData(G18Item : G18image) { category = "Weapon"; // Mission editor category className = "Weapon"; // For inventory system // Basic Item Properties shapeFile = "./G18.dts"; rotate = false; mass = 1; density = 0.2; elasticity = 0.2; friction = 0.6; emap = true; //gui stuff uiName = "G18"; iconName = "./icon_G18"; doColorShift = true; colorShiftColor = "0.3 0.3 0.3 1.000"; // Dynamic properties defined by the scripts image = G18Image; canDrop = true; maxAmmo = 33; canReload = 1; }; //////////////// //weapon image// //////////////// datablock ShapeBaseImageData(G18Image : G18image) { // Basic Item properties shapeFile = "./G18.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 = G18Item; ammo = " "; projectile = G18Projectile1; projectileType = Projectile; //melee particles shoot from eye node for consistancy melee = false; //raise your arm up or not armReady = true; doColorShift = true; colorShiftColor = G18Item.colorShiftColor; }; function G18Image::onFire(%this,%obj,%slot) { %projectile = %this.projectile; %spread = 0.0015; %shellcount = 1; %obj.playThread(2, plant); %shellcount = 1; %obj.toolAmmo[%obj.currTool]--; %obj.AmmoSpent[%obj.currTool]++; %obj.spawnExplosion(TTLittleRecoilProjectile,"1 1 1"); commandToClient(%obj.client,'bottomPrint',"<just:right><font:impact:24><color:fff000>10x18mm <font:impact:34>\c6" @ %obj.toolAmmo[%obj.currTool] @ " / " @ %obj.client.quantity["9MMrounds"] @ "", 1, 2, 3, 4); 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; } function G18Image::onReloadStart(%this,%obj,%slot) { commandToClient(%obj.client,'bottomPrint',"<just:right><font:impact:24><color:fff000>10x18mm <font:impact:34>\c6" @ %obj.toolAmmo[%obj.currTool] @ " / " @ %obj.client.quantity["9MMrounds"] @ "", 1, 2, 3, 4); if(%obj.client.quantity["9MMrounds"] >= 1) { %obj.playThread(2, wrench); serverPlay3D(block_MoveBrick_Sound,%obj.getPosition()); } } function G18Image::onReloadWait(%this,%obj,%slot) { commandToClient(%obj.client,'bottomPrint',"<just:right><font:impact:24><color:fff000>10x18mm <font:impact:34>\c6" @ %obj.toolAmmo[%obj.currTool] @ " / " @ %obj.client.quantity["9MMrounds"] @ "", 1, 2, 3, 4); if(%obj.client.quantity["9MMrounds"] >= 1) { serverPlay3D(magazineOutSound,%obj.getPosition()); //serverPlay3D(block_MoveBrick_Sound,%obj.getPosition()); //serverPlay3D(Block_PlantBrick_Sound,%obj.getPosition()); //serverPlay3D(Block_changeBrick_Sound,%obj.getPosition()); %obj.playThread(2, activate); } } function G18Image::onReloaded(%this,%obj,%slot) { if(%obj.client.quantity["9MMrounds"] >= 1) { if(%obj.client.quantity["9MMrounds"] > 35) { %obj.client.quantity["9MMrounds"] -= %obj.AmmoSpent[%obj.currTool]; %obj.toolAmmo[%obj.currTool] = %this.item.maxAmmo; %obj.AmmoSpent[%obj.currTool] = 0; %obj.setImageAmmo(%slot,1); commandToClient(%obj.client,'bottomPrint',"<just:right><font:impact:24><color:fff000>10x18mm <font:impact:34>\c6" @ %obj.toolAmmo[%obj.currTool] @ " / " @ %obj.client.quantity["9MMrounds"] @ "", 1, 2, 3, 4); return; } if(%obj.client.quantity["9MMrounds"] <= 35) { %obj.client.exchangebullets = %obj.client.quantity["9MMrounds"]; %obj.toolAmmo[%obj.currTool] = %obj.client.exchangebullets; %obj.setImageAmmo(%slot,1); %obj.client.quantity["9MMrounds"] = 0; commandToClient(%obj.client,'bottomPrint',"<just:right><font:impact:24><color:fff000>10x18mm <font:impact:34>\c6" @ %obj.toolAmmo[%obj.currTool] @ " / " @ %obj.client.quantity["9MMrounds"] @ "", 1, 2, 3, 4); return; } } } function G18Projectile1::damage(%this,%obj,%col,%fade,%pos,%normal) { if(%col.getType() & $TypeMasks::PlayerObjectType) { %col.setVelocity(getWord(%col.getVelocity(),0)/1.1 SPC getWord(%col.getVelocity(),1)/1.1 SPC getWord(%col.getVelocity(),1.1)); } parent::damage(%this,%obj,%col,%fade,%pos,%normal); } function G18Image::onMount(%this,%obj,%slot) { Parent::onMount(%this,%obj,%slot); commandToClient(%obj.client,'bottomPrint',"<just:right><font:impact:24><color:fff000>10x18mm <font:impact:34>\c6" @ %obj.toolAmmo[%obj.currTool] @ " / " @ %obj.client.quantity["9MMrounds"] @ "", 1, 2, 3, 4); } function G18Image::onUnMount(%this,%obj,%slot) { %obj.playThread(2, root); } --- End code --- And then I have all the T + T Ammo support scripts and junk :/ |
| Navigation |
| Message Index |
| Previous page |