Health?

Author Topic: Health?  (Read 1439 times)

Is there any way to change the health of a blockhead?

Check out the Pill Add-On for an example of giving health.

If you want to change health levels, it will only apply in minigames. Look at add-ons/player_quake.cs

Code: [Select]
//quakePlayer.cs

//a new player datablock with quake-like movement



datablock PlayerData(PlayerQuakeArmor : PlayerStandardArmor)
{
   runForce = 100 * 90;
   runEnergyDrain = 0;
   minRunEnergy = 0;
   maxForwardSpeed = 15;
   maxBackwardSpeed = 15;// kinda obvious what it dose
   maxSideSpeed = 15;

   maxForwardCrouchSpeed = 7;
   maxBackwardCrouchSpeed = 7;
   maxSideCrouchSpeed = 7;

   jumpForce = 9 * 90; //8.3 * 90;
   jumpEnergyDrain = 0;
   minJumpEnergy = 0;
   jumpDelay = 0;

minJetEnergy = 0;
jetEnergyDrain = 0;
canJet = 0;

uiName = "Quake-Like Player";
showEnergyBar = false;

   runSurfaceAngle  = 55;
   jumpSurfaceAngle = 55;
};

showEnergyBar = false;

wut

theres a energybar?

showEnergyBar = false;

wut

theres a energybar?
I'm pretty sure the fuel-jet player uses it.

I want to change the amount of health, like from 100-200. Plus its an rpg, and I will have a minigame.

Or even better, an admin command that would change a players health. like /sethealth [name]

This should get you at least somewhere close even if it does not work how it is, I wrote most of it off the top of my head. It is quite hard to type with the top of your head :D
For you see the 'health' of a block head is  just a number, and if you use 'magic' read coding then you can make your own number which in effect adds to the 'health' of the blockhead. With some more 'witchery' read coding then you can get it to work with bots as well. I only suggest bots here because you can use them as training dummys at the least.
Code: [Select]
function serverCmdSetHealth(%client,%victim,%ammount)
{
  if(%client.isSuperAdmin) //don't let random people add HP
  {
    %victim.hp = %ammount; //use += to add to health insted
  }
  else
  {
    announce(%client.name SPC "is trying to mess with health D:");
  }
}

function ProjectileData::damage(%this,%obj,%col,%fade,%pos,%normal)
{
  %this.directDamage = getDamage(%this.directDamage,%col.client); //Damage script's 'HP'
  //direct damage doubles for crouching players
  %damageType = $DamageType::Direct;
  if(%this.DirectDamageType)
    %damageType = %this.DirectDamageType;
  if(%col.getType() & $TypeMasks::PlayerObjectType)
  {
    %col.damage(%obj, %pos, %this.directDamage, %damageType);
  }
  else
  {
    %col.damage(%obj, %pos, %this.directDamage, %damageType);
  }
}

function getDamage(%damage,%victim)
{
  %temp = (%victim.HP - %damage);
  if(%temp < 0)
  {
    %victim.hp = 0;
    return (%temp * -1); //you want damage to be positive so multiply by -1?
  }
  else
  {
    %victim.hp -= %damage;
    return 0;
  }
}
I was making a RPG script that rather than focus on cool items or gathering, was just getting exp and leveling up to become more powerful, I used something similar to this idea in it (Although I have not implemented HP into it yet). I kinda got lazy after Ephialtes...Just because Ephialtes is not always 'nice' does not mean what he says or does is of no help to you...Not drama section lol back on topic now. Anyways I used a similar way to create 'defence' that would reduce damage based on your stats.

showEnergyBar = false;

wut

theres a energybar?
I'm pretty sure the fuel-jet player uses it.
Oh like that i thought it mean't health ;D