Author Topic: setAn Item  (Read 1030 times)

im making a special brick that when you spawn it it will set the brick an item, anyway how?
« Last Edit: October 14, 2009, 07:55:04 PM by Pah1023 »

%brick.setItem(datablock);

I did that but when its in the script it gives syntax errors.

Then you did it wrong.

Code: [Select]
package A
{
 function FXDTSBrick::onPlant(%this)
 {
  %this.setItem(Item);
  parent::OnPlant(%this);
 }
};
Activatepackage(A);
i think

You might want it to plant before putting the item on it.

Code: [Select]
package A
{
    function fxDTSBrick::onPlant(%this)
    {
if(%this.datablock $= "brick16xCubeData")
%this.setItem(Item);
parent::OnPlant(%this);
    }
};
activatePackage(A);


For finding what you want in "brick16xCubeData", find the letters here:
datablock fxDTSBrickData (brick32xCubeData)
{
   brickFile = "./32x Cube.blb";
   category = "Baseplates";
   subCategory = "Cube";
   uiName = "32x Cube";
   iconName = "Add-Ons/Brick_Large_Cubes/32x Cube";
};

Ok i tried this out, it getting errors where the $= is
it shows ##$##=
Code: [Select]
package RocketLauncherSpawn
{
function FXDTSBrick::onPlant(%this)
{
Parent::onPlant(%this);
if(%this.fxDTSBrickData $= "brickRocketLauncherSpawnData")
{
%this.setItem(RocketLauncherItem);
}
}
};
activatePackage("RocketLauncherSpawn");
datablock fxDTSBrickData (brickRocketLauncherSpawnData)
{
brickFile = "./2x2.blb";
category = "ItemSpawns";
subCategory = "Rockets";
uiName = "RocketL.";
iconName = "";
};
Edit: It seems that datablock isn't a thing that works with if's cause i tried this as a test in console
Code: [Select]
function serverCmdTest(%client){if(%client.player.datablock $= "playerStandardArmor"){messageAll('',"\c2True");}else{messageAll('',"\c0False");}}edit again: I did if(%this.fxDTSBrickData $= "brickRocketLauncherSpawnData") isntead of using datablock and lets see if it works
« Last Edit: October 17, 2009, 01:17:29 PM by Pah1023 »

Either use %obj.getDatablock() or %obj.dataBlock (case-sensitive).

Either use %obj.getDatablock() or %obj.dataBlock (case-sensitive).
That's seriously case-sensitive?

That's seriously case-sensitive?

If it sees 'datablock' in lower-case, I assume it thinks you're trying to define one.

That's seriously case-sensitive?
Spelling it in any way other than "dataBlock" in reference to an object variable causes syntax errors.

lol yep i was doing datablock instead of dataBlock
it works now, thanks truce, chrono, plornt, amade, and Kalphiter for helping

 Warning - while you were typing a new reply has been posted. You may wish to review your post.
Hao2disable this?

Don't disable it. It's there to tell you that your post may not be neccessary or relevant.
Just stop bitching about it.

Code: [Select]
%obj.getDatablock()That returns a number.