Author Topic: Realistic Damage Mod  (Read 1876 times)

12-60k bricks.

Exactly, the build I am working on is a space-ship type thing and its absolutely heaving in brick count. Again, eventing is less practical than a server script. Couldn't stand the quota errors anyhow.

Exactly, the build I am working on is a space-ship type thing and its absolutely heaving in brick count. Again, eventing is less practical than a server script. Couldn't stand the quota errors anyhow.

One more thing: You can't just auto-wrench it. Some bricks have their own events, so you'd have to manually add it to the end for each of those... Scripts.

Here's what I've got, apparently it's unable to find the function KillBrick even though it shows up in dump();
Code: [Select]
$RealisticBrickDeath=true;

function servercmdToggleBrickKill(%client)
{
if(%client.isSuperAdmin)
{
if($RealisticBrickDeath==true)
{
$RealisticBrickDeath=false;
}

else
{
$RealisticBrickDeath=true;
}
}

else
{
return;
}
}

package RealisticBrickDeath
{
function fxDTSbrickdata::onfakedeath(%this)
{
if($RealisticBrickDeath == true)
{
parent::onfakedeath(%this);
killBrick(%this);
}
}
};
activatePackage(RealisticBrickDeath);


Using
Code: [Select]
%this.delete returns a message saying you cannot delete datablocks directly.


I can't find any other way, so I'll let someone else take over from here...

Here's what I've got, apparently it's unable to find the function KillBrick even though it shows up in dump();
-snip-


Using
Code: [Select]
%this.delete returns a message saying you cannot delete datablocks directly.


I can't find any other way, so I'll let someone else take over from here...

Code: [Select]
$RealisticBrickDeath = 0;

function servercmdToggleBrickRealism(%client) {
if(%client.isSuperAdmin)
$RealisticBrickDeath = !$RealisticBrickDeath;
}

package RealisticBrickDeath {
function fxDTSbrickdata::onFakeDeath(%this) {
Parent::onFakeDeath(%this);
if($RealisticBrickDeath)
%this.killBrick();
}
};
activatePackage(RealisticBrickDeath);

I shortened your code tons, but it still won't work I'm pretty sure. I don't remember the correct command either.
« Last Edit: July 04, 2011, 11:15:33 PM by MegaScientifical »

%this.killBrick();

rather than

killBrick(%this);

%this.killBrick();

rather than

killBrick(%this);
Yeah tried that too, neither worked.  Both are usable methods though.

So bring me up to speed, there is a problem executing a kill brick function?

%this.killBrick();

rather than

killBrick(%this);

I edited my post, although the other person's suggestion seemed nice too. You'd make bricks disappear when fakeKilled, and then package onMinigameReset to work on all bricks automatically.

This is one of my old DOME scripts but I'm pretty sure it has what you're looking for and much more.

Code: [Select]
if(isFile("Add-Ons/System_ReturnToBlockland/server.cs"))
{
if(!$DOME_BDset)
{
if(!$RTB::RTBR_ServerControl_Hook)
{
exec("Add-Ons/System_ReturnToBlockland/RTBR_ServerControl_Hook.cs");
}
RTB_registerPref("Brick Destruction", "DOME", "Pref::DOME::BrickDes", "list None 0 Kill 1 Delete 2 NoCollide 3 Negate 4", "DOME_BD", 0, 0, 0);
RTB_registerPref("Brick Coloring", "DOME", "Pref::DOME::BrickColon", "list None 0 Hit 1 Death 2", "DOME_BD", 0, 0, 0);
RTB_registerPref("Brick Colorize", "DOME", "Pref::DOME::BrickCol", "int 0 64", "DOME_BD", 0, 0, 0);
RTB_registerPref("Brick Random Colorize", "DOME", "Pref::DOME::BrickColR", "int 0 64", "DOME_BD", 0, 0, 0);
RTB_registerPref("Brick Kill", "DOME", "Pref::DOME::BrickKil", "list None 0 Onehit 1 100HP 2 VolumeHP 3 DoubleVolumeHP 4", "DOME_BD", 0, 0, 0);
RTB_registerPref("Brick Kill Respawn Time", "DOME", "Pref::DOME::BrickKilT", "int 1 999", "DOME_BD", 0, 0, 0);
$DOME_BDset=1;
}
}

package DOMEBD
{
function ProjectileData::onCollision(%this,%obj,%col,%fade,%pos,%normal)
{
if(%col.getclassname() $= "fxDTSBrick" && %col.client.minigame == %obj.sourceobject.client.minigame && %obj.sourceobject.client.minigame)
{
if($Pref::DOME::BrickColon == 1){
if($Pref::DOME::BrickCol){
%col.setcolor($Pref::DOME::BrickCol-1);
}
if($Pref::DOME::BrickColR){
%col.setcolor(getrandom(0,$Pref::DOME::BrickColR-1));
}
}
if($Pref::DOME::BrickKil == 1){
%col.fakekillbrick(%obj.getvelocity(),$Pref::DOME::BrickKilT);
}
if($Pref::DOME::BrickKil == 2){
%col.brickdamage+=%obj.getdatablock().directdamage+%obj.getdatablock().explosion.radiusdamage;
if(%col.brickdamage >= 100){
%col.fakekillbrick(%obj.getvelocity(),$Pref::DOME::BrickKilT);
%col.brickdamage=0;
}
}
if($Pref::DOME::BrickKil == 3){
%col.brickdamage+=%obj.getdatablock().directdamage+%obj.getdatablock().explosion.radiusdamage;
if(%col.brickdamage >= %col.getdatablock().getvolume()*5){
%col.fakekillbrick(%obj.getvelocity(),$Pref::DOME::BrickKilT);
%col.brickdamage=0;
}
}
if($Pref::DOME::BrickKil == 4){
%col.brickdamage+=%obj.getdatablock().directdamage+%obj.getdatablock().explosion.radiusdamage;
if(%col.brickdamage >= %col.getdatablock().getvolume()*10){
%col.fakekillbrick(%obj.getvelocity(),$Pref::DOME::BrickKilT);
%col.brickdamage=0;
}
}
}
parent::onCollision(%this,%obj,%col,%fade,%pos,%normal);
}
function fxDTSBrick::Fakekillbrick(%this,%x,%time,%client){
if($Pref::DOME::BrickColon == 2){
if($Pref::DOME::BrickCol){
%this.setcolor($Pref::DOME::BrickCol-1);
}
if($Pref::DOME::BrickColR){
%this.setcolor(getrandom(0,$Pref::DOME::BrickColR-1));
}
}
if($Pref::DOME::BrickDes == 1){
%this.killbrick();
return;
}
if($Pref::DOME::BrickDes == 2){
%this.delete();
return;
}
if($Pref::DOME::BrickDes == 3){
%this.setcolliding(0);
return;
}
if($Pref::DOME::BrickDes == 4){
return;
}
Parent::Fakekillbrick(%this,%x,%time,%client);
}
};
activatepackage("DOMEBD");

It's been sitting on my server for some time but I haven't really used it, so I don't really know if it will work entirely, and I'm too lazy to tear out the irrelevant portions. Let me know how it goes if you do try it out.

For intended use, you would just set brick destruction to "Kill" or "Delete" in rtb prefs.

rkynick, that works really well.. except, it only works with bricks hit with the projectile, anything affected by an explosion only fakekills and respawns... unless there is a way to configure that in the GUI.

dont wanna stuff it up and accidentally destroy a heap of your builds tho :/

Untested, but it should work.

Code: [Select]
package RealisticBrickDeath
{
function fxDTSbrickdata::onfakedeath(%this)
{
parent::onfakedeath(%this);
%this.delete();
}
};

Untested, but it should work.
No, that's already been tried if you read the previous posts.  You cannot delete datablocks directly anymore.

No, that's already been tried if you read the previous posts.  You cannot delete datablocks directly anymore.

Think you could work it into rkys script? Because that is perfect, it just doesn't detect fakekill.

Think you could work it into rkys script? Because that is perfect, it just doesn't detect fakekill.
What I'm saying is the only two functions for deleting a brick listed under dump(); for bricks, killbrick and delete, don't work.

%this.killbrick
>>>Function can't be found.

%this.delete
>>>Can't delete datablocks directly.

Maybe killing bricks has become more restrictive to prevent things such as the crap-on'ed Event_KillBrick