"Spell" Quest
Hey guys.
I'm trying to make a lifetap proc that does 25% of a target's current HP with a maximum of 500. The problem I'm running into is it seems like the actual script is correct but it's not executing for some reason. Here's what I did. I copied and existing lifetap spell, and took out the damage, so it is a blank spell. The ID of this blank spell is 8558. I then created a file called 8558 and put it in my global\spells folder. I've done a server restart and countless #reloadqst's and I can spam cast this all day on things and it still doesn't work. Here's the script. Please note, this is my first attempt to do anything that I deem as non-simple so hopefully you guys wont tear it apart too hard :P I uploaded a picture as well because the code thing messes up spacing. http://gyazo.com/a5d4cd471d3a487d6947754d97494ff1.png Code:
sub EVENT_SPELL_EFFECT_CLIENT { |
First, why are you defining client in a client script?
$client-> literally works...... You're defining a NEW $client object with an uppercase C in Client, was this intentional? If so, why? Also, why are you redining what $client is more than once?? Aside from the fact you don't have to do it, at all, you're doing it once in spell effects for no reason and then again for lifetap???? |
Quote:
|
Quote:
Code:
case EVENT_SPELL_EFFECT_CLIENT: Third - He made a syntax error Code:
sub EVENT_SPELL_EFFECT_CLIENT { Code:
sub EVENT_SPELL_EFFECT_CLIENT { There is no need to respond in such a way - he legitimately asked for help. |
Quote:
Also, the way I replied wasn't any different than what many would reply. There are only a few people whom are actually nice when it comes to code :shock:. Doesn't excuse me, but just saying. :) |
Quote:
Quote:
|
Merry Christmas, this works 100%, if the NPC is at 1 health it will hit for 0, keep that in mind.
I fixed your issue, shouting the target doesn't return the target's name, also, re-defining things is unnecessary the way you did it. Also, I put in 'int' in order to keep you from hitting for decimals and keep the health from becoming decimals. Code:
sub EVENT_SPELL_EFFECT_CLIENT |
Thanks a lot KK.
I didn't even think about adding int.. definitely something I'll keep in mind for future scripts I make. Huge help. |
No problem, int just keeps it from going to a decimal and making everything ugly and annoying, also keep in mind it's really not necessary to even define anything, you could do this.
if($entity_list->GetClientByID($caster_id)->GetTarget->GetHP() >= 500) But people refer definitions because it's shorter and easier to interpret, I myself like to break away and define as little as possible, the coder logic of, "Do it in less lines." Also, call me Kingly. :P |
Quote:
Unfortunately even though the code is correct this still doesn't work and for the life of me I don't know why. It's in the correct folder with the correct name and everything. |
The way you have it the spell would have to be self only. If you have it as targettype 5 it will not work correctly.
The spell goes off (self only) and hits the client and triggers that event "EVENT_SPELL_EFFECT_CLIENT". If you aren't doing it that way is why it could possibly not be working. Guessing you have it as targettype 13 which is "lifetap"... but the way you are doing it with this quest it would need to be targettype 6. If you change the event to.. "EVENT_SPELL_EFFECT_NPC" it would trigger when the spell lands on a NPC.. and it should function correctly still with the way KK wrote it. (sorry if this is confusing I am a little tired) |
Quote:
|
Ah yes, got everything working now as it should be. Thanks a lot everyone!
|
All times are GMT -4. The time now is 08:32 PM. |
Powered by vBulletin®, Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.