Author Topic: A Typing of the Dead-esque weapon  (Read 4967 times)


Well, i made an attempt
Code: [Select]
//a script to make a bottomprint appear to the shooter every ten damage the target takes
function KeyboardProjectile::onDamage(%this,%obj,%col,%fade,%pos,%normal)
{
   //detect a player/bot
   if(%col.getType() & $TypeMasks::PlayerObjectType)
   {
      //supposed to get knowledge of the target's health at a certain value
      %healthPercent = 1 - %obj.getDamagePercent();
      if(%healthPercent <= 0.2)
      {
         //send a bottom print to the shooter when target's health is at 80
         if(isObject(%obj.client))
         {
            bottomPrint(%obj.client,  "<just:center><color:ffffff>Bl", 2, 1);
         }
      }
      else if(%healthPercent <= 0.2)
      {
         //send a bottom print to the shooter when target's health is at 20
         if(isObject(%obj.client))
         {
            bottomPrint(%obj.client,  "<just:center><color:ffffff>Blocklan", 2, 1);
         }
      }
   }
}
The %col.getType function works, but not the attempts at getting the target's health and sending the shooter a bottom print

So your shooter and target are both %obj? Interesting...
Also do echo(isFunction(getDamagePercent)); should return if it's actually a function or not.

So your shooter and target are both %obj? Interesting...
Not intentionally, i'm just grabbing bits of stuff from other scripts that does something similar to what i need and then i change or add some things accordingly :panda:

Got around to using echo, says getDamagePercent isn't a function, but a lot of weapons have it in their firing script and there are other mods that use it for health and such
« Last Edit: October 07, 2014, 05:46:47 AM by Masterlegodude »

I say use something like this for health detection
Code: [Select]
function ShapeBase::getHealth(%this)
{
if(!isObject(%this))
return -1;
if(!strLen(%this.maxHealth))
return %this.getDatablock().maxDamage - %this.getDamageLevel();
return %this.health;
}

function ShapeBase::getMaxHealth(%this)
{
if(!isObject(%this))
return -1;
if(!strLen(%this.maxHealth))
return %this.getDatablock().maxDamage;
return %this.maxHealth;
}

Lol that was a part of my Support_Customhealth or something like dat

Lol that was a part of my Support_Customhealth or something like dat
Yes, yes it is.



Haven't heard from Advanced Bot yet, but as part of a request, i have made the ZX Spectrum keyboard as an optional keyboard model
http://forum.blockland.us/index.php?topic=61695.msg7922811#msg7922811
« Last Edit: October 11, 2014, 03:27:57 AM by Masterlegodude »

Bump, i got something that kinda works!
Code: [Select]
function KeyboardProjectile::Damage(%this,%obj,%col,%fade,%pos,%normal)
{
if(%col.getType() & $TypeMasks::PlayerObjectType)
{
if(%col.getDamagePercent() <= 0.1)
{
if(isObject(%obj.client))
{
bottomPrint(%obj.client,  "<just:center><color:ffffff>B", 2);
}
}
else if(%col.getDamagePercent() <= 0.2)
      {
if(isObject(%obj.client))
{
bottomPrint(%obj.client,  "<just:center><color:ffffff>Bl", 2);
}
}
else if(%col.getDamagePercent() <= 0.3)
      {
if(isObject(%obj.client))
{
bottomPrint(%obj.client,  "<just:center><color:ffffff>Blo", 2);
}
}
else if(%col.getDamagePercent() <= 0.4)
{
if(isObject(%obj.client))
{
bottomPrint(%obj.client,  "<just:center><color:ffffff>Bloc", 2);
}
}
else if(%col.getDamagePercent() <= 0.5)
{
if(isObject(%obj.client))
{
bottomPrint(%obj.client,  "<just:center><color:ffffff>Block", 2);
}
}
else if(%col.getDamagePercent() <= 0.6)
      {
if(isObject(%obj.client))
{
bottomPrint(%obj.client,  "<just:center><color:ffffff>Blockl", 2);
}
}
else if(%col.getDamagePercent() <= 0.7)
      {
if(isObject(%obj.client))
{
bottomPrint(%obj.client,  "<just:center><color:ffffff>Blockla", 2);
}
}
else if(%col.getDamagePercent() <= 0.8)
      {
if(isObject(%obj.client))
{
bottomPrint(%obj.client,  "<just:center><color:ffffff>Blocklan", 2);
}
}
else if(%col.getDamagePercent() <= 0.9)
      {
if(isObject(%obj.client))
{
bottomPrint(%obj.client,  "<just:center><color:ffffff>Blockland", 2);
}
}
else if(%col.getDamagePercent() <= 1.0)
      {
if(isObject(%obj.client))
{
bottomPrint(%obj.client,  "<just:center><color:ffffff>Blockland!", 2);
}
}
}
parent::Damage(%this,%obj,%col,%fade,%pos,%normal);
}

Values 0.6 (50 health), 0.8 (30 health) and 1.0 (10 health) repeat what 0.5, 0.7, and 0.9 say, i've even tried changing the <= into == and >= while also changing the value accordingly, sadly, i haven't been able to fix it
« Last Edit: October 16, 2014, 09:27:17 PM by Masterlegodude »


Not sure what that's about, but i guess i'll take this opportunity to say that Siba and me came up with an idea where instead of spelling out "Blockland!", each shot would spell out the name of the player that it shoots, so like, i have 'Masterlegodude', it would take 14 shots to kill me, Siba's name has 4 characters, thus it would only take 4 shots to kill him

So is it possible to get the name of a player, have it be shown in dark gray in a bottom print and have each character turn white for each time you shoot that player and have them die when their whole name is spelled out?

Not sure what that's about, but i guess i'll take this opportunity to say that Siba and me came up with an idea where instead of spelling out "Blockland!", each shot would spell out the name of the player that it shoots, so like, i have 'Masterlegodude', it would take 14 shots to kill me, Siba's name has 4 characters, thus it would only take 4 shots to kill him

So is it possible to get the name of a player, have it be shown in dark gray in a bottom print and have each character turn white for each time you shoot that player and have them die when their whole name is spelled out?
That would be dumb. Everyone could just change their names to super long, hard to type stuff, and even use letters not present on most keyboards (ÁŰÚŐÖÜÓÍÉ)