Spell Vengeance

I

IKilledKEnny

Guest
Vengeance (1.3).

Made due a request by Phoenixashes.

The caster will pick one victim, after 12 seconds, the victim will be dealt damage, based on the damage that the caster took druing those 12 seconds. The damage that will be dealt to the target is: 65%/80%/95%/110%/125% of the damage that the caster took druing those 12 seconds. If druing those 12 seconds that caster will die, then the damage will reset.

Vengeance.jpg


The READ ME:

Code:
Please read this document, it's important so you could understand the spell better. Skipping this
read is not suggested and not following the rules listed wouldn't be moral.

====================================================================================================

>> Credits:

    > This spell was requested by Phoenixashes, thus I did not come with the spell idea, but he did.

    > KaTTaNa, for using his(/her) system in my map (see "Map")

    > Tom Jones, for helping me with version 1.1. 

====================================================================================================

>>> Rules: Please follow the following rules.

    >> You may use this spell freely in your map with no credits needed.

    >> You may modify this spell freely.

    >> While you may use this freely in your own maps, please do not take this as your spell
      and attempt to publish in other sites saying that it was made by you. This includes:

        > You may not take the spell post it in any website without a premission for me. If you
          want to post this spell you must contact me (see "Last Words").
        > You may not post it in any contest etc.
        > You may not present this spell to anyone as your work even afer you modified this.

    >> I take no responsibility on this spell, if druing the import process somthing happens don't
       blame me, if you choose importing this spell to your map you need to follow the 
       instuctions posted (see "How to Implement"), JASS is a powerful language that will cause
       problems when not handled properly.


====================================================================================================

>> Description:

    > The caster will pick one victim, after 12 seconds, the victim will be dealt damage, based on 
      the damage that the caster took druing those 12 seconds. The damage that will be dealt to the
      target is: 65%/80%/95%/110%/125% of the damage that the caster took druing those 12 seconds.
      If druing those 12 seconds that caster will die, then the damage will reset.

    > Note: When the unit will be damaged a floating text will appear by it saying the damage
            that was dealt (rounded down in order to make it more friendly). Only the owner of the
            caster will be able to see the floating text.

====================================================================================================

>> Map

    > All triggers under "Map" file are not needed in order for the spell to work, but are simply
      triggers which help you when testing this spell.

    > There is a creep revival system in the map as well as hero revival system so you could keep
      testing this spell as long as you would like.

    > Typing -Level and an # will set you hero's level, for example: "-Level 6" will set your hero's
      level to six.

    > You can restore completely your life and mana by pressing the esc button.

    > I use KaTTaNa's Local Handle System for my spell, you must have it so the spell will work
      in your own map (see "How to Implement"). It can be found in the header of the map. Note:
      I use just part of the system, if you want to get the complete system go to: www.wc3jass.com.

    > Side note: I changed the blademaster's settings slightly, no need to copy those changes.

====================================================================================================

>> Trigger

    > The spell is made out of one trigger which stores in it two other local triggers.

    > In each trigger there will be detailed comments explaining everything, I suggest you read them
      carefully to understand the spell better.

   > Do NOT modify functions that has in them the line "No need to modify this" unless you know
     JASS well and understand the trigger.

    > Note: The lines that set the TextTag are BJs simply becuase it makes the trigger much shorter
            and anyway they slow the trigger by very little.

====================================================================================================

>> How to Implement

    > Firstly copy the "Vengeance" buff which can be found in Buffs / Effects > Custom Buffs /
      Effects > Human > Buff.

    > Then copy the spell "Vengeance" which can be found in: Object Editor > Abilities > 
      Custom abilities > Human > Heroes. Modify it now if you want.

    > After that's done go to the header of the map (where it says in this window "Vengeance.w3x")
      and copy every bit of the code there, that is KaTTaNa's Local Handle System. If you have
      the complete KaTTaNa's system already in your map you can skip this step.

    > After the header of the map have been copied into your map's header, copy the trigger
      "Vengeance" which can be found under this document.

    > Lastly modify the triggers using the comments written in them. 

====================================================================================================

>>> History

    
    >> Version 1.3 (May 13th, 2007)

        > Removed text tag feature for farther testing.
        > Updated map name to fit the version.

    >> Version 1.2 (May 12th, 2007)

        > Added restoring feature to the map so it could ease the testing process.
        > Added a feature that will create a special effect when the target is damaged.
        > Improved comments.
        > Major editing to this document.
        > Thread was updated.

    >> Version 1.1 (May 10th, 2007)

        > Added a condition were the text tag will not appear if the target is dead
        > Converted global triggers into local ones.
        > Comments were edited so the spell could be more readable.
        > Decreased greatly the use of KaTTaNa's Local Handle System so spell is faster now.
        > Added few more constants to make the spell easier to modify
        > Added buff and art effect to the spell
        > Changed enemies to make them harder.
        > Added -level command (See map)
        > And finally added screenshots to the thread

    >> Version 1.0 (May 6th, 2007) 

        > The first draft of the spell was created, the other versions are improvements to
          this version.       

====================================================================================================

>> Last Words:

    > Please infrom me with any comments / suggestion / bugs founds etc. You can contact me through
      E-mail ([email protected]), through private massage or by simply posting in the thread.

    > I hope you enjoy using this spell, remember that you can use it freely in your map!

====================================================================================================




                                      Your favorite murderer, 
                                          IKilledKEnny 




Vengeance > READ ME > Version 1.3 (May 13th, 2007) > Made by IKilledKEnny.

Here are the 3 triggers to all intrested:

JASS:

// Enjoy the spell, and please read the "READ ME".

constant function VengeanceEffectString takes nothing returns string
  // This is the string for the special effect
  // It is Animate Dead now.
  return "Abilities\\Spells\\Undead\\AnimateDead\\AnimateDeadTarget.mdl"
endfunction

function VengeancePercent takes integer level returns real
  // Returns the damage function of the spell.
  // At the moment it is level of the ability times 15 plus 50.
  return I2R(level)*15+50
endfunction

constant function VengeanceDuration takes nothing returns real
  // This will return the time that will pass until the unit will be damaged. Be sure to update
  // the object editor as well when changing this
  return 12.00
endfunction

constant function VengeanceSpellId takes nothing returns integer
  // This function will return the spell's Id. You need to make sure you change this to the correct 
  // Id when importing it to your map. Id can be checked by clicking ctrl + d in the object editor.
  return 'A001'
endfunction

function VengeanceCon takes nothing returns boolean

  // This function checks if the spell that was casted is Vengeance. 
  // No need to modify this.

  return GetSpellAbilityId()==VengeanceSpellId()
endfunction

function VengeanceDamageActTrig takes nothing returns nothing

  // This trigger will increase damage when the caster takes damage
  // No need to modify this

  local unit caster=GetTriggerUnit() // Get triggering unit inside a variable
  local real damage=GetHandleReal(caster,"damage") // We get damage variable that was linked to it

  set damage=damage+GetEventDamage() // We increase it by the damage that was done to the caster
  call SetHandleReal(caster,"damage",damage) // And finally, we relink the damage with the caster

  set caster=null
endfunction

function VengeanceDeathActTrig takes nothing returns nothing

  // This trigger will reset damage when the caster dies
  // No need to modify this

  local unit caster=GetTriggerUnit() // We get the triggering unit in a variable
  local real damage=GetHandleReal(caster,"damage") // The damage var through the linkage

  set damage=0 // Damage is now reset
  call SetHandleReal(caster,"damage",damage) // And finally, we relink the damage with the caster

  set caster=null
endfunction

function VengeanceMain takes nothing returns nothing

  // This is the main function that will damage the unit and show the text tag.
  // No need to modify this.

  local unit caster=GetTriggerUnit() // Casting unit inside a variable
  local unit target=GetSpellTargetUnit() // Target inside a variable
  local integer level=GetUnitAbilityLevel(caster,VengeanceSpellId()) // The level of the ability
  local real damage=0 // Real that will serve as damage calculator
  local real percent=VengeancePercent(level)*0.01 // We get the percent of the damage using level
  local real totalDamage // Will be served as the damaging real
  local trigger trigDamage=CreateTrigger() // Creates a trigger that will increase "damage"
  local trigger trigDeath=CreateTrigger() // Creates a triggers that will reset damage when the caster dies
  local triggeraction taDamage=TriggerAddAction(trigDamage,function VengeanceDamageActTrig) // Attachs an action to the trigger
  local triggeraction taDeath=TriggerAddAction(trigDeath,function VengeanceDeathActTrig) // Attachs an action to the trigger

  call SetHandleReal(caster,"damage",damage) // Links damage with caster

  call TriggerRegisterUnitEvent(trigDamage,caster,EVENT_UNIT_DAMAGED) // Adds event to the trigger
  call TriggerRegisterUnitEvent(trigDeath,caster,EVENT_UNIT_DEATH) // Adds event to the trigger

  call PolledWait(VengeanceDuration()) // Waits 12 seconds

  if GetUnitState(target,UNIT_STATE_LIFE)>=0 then // Checks if target is still alive
    set totalDamage=GetHandleReal(caster,"damage")*percent // Sets totalDamage
    call UnitDamageTarget(caster,target,totalDamage,true,false,ATTACK_TYPE_MAGIC,DAMAGE_TYPE_DEATH,WEAPON_TYPE_WHOKNOWS) // Damages target.
    call AddSpecialEffectTarget(VengeanceEffectString(),target,"origin") // Creates the effect.

  endif

  // Removes the leaks

  call DisableTrigger(trigDamage)
  call DisableTrigger(trigDeath)
  call TriggerRemoveAction(trigDamage,taDamage)
  call TriggerRemoveAction(trigDeath,taDeath)
  call DestroyTrigger(trigDamage)
  call DestroyTrigger(trigDeath)

  set caster=null
  set target=null
  set caster=null
  set target=null
endfunction

//===========================================================================
function InitTrig_Vengeance takes nothing returns nothing
  set gg_trg_Vengeance=CreateTrigger()
  call TriggerRegisterAnyUnitEventBJ(gg_trg_Vengeance,EVENT_PLAYER_UNIT_SPELL_EFFECT)
  call TriggerAddCondition(gg_trg_Vengeance,Condition(function VengeanceCon))
  call TriggerAddAction(gg_trg_Vengeance,function VengeanceMain)
endfunction


Future plans:
To fix the text tag, if you know how to fix this please let me know.
 

Attachments

  • Vengeance v1.3.w3x
    26.6 KB · Views: 359

Sim

Forum Administrator
Staff member
Reaction score
534
First of all, Vengeance, not Vengence :p

Why 3 triggers? You could use 2 local triggers, add 2 actions, one for each of them, and in the end you would only need one "trigger" object in the trigger editor.

Also, the text tag never fades. I didn't exactly figure out why, but it stays there permanently :p Also, it doesn't move. You should make it move, like a critical strike.

Also, don't comment every line, or use more constructive comments.

Example:

> local timer stoper=CreateTimer() // We created a nulled timer

Evident, if you ask me. The line already states what happens.

> // At the moment it is 45.
> // 315 at the moment

All this stuff is useless. Remove them.

Another example:

> local location targetLoc=GetUnitLoc(target) // We get target\'s loc

Straightforward again. GetUnitLoc(target) pretty much mentions what is happening.
 
I

IKilledKEnny

Guest
That it very odd, the texttag should do both and it did.. Let me have a look at that.

About the comments, it might be very clear to you, but for none-JASSers it can't be trickier.


>Vengeance

Really? I copied the spell name from an online dictionary... Thanks for letting me know. :)

Edit:

About local triggers, I have basic knowledge only of those, and anyway I think this way is clearer... I could try to see if I can make the trigger use few local triggers.
 

Sim

Forum Administrator
Staff member
Reaction score
534
JASS spells, as opposed to GUI spells, can almost always be made in 1 trigger, that's why this spell being made in 1 trigger would be better.

I never said comments were useless. The comments I pointed out are though.
 
I

IKilledKEnny

Guest
Ok I updated the spell. 2 Problems left, the tag will not fade and it's still 3 triggers, I'll fix that tommorow hopefully.

Could you please change the title of the thread to Vengeance?
 

Tom Jones

N/A
Reaction score
437
Your texttag doesn't fade because it doesn't have a lifespan. Your using a timer for the duration, and I can't seem to understand why. You could make the entire thing with one function, and you could make it efficient with two. Instead of adding events to three different triggers, add them all to gg_trg_Vengeance and use GetTriggerEventId() in your action function, etc.
JASS:
function bla_Conditions takes nothing returns boolean
    if GetTriggerEventId() == EVENT_PLAYER_UNIT_SPELL_CAST then
        return GetSpellAbilityId() == //Vengeance
    elseif GetTriggerEventId() == EVENT_PLAYER_UNIT_DEATH or GetTriggerEventId() == EVENT_PLAYER_UNIT_ATTACKED  then
        return GetUnitAbilityLevel(GetTriggerUnit(),//Vengeance) > 0
    else
        return false
    endif
endfunction

function bla_Actions ...
    ...
    if GetTriggerEventId() == EVENT_PLAYER_UNIT_SPELL_CAST then
        ...
    elseif GetTriggerEventId() == EVENT_PLAYER_UNIT_DEATH then
        ...
    elseif GetTriggerEventId() == EVENT_PLAYER_UNIT_ATTACKED then
        //Create your local trigger here, and add the damage event to it
    endif
    ...
endfunction

function InitTrig_Bla ...
    local integer i = 0
    local integer a = GetPlayers()
    set gg_trg_Vengeance = CreateTrigger
    loop
        exitwhen i > a
        call TriggerRegisterPlayerUnitEvent(trig,Player(i),EVENT_PLAYER_UNIT_SPELL_EFFECT,null)
        call TriggerRegisterPlayerUnitEvent(trig,Player(i),EVENT_PLAYER_UNIT_DEATH,null)
        call TriggerRegisterPlayerUnitEvent(trig,Player(i),EVENT_PLAYER_UNIT_ATTACKED,null
        set i = i+1
    endloop
    ...
endfunction
That's how I would do it, but we're all different. I'll suggest that you do it the way you think is easiest, though you should get rid of two excessive GUI triggers.

Keep it up.
 

pheonixashes

Those who misplace trust in gods learn their fate.
Reaction score
65
Nice KEnny, though there are a couple bugs:

1. When the unit is hit by the vengeance effect, the numbers displayed do not disappear.

2. If the unit dies before the effect takes place, the numbers still appear.

3. Would be nice if you could mark it with a buff ^_^. (Perhaps the Shadow Strike buff)
 
I

IKilledKEnny

Guest
Edit:

Everything is updated there are only 2 things left.

Using 1 function instead of 2 and a timer (even if timer is more accurate, really no need to keep 2 functions), and using local triggers instead of 3 global ones.
 
I

IKilledKEnny

Guest
> Kenny is there a way you can do this in Gui or is it easy to impoart/make more levels?

Well if you don't care about MUIness then, yes, it is possible, but this version uses lots of comments you could figure it out yourself.

For example want to change damage?

JASS:
function VengeanceDamage takes integer level returns real
  // Returns the damage function of the spell.
  // At the moment it is level of the ability times 15 plus 50.
  return I2R(level)*15+50
endfunction


Is your answer, as you see there is a comment saying what the function does and what it returns now. You can modify it easily for example::

Code:
function VengeanceDamage takes integer level returns real
  // Returns the damage function of the spell.
  // At the moment it is level of the ability times [B]35 divided by 18.[/b]
  return I2R(level)*[B]35/18[/B]
endfunction


The spell already fits any custom level, in order to change number of levels all you need to do is to edit the object editor.

Note to all: The spell is still underwork, I hope by the end of the weekend tops to get it right with local unleaky triggers.
 

Omni

Ultra Cool Member
Reaction score
37
makes me think of an attack from onix from pokemon.. what ws it again..
it was the same like vengeance... [=p forgot]

anyway: nice.
 
I

IKilledKEnny

Guest
Ok, fully updated spell and tested it, everything works (including the text tag, it gave me some hard time :) ). Look at history to view the most important changes.
 

Tom Jones

N/A
Reaction score
437
Much better.
Now you only need to change the buff from shadow strike to the actual buff :p
 
I

IKilledKEnny

Guest
Thanks Tom Jones, I hate working with the object editor, updated.
 

Sim

Forum Administrator
Staff member
Reaction score
534
You really need to make your test maps better, such as "Press ESC to heal". Reviving with 100 mana when the spell costs 135 is really annoying >_<

----------------------

Good, but you really need to add a special effect spawning when the unit takes the vengeance damage. It's supposed to be great vengeance afterall :p
 
I

IKilledKEnny

Guest
Ok I'm working on 1.2v, I'm annoyed but this text tag, it seems like one time it works and another time it doesn't. I'll figure it out.

Version 1.2v will include:

Better testing map
Fixed text tag
Effect when the unit takes damage
 
General chit-chat
Help Users
  • No one is chatting at the moment.

      The Helper Discord

      Members online

      No members online now.

      Affiliates

      Hive Workshop NUON Dome World Editor Tutorials

      Network Sponsors

      Apex Steel Pipe - Buys and sells Steel Pipe.
      Top