Blockland Forums > Modification Help

Objects that emit a player detecting radius

Pages: << < (3/4) > >>

Obibital:


--- Quote from: Placid on June 11, 2011, 09:33:03 AM ---Umm, well, i'm pretty sure your script will, every time you plant a brick, say "Radzone brick was planted!".
it will then commence to create rad zones on every brick you plant.

plus, i think you would have to define %owner before you use it in the function.

--- End quote ---

Yes, it will. I was actually just trying to figure out what exactly %brick was by putting it in the echo. It came out as seemingly random numbers, so I didn't know what to do. And I'll look at defining %owner right now. Thanks for the input.




--- Quote from: otto-san on June 11, 2011, 01:05:46 PM ---You broke onPlant because you didn't call the parent.

The trigger should be having a class, not a datablock.

I'd strongly recommend looking for a certain type of brick or a variable on the client flagging if they said they're trying to plant rad areas, instead of EVERY SINGLE BRICK being one.

%owner was never defined, should be %brick.client.

--- End quote ---

I've always been confused with the needs oh having to call the parent, what exactly does that do? As for the fact that every block would place a radzone, I know that I did that, for I was checking what exactly %brick was calling. Thanks for clearing up what %owner was, I'll try that out now.

otto-san:

It's what you use with existing functions so that you can call the function that is not what you are packaging it for.

like


--- Code: ---function thingy()
{
  echo("The thingy happened.");
}

package nothingy
{
  function thingy()
  {
     if($thingNot)
     {
        echo("nothing.");
        return;
      }
      parent::thingy();
   }
};
activatePackage(nothingy);
--- End code ---

$thingyNot = 1;

if you do thingy(); then, it'll echo nothing instead.

Obibital:

Thanks for clearing that up a bit, adding the line that calls the parent did fix several errors that I did not understand, but when I actually get to creating the Trigger, the game does not  know what half of the functions I used are. I'm looking through some old gamemode for a reference.

Placid:


--- Quote from: Obibital on June 11, 2011, 01:26:42 PM ---Yes, it will. I was actually just trying to figure out what exactly %brick was by putting it in the echo. It came out as seemingly random numbers, so I didn't know what to do. And I'll look at defining %owner right now. Thanks for the input.

--- End quote ---
These seemingly random numbers are actually the brick's ID. If you look at anything in the game and then say /getid, you'll come up with said seemingly random numbers (including yourself). Try planting a brick, /getid 'ing it and then going into the console, inserting the result, and add .delete(); to the end of it. It'll delete it. I honestly don't know if there's a function like idtoname (there's nametoid) but yeah. Also, I believe if you were to echo findclientbyname(obibital) you'd get somewhat similar numbers... not quite sure about that one though.

Obibital:


--- Quote from: Placid on June 11, 2011, 04:15:38 PM ---These seemingly random numbers are actually the brick's ID. If you look at anything in the game and then say /getid, you'll come up with said seemingly random numbers (including yourself). Try planting a brick, /getid 'ing it and then going into the console, inserting the result, and add .delete(); to the end of it. It'll delete it. I honestly don't know if there's a function like idtoname (there's nametoid) but yeah. Also, I believe if you were to echo findclientbyname(obibital) you'd get somewhat similar numbers... not quite sure about that one though.

--- End quote ---

Thanks for explanation on that, but I've given up on making the trigger for now, unless someone can point out the errors in this snippet of code.

Snippet From Datablocks.cs


--- Code: ---datablock fxDTSBrickData(brickFalloutRadArea)
{
brickFile = "blar2.blb";
category = "Fallout";
subCategory = "Admin";
uiName = "RadArea";
iconName = "add-ons/brickIcons/none";
collisionShapeName = "base/data/shapes/bricks/2x2Fround.dts";
brickSizeX=1;
brickSizeY=2;
brickSizeZ=1;
};

--- End code ---

Snippet From Radiation.cs


--- Code: ---package radZone
{
function createRadZone(%brick)
{
if(!isobject(%brick)) return;
%trigger = new trigger("radZone")
{
datablock = brickFalloutRadArea;
owner = %brick.client;
};
%trigger.settransform(%brick.getTransform());
%trigger.setscale("15 15 15");
}

function fxDtsBrick::onPlant(%brick)
{
Parent::onPlant(%brick);
//echo("Radzone brick planted!");
echo(%brick @ "Was planted!");
createRadZone(%brick);
}

function radZone::OnEnterTrigger(%this, %trigger, %obj)
{
echo("HOLY stuff YOUR IN A RAD ZONEEEEEEEEEEEEEEEEEEEEEEEEEEE");
echo( %client.Name @ " is in deep stuff.");
}
};
activatePackage(radZone);

--- End code ---

Good luck, and thank you in advance if you are able to find the error.

Whenever this runs, the game tells me that It cannot find what setTransform, setScale, and whatnot are.

Pages: << < (3/4) > >>

Go to full version