Jump to content
  • 0

Halve caster's HP upon Skill activation


Question

Posted (edited)

Hello guys!

  I've been trying to get the topic's title result but I have failed in all my attempts.

I want the skill to reduce the caster's HP to half upon activation, and then I will continue adding new skill effects, but I can't get to the first result.

This is how I go so far:

	case AC_SACRIFICEPOWER:
	{
			int hp = sstatus->max_hp;
				hp = hp*50/100;
			status_zap(src, hp, 0);
	}
break;

But, it is not working as intended. Is not halving my HP at all... Just reducing it for x rate... or even killing my character when full HP.

Any ideas?

Edited by Vyserion

1 answer to this question

Recommended Posts

  • 0
Posted (edited)

I haven't tested these, but here are four ideas that might give you something to play with: 

		case [Your Power's Name with no brackets]:
			status_zap(bl, status->hp/2, 0);
			break;

		case [Your Power's Name with no brackets]:
			status->hp = status->max_hp/2;
			break;
            
		case [Your Power's Name with no brackets]:
			int64 damage = status->hp - status->max_hp/2;
			status_zap(bl, damage, 0);
		        break;

		case [Your Power's Name with no brackets]:
			int64 damage = status->max_hp / 2;
			if (damage >= status->hp){
			clif_skill_fail(sd,skill_id,USESKILL_FAIL_LEVEL,0);
			return false;}
			else{			
			status_zap(bl, damage, 0);};
		        break;

if status->hp doesn't work, you could try sd->battle_status.hp

 

Edited by Humble_Bee

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Answer this question...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...