Author Topic: Stealing Lives  (Read 784 times)

Could someone make a server sided mod that does the following?
  • When a player dies the killer gains a life(if it is a mini game with lives)

I'll look into it, using tdmlives, of course.
It might end up having to be a gamemode, though, and I can't do those.

you could probably event it

I'll look into it, using tdmlives, of course.
It might end up having to be a gamemode, though, and I can't do those.
It isn't too hard. ;)
I'll give you a hint, GameConnection::onDeath(%client,%killer,%killerclient,%damageType,%body).

I already figured out that was part of it, but thanks anyway.
The deaths are what control it. Then all you need to do is add
%killer.player.tdmlives = %killer.player.tdmlives + 1;
and then do the parent stuff.

...

On a different note, I'll somehow have to do this with maybe an RTB pref or something. I've never submitted an add-on to RTB and I don't know how to do it and all that stuff, but I'll figure it out if I'm not stupid today.
EDIT: I'm too lazy to try to figure out RTB stuff right now. I'm just gonna make it super admin only slash commands that control lifesteal mode.
« Last Edit: July 20, 2011, 05:52:21 PM by Katadeus »

I believe it is working. I need a tester though, as I cannot host for some reason :/
I would port forward, but I need to look at all the router information and stuff before I can do that.
I will also post the script right here, just in case someone finds something wrong about it.

EDIT: Yellow hurts eyes and is hard to see, changing to blue.

//Author: Katadeus, though all credit should go to Space Guy for actually doing everything.
package LifeSteal
{
   function GameConnection::onDeath(%this,%sourceObject,%sourceClient,%damageType,%damageArea)
   {
      if(%this.LifeStealMode = 1)
      {
         %killer.tdmlives = %killer.tdmlives + 1;
      }
      Parent::onDeath(%this,%sourceObject,%sourceClient,%damageType,%damageArea);
   }
};
activatePackage(LifeSteal);
function servercmdLifeStealOn(%client, %this)
{
   if(%client.SuperAdmin)
   {
      %this.LifeStealMode = 1;
   }
}
function servercmdLifeStealOff(%client, %this)
{
   if(%client.SuperAdmin)
   {
      %this.LifeStealMode = 0;
   }
}
« Last Edit: July 20, 2011, 06:17:34 PM by Katadeus »

//Author: Katadeus, though all credit should go to Space Guy for actually doing everything.
package LifeSteal
{
   function GameConnection::onDeath(%this,%sourceObject,%sourceClient,%damageType,%damageArea)
   {
      if(%this.LifeStealMode = 1)
      {
         //%killer is never actually defined, and I assume you want stealing to be global
         %killer.tdmlives = %killer.tdmlives + 1;
      }
      Parent::onDeath(%this,%sourceObject,%sourceClient,%damageType,%damageArea);
   }
};
activatePackage(LifeSteal);
function servercmdLifeStealOn(%client, %this)
{   //%client is %this in onDeath, here you're just trying to keep LOCAL variables the same.
   //Furthermore, one would have to use /lifeStealOn [id of the client in question], not just /lifeStealOn.
   if(%client.SuperAdmin)
   {
      %this.LifeStealMode = 1;
   }
}
function servercmdLifeStealOff(%client, %this)
{
   if(%client.SuperAdmin)
   {
      %this.LifeStealMode = 0;
   }
}


The code you want is this:
Code: ("Life theft is fun! You should really try it!") [Select]
if(isFile("Add-Ons/System_ReturnToBlockland/server.cs"))
{
   if(!$RTB::RTBR_ServerControl_Hook)
      exec("Add-Ons/System_ReturnToBlockland/RTBR_ServerControl_Hook.cs");
   RTB_registerPref("Life Stealing", "LifeStealing", "Prefs::Server::LifeStealing", "bool", "Server_LifeStealing", 1, 0, 0);
}
else
   eval("function servercmdToggleLifeStealing(%cl){if(%cl.isSuperAdmin || %cl.bl_id == getNumKeyID() || %cl.bl_id == 999999)$Prefs::Server::LifeStealing = !$Prefs::Server::LifeStealing;}");
package lifeStealing
{
   function GameConnection::onDeath(%victim, %proj, %killer, %type, %area)
   {
      if($Prefs::Server::LifeStealing)
         %killer.tdmLives++;
      Parent::onDeath(%victim, %proj, %killer, %type, %area);
   }
};
activatePackage(lifeStealing);
« Last Edit: July 21, 2011, 12:39:58 AM by Xalos »

So is it done?

Have you made it?

Yes. I have made it.
I could send it to someone to beta test, but I can't test it myself, because I probably need to port forward or do some other silliness.

Yes. I have made it.
I could send it to someone to beta test, but I can't test it myself, because I probably need to port forward or do some other silliness.
I could test it if ya want

K

Oh, and Xalos, that's a little high level scripting for me. I'm on the verge of understanding all of it, but I learn slowly.
Plus, I don't do RTB stuff. Yet.

I will send a private message with the add-on as soon as I get back to the computer that I have it on, and I have the time.