Blockland Forums > Modification Help
candlelight script
Cubelands:
I made this the model of candlelight, and I wrote this script for key bind on/off toggle allow model unmount/mount on left hand and when active light on Press L on/off.
--- Code: ---
if (!$candlestick)
{
$remapDivision[$remapCount] = "candlestick";
$remapName[$remapCount] = "Action CandleStick";
$remapCmd[$remapCount] = "create button";
$remapCount++;
$candlestick = 1;
}
datablock ShapeBaseImageData(candlestickImage)
{
shapeFile = "./CandleStick.dts";
emap = true;
mountPoint = 1;
className = "ItemImage";
item = BowItem;
melee = false;
armReady = false;
LightOn = true;
radius = 5;
brightness = 5;
color = "0.8 0.7 0.4 1";
FlareOn = false;
// FlareTP = true;
// Flarebitmap = "base/lighting/corona";
// FlareColor = "1 1 1";
// ConstantSizeOn = false;
// ConstantSize = 1;
// NearSize = 3;
// FarSize = 0.5;
// NearDistance = 10.0;
// FarDistance = 30.0;
// FadeTime = 0.1;
// BlendMode = 0;
AnimColor = false;
AnimBrightness = true;
AnimOffsets = false;
AnimRotation = false;
LinkFlare = false;
LinkFlareSize = false;
MinColor = "1 1 0";
MaxColor = "0 0 1";
MinBrightness = 0.0;
MaxBrightness = 5.0;
MinRadius = 0.1;
MaxRadius = 10;
StartOffset = "-5 0 0";
EndOffset = "5 0 0";
MinRotation = 0;
MaxRotation = 359;
SingleColorKeys = false;
RedKeys = "AWTCFAH";
GreenKeys = "AWTCFAH";
BlueKeys = "AWTCFAH";
BrightnessKeys = "DEDEDFGF";
RadiusKeys = "AZAAAAA";
OffsetKeys = "AZAAAAA";
RotationKeys = "AZAAAAA";
ColorTime = 1.0;
BrightnessTime = 1.0;
RadiusTime = 1.0;
OffsetTime = 1.0;
RotationTime = 1.0;
LerpColor = false;
LerpBrightness = false;
LerpRadius = false;
LerpOffset = false;
LerpRotation = false;
textureName = "base/data/particles/cloud";
dragCoefficient = 1.0;
gravityCoefficient = -7.0;
inheritedVelFactor = 0.0;
windCoefficient = 0.0;
constantAcceleration = 0.0;
lifetimeMS = 200;
lifetimeVarianceMS = 0;
spinSpeed = 0;
spinRandomMin = -90.0;
spinRandomMax = 90.0;
useInvAlpha = false;
colors[0] = "0.0 0.0 0.0 0.0";
colors[1] = "1 1 0.3 0.0";
colors[2] = "1 1 0.3 1.0";
colors[3] = "0.6 0.0 0.0 0.0";
sizes[0] = 0.0;
sizes[1] = 0.0;
sizes[2] = 0.09;
sizes[3] = 0.01;
times[0] = 0.0;
times[1] = 0.5;
times[2] = 0.51;
times[3] = 0.7;
ejectionPeriodMS = 1;
periodVarianceMS = 0;
ejectionVelocity = 0.0;
ejectionOffset = 0.0;
velocityVariance = 0.0;
thetaMin = 0;
thetaMax = 180;
phiReferenceVel = 0;
phiVariance = 360;
overrideAdvance = false;
//lifetimeMS = 5000;
//actionstuff
stateSequence[0] = "ready";
};
package Item_Candle_Stick
{
function serverCmdLight(%client)
{
%player = %client.player;
if(%player.getMountedImage(1) == 0)
%player.mountImage(candlestickImage, 1);
else if(%player.getMountedImage(1) == candlestickImage.getID())
%player.unMountImage(1);
parent::serverCmdLight(%client);
}
activatePackage(Item_CandleStick);
--- End code ---
Note: fire lite on the string top. I did name place at the string muzzlePoint. I use script light/Particle candle create by Kaje. and I put name mountPoint on the wax candle at bottom.
computermix:
notice your "activatepackage(Item_candleStick)" and its not "activatepackage(Item_candle_stick)".
Is that the problem? I didn't see a question.
EDIT: what about that }; end bracket for the package?
Cubelands:
--- Quote from: computermix on May 10, 2012, 06:42:13 PM ---notice your "activatepackage(Item_candleStick)" and its not "activatepackage(Item_candle_stick)".
Is that the problem? I didn't see a question.
EDIT: what about that }; end bracket for the package?
--- End quote ---
I am blind! it was under my nose whole time, lol I am going fix it.
EDIT: this not showed up on key bind.
--- Code: ---if (!$candlestick)
{
$remapDivision[$remapCount] = "Tool Binds";
$remapName[$remapCount] = "CandleStick";
$remapCmd[$remapCount] = "serverCmdLight";
$remapCount++;
$candlestickServer::Binds = true;
}
--- End code ---
Nexus:
--- Quote from: Cubelands on May 10, 2012, 06:45:12 PM ---I am blind! it was under my nose whole time, lol I am going fix it.
EDIT: this not showed up on key bind.
--- Code: ---if (!$candlestick)
{
$remapDivision[$remapCount] = "Tool Binds";
$remapName[$remapCount] = "CandleStick";
$remapCmd[$remapCount] = "serverCmdLight";
$remapCount++;
$candlestickServer::Binds = true;
}
--- End code ---
--- End quote ---
A few things
You are mixing up server sided and client sided code. Item datablocks are server sided, but keybinds are client sided. Also I don't think having the command for the keybind in multiple words like "create button" is valid. You probably need a _ instead of a space. Also, I don't see where you even have the function. In this other keybind you have here, you are calling servercmdlight, which again is a server sided function that has a first argument of %client, and calling this keybind will set the first argument as either 0 or 1 depending on wether you are pressing the key or releasing.
On top of all that, I don't think you actually need to make a new keybind. Using the existing light keybind should be fine. Just stick to server sided code for this.
Also, if it doesn't show up at all, it might not have executed. That syntax error computermix pointed out could be the cause.
Cubelands:
--- Quote from: Nexus on May 10, 2012, 07:48:02 PM ---A few things
You are mixing up server sided and client sided code. Item datablocks are server sided, but keybinds are client sided. Also I don't think having the command for the keybind in multiple words like "create button" is valid. You probably need a _ instead of a space. Also, I don't see where you even have the function. In this other keybind you have here, you are calling servercmdlight, which again is a server sided function that has a first argument of %client, and calling this keybind will set the first argument as either 0 or 1 depending on wether you are pressing the key or releasing.
On top of all that, I don't think you actually need to make a new keybind. Using the existing light keybind should be fine. Just stick to server sided code for this.
Also, if it doesn't show up at all, it might not have executed. That syntax error computermix pointed out could be the cause.
--- End quote ---
Oh GOD! I am such idiot!
clinet.cs = for key bind
Server.cs = for script candle stuff
Do you think this will work or not?