Author Topic: Testing for Certain Bricks  (Read 1315 times)

I have this packaged under "ProjectileData::damage"
Code: [Select]
if(%col.getClassName() $= "pineTree")My logic here is that if the collided object is a pine tree, the code will activate.

Your problem is that no object has a class name of "pineTree".
All bricks, which include pine trees, have class names of "fxDTSBrick" for whatever reason.
Try making your code echo the class name of whatever the bullet hits, for example:
Code: [Select]
echo("Your bullet has hit something with the following class name: " @ %col.getClassName(); );

Use .getDatablock(); I'm not sure what the pine tree's datablock is, I'll tell you later.

Code: [Select]
if(%col.getDatablock().getName() $= "brickPineTreeData")
« Last Edit: September 23, 2007, 04:41:20 AM by MrPickel »

getDatablock() returns a number.

Code: [Select]
if(%col.getDatablock().getname $= "some name I can't remember")

You posted while I was editing my post =D

You posted while I was editing my post =D

«  Today at 01:37:22 PM »
« Last Edit: Today at 01:41:20 PM by MrPickel »

Nearly.

Space missed some brackets =D

Yes, I did. Use MrPick[el/le]'s code.

le please, imma see if Badspot can change it for me.

I got the brick detection to work in an ::onCollision, however when I try to write a variable to the %client using "%obj.client.player.var", I can't use %client.player.var anywhere else; it only sometimes works. It's especially true in functions using %this.

%obj is the clients player I think.

%obj = The Projectile, useless in most situations
%obj.client in ::onCollision() = %client in servercmds, %this in GameConnection::Stuff
%obj.client.player = Player Object, %client.player and %this.player in the above