PDA

View Full Version : Few questions...


Nerdgasm
02-28-2017, 03:07 PM
Heya, so I had a few questions...

1. Is there a way I can make spells do damage based off of your own HP? Example; Spell A does 190% of your HP, and how would I go about doing that?

1a. Second part to that, can I make that damage be multiplied by strength/stamina, etc? If so... how?

Had some ideas for the scripts based off a potion script I have that restores 10% of your total hp, but I'm not sure where to go from there... Lol.

ghanja
03-01-2017, 11:06 PM
Heya, so I had a few questions...

1. Is there a way I can make spells do damage based off of your own HP? Example; Spell A does 190% of your HP, and how would I go about doing that?


Yes. Either via source code or LUA/Perl spell script.



1a. Second part to that, can I make that damage be multiplied by strength/stamina, etc? If so... how?


Yes. Depends on which method you choose above. But since this is in the Quests Q/A, I'll assume you mean how via the quest script system.

Think spell script. Then:


if ($client->IsClient()) {
quest::say ("That is not a valid target jackass!");
} else {
$client->GetTarget()->Damage($client, xDmg, xSpellID);
}


Rudimentary, I know, sorry heading to bed. But, it will point you in the right direction.


Had some ideas for the scripts based off a potion script I have that restores 10% of your total hp, but I'm not sure where to go from there... Lol.
[/QUOTE]

Well that's slightly different then. You'd append a script to an item, with potion graphic, etc.

But toy around with:


$client->GetMaxHP()


or


$client->HealDamage($client->GetMaxHP * 0.10);


I -suppose- it's HealDamage, it's been awhile since I've healed a certain percentage via script (it's normally items/spells).

Nerdgasm
03-17-2017, 01:37 AM
My hero <3.

Got a base script for a %dmg spell I could nab from ya and tweak with?

ghanja
03-17-2017, 02:28 PM
My hero <3.

Got a base script for a %dmg spell I could nab from ya and tweak with?

Elaborate for me, in explanation format. I'll write up whatever you want, is possible and that my knowledge allows.

Nerdgasm
03-17-2017, 06:42 PM
I'll pm you. =)

ghanja
03-17-2017, 11:33 PM
Based on your PM but showing here to keep around in case others are lurking it.


## Slash; Deals 10% of your hp to your target. (spell ID is 400).
## /quests/global/spells/400.pl

sub EVENT_SPELL_EFFECT_NPC
{
$responsibleclient = $entity_list->GetClientByID($caster_id);
if ($responsibleclient)
{
my $slashdamage = int($responsibleclient->GetHP() * 0.10); ## 10% of clients current HP?
$entity_list->MessageClose($responsibleclient, 0, 30, 0, "".$responsibleclient->GetCleanName()." delivers a crippling slash to ".$npc->GetCleanName()." for $slashdamage damage!");
$npc->Damage($responsibleclient, $slashdamage, 400, 1, 0);

}
}




## Fireblast; Deals 10% of your mana to your target. (spell ID is 500).
## /quests/global/spells/500.pl

sub EVENT_SPELL_EFFECT_NPC
{
$responsibleclient = $entity_list->GetClientByID($caster_id);
if ($responsibleclient)
{
my $firedamage = int($responsibleclient->GetMana() * 0.10);
$entity_list->MessageClose($responsibleclient, 0, 30, 0, "".$responsibleclient->GetCleanName()." conjurs the fires of hell to burn ".$npc->GetCleanName()." for $firedamage damage!");
$npc->Damage($responsibleclient, $firedamage, 500, 24, 0);

}
}


I -believe- this is what you're after?

Nerdgasm
03-18-2017, 10:26 PM
Pretty close,

## Slash; Deals 10% of your hp to your target. (spell ID is 400).
## /quests/global/spells/400.pl

sub EVENT_SPELL_EFFECT_NPC
{
$responsibleclient = $entity_list->GetClientByID($caster_id);
if ($responsibleclient)
{
my $slashdamage = int($responsibleclient->GetMaxHP() * 0.10); ## 10% of clients current HP?
$entity_list->MessageClose($responsibleclient, 0, 30, 0, "".$responsibleclient->GetCleanName()." delivers a crippling slash to ".$npc->GetCleanName()." for $slashdamage damage!");
$npc->Damage($responsibleclient, $slashdamage, 400, 1, 0);

}
}

Change in red, I mean it was exactly what I was looking for, however I don't want it to do the current hp, I want it to do the MAX HP, so if they have 3000 max hp but only have 2000 hp left, it'll do 300 damage, instead of 200. However, it did work perfectly, you sir, are amazing.