| Blockland Forums > Modification Help |
| Questions about fxDTSbrick |
| (1/2) > >> |
| Crown2:
Hey guys, I have 2 quick questions. First, when you parent onPlant you get the variable '%brick' How do you then, with %brick, make the brick explode with tank shell explosion, and then delete itself? Like, say that I want an event that when you place a brick, it automatically explodes it and delete. How would I do that? Secondly, how do you automatically detect when a brick is hit when any projectile? |
| jes00:
--- Quote from: Crown2 on February 25, 2012, 04:43:58 PM ---Secondly, how do you automatically detect when a brick is hit when any projectile? --- End quote --- --- Code: ---package onBrickHit { function projectile::onCollision(%this, %obj, %col, %fade, %pos, %normal) { parent::onCollision(%this, %obj, %col, %fade, %pos, %normal); if(%col.getClassName() $= "fxDtsBrick" && (%col.getDatablock().uiName $= "myBrickName")) { messageClient(%obj.client,'',"Oi! You hit my brick!"); } } } activatePackage(onBrickHit); --- End code --- Not sure if that's exactly the right function. If that does not work try function projectileData::onCollision. |
| Fluff-is-back:
Not too good with bricks, but I imagine you could simply do this: %brick.spawnExplosion(TankShellProjectile, 1, %client); where %client is the gameConnection of the person who deals the damage, if that makes sense. then %brick.killBrick(); |
| jes00:
--- Quote from: Fluff-is-back on February 25, 2012, 05:10:01 PM ---%brick.killBrick(); --- End quote --- %brick.delete(); should work too. |
| Lugnut:
In this case, unless you want otherwise, you could do %brick.client, which would get your own client. Unless you had self damage on, the planting of the brick would only hurt other people. |
| Navigation |
| Message Index |
| Next page |