Blockland Forums > Modification Help
Editing the RC Sapper
Greek2me:
--- Quote from: jes00 on December 23, 2011, 02:22:09 PM ---Why not just race vehicles?
--- End quote ---
The sappers are actually a lot of fun to race.
Swollow:
--- Code: ---exec("./playertype.cs");
exec("./emitters.cs");
datablock ItemData(BombBotItem)
{
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 = "./rcbombItem.dts";
mass = 1;
density = 0.2;
elasticity = 0.2;
friction = 0.6;
emap = true;
//gui stuff
uiName = "RC Sapper";
iconName = "./icon_rc_bomb";
doColorShift = false;
colorShiftColor = "0.200 0.200 0.200 1.000";
// Dynamic properties defined by the scripts
image = BombBotImage;
canDrop = true;
};
////////////////
//weapon image//
////////////////
datablock ShapeBaseImageData(BombBotImage)
{
// Basic Item properties
shapeFile = "./rcbombItem.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 = BombBotItem.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 = BombBotItem;
//melee particles shoot from eye node for consistancy
melee = true;
//raise your arm up or not
armReady = true;
doColorShift = true;
minShotTime = 15000;
colorShiftColor = BombBotItem.colorShiftColor; //"0.200 0.200 0.200 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 BombBotImage::onMount(%this, %obj, %slot)
{
if((%obj.lastFireTime+%this.minShotTime) > getSimTime() && %this.usedsapper == 1)
{
centerprint(%obj.client,"Can't deploy another RC Sapper yet!<br><br>Give it a while to respawn..." ,5);
serverCmdUnUseTool(%obj.client);
return;
%obj.playThread(2, undo);
}
%obj.playthread(1, armReadyBoth);
}
function BombBotImage::onUnMount(%this,%obj,%slot)
{
Parent::onUnMount(%this, %obj, %slot);
fixArmReady(%obj);
}
function BombBotImage::onFire(%this, %obj, %slot)
{
%obj.lastFireTime = getSimTime();
%this.usedsapper = 1;
SpawnBomber(%obj.client);
%obj.playThread(1, plant);
%obj.playThread(2, activate2);
serverCmdUnUseTool(%obj.client);
}
function SpawnBomber(%client)
{
%obj = %client.player;
%pos = vectorAdd(%obj.getTransform(), vectorScale(%obj.getForwardVector(), 4)) @ getWords(%obj.getTransform(), 3, 6);
%bot = new AIPlayer()
{
datablock = "bomberbotArmor";
position = %pos;
};
%bot.setTransform(%pos);
%client.setcontrolobject(%bot);
%client.player.bomberbotarmor = %bot;
%bot.name = "RC Bomb";
%bot.bomberOwner = %client;
%bot.minigame = %obj.client.minigame;
%bot.client = %bot;
%bot.tdmTeam = %obj.client.tdmTeam;
%bot.player = %bot;
}
function bomberbotarmor::onDisabled(%this,%obj,%state)
{
bomberbotarmorExplosion(%obj);
}
function bomberbotarmor::onCollision(%this,%obj,%col,%fade,%pos,%normal)
{
if(%col.getclassname() $= "Player" || %col.getclassname() $= "WheeledVehicle" || %col.getclassname() $= "FlyingVehicle" || %col.getclassname() $= "AIPlayer")
{
bomberbotarmorExplosion(%obj);
}
}
function bomberbotarmor::onTrigger(%this, %obj, %slot, %val)
{
if(%val == 1 && %slot == 4)
{
bomberbotarmorExplosion(%obj);
}
}
function bomberbotarmorExplosion(%obj)
{
if(isObject(%obj.getControllingClient()))
%obj.getControllingClient().setControlObject(%obj.getControllingClient().player);
%projectile = gravityrocketProjectile;
%p = new Projectile()
{
dataBlock = %projectile;
initialVelocity = "0 0 1";
initialPosition = %obj.getPosition();
sourceObject = %obj.bomberOwner.player;
sourceSlot = %slot;
client = %obj.bomberOwner;
};
MissionCleanup.add(%p);
%p.explode();
%obj.schedule(10, delete);
}
--- End code ---
Copy and paste this into the Server.cs in Weapon_RCBomb this is the exact same code except with the impact function removed
Wink:
After pasting that into the file it wouldn't save it. It said the file could not be created and to make sure that the path and file name are correct. Am I doing something wrong?
Greek2me:
Save it to the desktop, then copy and paste it back into the zip file.
Wink:
I deleted this function and everything below it - function bomberbotarmor::onDisabled(%this,%obj,%state) - And now it seems to work like I wanted it to. The only thing that helped me was saving it to desktop first, so thankyou Greek2me, and thankyou everyone else for your efforts.