| Blockland Forums > Modification Help |
| RC Car |
| (1/1) |
| MARBLE MAN:
I DIDNT MAKE THE ORIGINAL SCRIPT! Bushido did! (he made the RCBomb or Sapper) I wanted to edit it so it would make you say "Honk!" when you right clicked and i wanted it to say "Crash!" when you crash I ALSO needed help changing the color of the car to your paint can using: --- Code: --- function serverCmdUseSprayCan(%cl,%id) { Parent::serverCmdUseSprayCan(%cl,%id); if(isObject(%bot)) %bot.setColor(%id); } }; --- End code --- Here is the code im working on: --- Code: ---exec("./playertype.cs"); exec("./emitters.cs"); datablock ItemData(carBotItem) { category = "Item"; // Mission editor category equipment = true; //its already a member of item namespace so dont break it //className = "Item"; // For inventory system // Basic Item Properties shapeFile = "./rccarItem.dts"; mass = 1; density = 0.2; elasticity = 0.2; friction = 0.6; emap = true; //gui stuff uiName = "RC Car"; iconName = "./icon_rc_car"; doColorShift = false; colorShiftColor = "0.200 0.200 0.200 1.000"; // Dynamic properties defined by the scripts image = carBotImage; canDrop = true; }; //////////////// //weapon image// //////////////// datablock ShapeBaseImageData(carBotImage) { // Basic Item properties shapeFile = "./rccarItem.dts"; emap = true; // Specify mount point & offset for 3rd person, and eye offset // for first person rendering. mountPoint = 0; offset = "0 0 0.2"; rotation = eulerToMatrix("0 0 0"); eyeOffset = "0.005 1.1 -1.25"; eyeRotation = eulerToMatrix("-28 4 4"); doColorShift = true; colorShiftColor = carBotItem.colorShiftColor; // 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 = false; // Add the WeaponImage namespace as a parent, WeaponImage namespace // provides some hooks into the inventory system. className = "ToolImage"; // Projectile && Ammo. item = carBotItem; //melee particles shoot from eye node for consistancy melee = true; //raise your arm up or not armReady = true; doColorShift = true; minShotTime = 15000; colorShiftColor = carBotItem.colorShiftColor; //"0.25 0.5 0.0 1.000"; // 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.5; stateTransitionOnTimeout[0] = "Ready"; stateName[1] = "Ready"; stateScript[1] = "onUse"; stateTransitionOnTriggerDown[1] = "Fire"; stateAllowImageChange[1] = true; stateName[2] = "Fire"; stateTransitionOnTriggerUp[2] = "Ready"; stateScript[2] = "onFire"; }; function carBotImage::onMount(%this, %obj, %slot) { if((%obj.lastFireTime+%this.minShotTime) > getSimTime() && %this.usedsapper == 1) { centerprint(%obj.client,"Can't deploy another RC car yet!<br><br>Give it a while to respawn..." ,5); serverCmdUnUseTool(%obj.client); return; %obj.playThread(2, undo); } %obj.playthread(1, armReadyBoth); } function carBotImage::onUnMount(%this,%obj,%slot) { Parent::onUnMount(%this, %obj, %slot); fixArmReady(%obj); } function carBotImage::onFire(%this, %obj, %slot) { %obj.lastFireTime = getSimTime(); %this.usedsapper = 1; Spawncarer(%obj.client); %obj.playThread(1, plant); %obj.playThread(2, activate2); serverCmdUnUseTool(%obj.client); } function Spawncarer(%client) { %obj = %client.player; %pos = vectorAdd(%obj.getTransform(), vectorScale(%obj.getForwardVector(), 4)) @ getWords(%obj.getTransform(), 3, 6); %bot = new AIPlayer() { datablock = "carerbotArmor"; position = %pos; }; %bot.setTransform(%pos); %client.setcontrolobject(%bot); %client.player.carerbotarmor = %bot; %bot.name = "RC car"; %bot.carerOwner = %client; %bot.minigame = %obj.client.minigame; %bot.client = %bot; %bot.tdmTeam = %obj.client.tdmTeam; %bot.player = %bot; } function carerbotarmor::onImpact(%this, %obj, %collidedObject, %vec, %vecLen) { //carerbotarmorExplosion(%obj); } function carerbotarmor::onDisabled(%this,%obj,%state) { //carerbotarmorExplosion(%obj); //CRASH HERE } function carerbotarmor::onCollision(%this,%obj,%col,%fade,%pos,%normal) { if(%col.getclassname() $= "Player" || %col.getclassname() $= "WheeledVehicle" || %col.getclassname() $= "FlyingVehicle" || %col.getclassname() $= "AIPlayer") { //carerbotarmorExplosion(%obj); //CRASH HERE } } function carerbotarmor::onTrigger(%this, %obj, %slot, %val) { if(%val == 1 && %slot == 4) { carerbotarmorExplosion(%obj); } } function carerbotarmorExplosion(%obj) { if(isObject(%obj.getControllingClient())) // %obj.getControllingClient().setControlObject(%obj.getControllingClient().player); %projectile = RadioWaveProjectile; %p = new Projectile() { dataBlock = %projectile; initialVelocity = "0 0 -10"; initialPosition = %obj.getPosition(); sourceObject = %obj.carerOwner.player; sourceSlot = %slot; client = %obj.carerOwner; }; //HONK GOES HERE // MissionCleanup.add(%p); // %p.explode(); // %obj.schedule(10, delete); } --- End code --- |
| MARBLE MAN:
PLEASE :C :cookie: :cookieMonster: :panda: :iceCream: :nes: :nes: :iceCream: :panda: :cookieMonster: :cookie: |
| MARBLE MAN:
Bump... |
| mp7964:
You could check if the player's speed is equal or more to something for crashing, and to make the player say it, I think you just use commandToServer and messageSent. |
| FFSO:
--- Quote from: MARBLE MAN on October 21, 2011, 08:21:55 PM ---PLEASE :C <Mass emote spam removed> --- End quote --- Most people will not help a person with a code when they do emote spam, and possibly you can be banned for it. EDIT: Just noticed that there was large time in between this post and previouses. |
| Navigation |
| Message Index |