• 🏆 Texturing Contest #33 is OPEN! Contestants must re-texture a SD unit model found in-game (Warcraft 3 Classic), recreating the unit into a peaceful NPC version. 🔗Click here to enter!

Spell Help

Status
Not open for further replies.
Level 4
Joined
Sep 21, 2004
Messages
110
K i have absolutely no idea on how to do this spell, and ive seen somethign similar before (in EotA i think)
Chained Souls - Connects a target enemy hero's soul with that of the pitlord's, making the targeted hero take 60% of the pitlord's dmg when he is attaked. If the pitlord dies, the chained enemy will take the amount of damage the pitlord took from the start of the spell to when it ended.

The ending damage per is easy, but i have no idea how to make the enemy hero take 60% of the pitlord dmg.
 
Level 3
Joined
Oct 18, 2004
Messages
25
This is actually rather easy. All youre going to do is edit the spirit link spell used by the spirit walker (orc). Edit the number of units to 2 and change the valid targets to enemy heroes. Because the unit that uses the spell is automatically affected, the other hero will be spirit linked. The only problem is this goes 2 ways.

To have one that goes only 1 way, you will need to use triggers. I'll start making an example map and put it in the spell section asap
 
Level 6
Joined
Sep 9, 2004
Messages
152
First i don't know one thing,is it the pitlord do +60% dmg to the target or deal only 60% from his normal dmg or deal 60% of his dmg when targets attackes him.Second:
If the pitlord dies, the chained enemy will take the amount of damage the pitlord took from the start of the spell to when it ended.
i didn't understood that part very well!

[/code]
 
Level 4
Joined
Sep 21, 2004
Messages
110
Nope spirit link wont work, cus then they will share the dmg taken, like each will take 50% of the others dmg taken. I want it so that the target enemy hero will take 80% of the damage taken by the pitlord, so the pitlord recieves only 20% of all damage taken during the duration of the spell. And Vicky dont worry about the end part, i got that covered.
 
Level 11
Joined
Jul 20, 2004
Messages
2,760
I'd have a nice idea but it would be best to do it in JASS but triggers are good as well. I will consider this spell for the beginning as a request since it is the most intriguing. I will get warcraft today. Anyway, I'll tell you my idea into a non-JASS way.

It is very simple. Just base the spell off Spirit Link with 1 target and NO damage, but with a buff. Set the Casting Unit to a variable, wait until (Target Unit of Ability being Cast) has BUff equal to false. The buff should be equal with the Spirit Link's spell buff. Oh, and the event of the trigger should be Event - An unit finishes casting an ability.

To the second trigger...

Event - An unit is attacked
Conditions - Attacked Unit has BUFF equal to true
Actions - Set Life of (Attacked Unit) to (Life of Attacked Unit) + ((Damage Taken)*0.60)
- Set Life of (VARIABLE_CASTING_UNIT) [this is the variable in which you stored the casting unit] to Life of (VARIABLE_CASTING_UNIT)-(Damage Taken *0.40).

To assure the bounty stuff, you can create a dummy unit and make it attack the casting unit with the damage taken*0.40 damage.

That is my main idea, but I can make it multi-instance with JASS.
 
Level 6
Joined
Sep 9, 2004
Messages
152
This is my genius daelin but you have some mistakes!How it will assure that the dummy unit will kill the unit when it's on 1 life and how you're gonna set the units life to *0.4.Second how you'll assure that is the exacly unit that hit the caster is the target of the ability.It can be anyone and he'll be inicent!So you must make a ability that effects both caster and target!And about the dmg make a if that will activate when when the targets life will be >=20 or >=10!Then make the dummy and make it damage the target for 100000 with chaos attack!Third daelin check your mistacke in the calculations.+/-It is supposed not the casting unit to take most damage but the target!The target will get 60/80% of the dmg it deals but the caster will take only 20/40%!You done all turned with the head down.
 
Level 4
Joined
Sep 21, 2004
Messages
110
Yeah i had thought of that but i wanted it so that he gets damaged AS the spell is happening, not all at the end.
 
Level 4
Joined
Sep 21, 2004
Messages
110
You dont seem to understand...i want it done as the pitlord is attacked...not as periodic event and not all at the end

Hey actualy now that i think about it that might work.
i could make it so whent he spell is cast it sets his current hp to a variable(current_hp) and turns on a trigger which every .01 seconds does the following:
Dmg enemy_hero by ((current_hp - pitlord's current hp) x .60), then set pitlord hp to ((current_hp - pitlord's current hp) x .40), and again set current_hp to pitlord's current hp. Only problem is if he dies from the intitial attack it wont work.
 
Level 4
Joined
Sep 21, 2004
Messages
110
Well thanks so much if you can do this daelin, you'll definitly geta credit in my map if you do :D
Would you mind explaining how you made it after? Im trying to learn jass but only know basic stuff from a tutorial i read, so this might help me somewhat.
 
Level 11
Joined
Jul 20, 2004
Messages
2,760
Ok... the script is almost done (with no tests though) but this is a new system I've tried so there is an error and probably some bugs. Check them out Vicky...

JASS:
function Trig_Chained_Souls_Conditions takes nothing returns boolean
    if ( not ( GetSpellAbilityId() == 'A000' ) ) then
        return false
    endif
    return true
endfunction

function Attacked takes nothing returns nothing

local unit attacked
local real life
local real dmg
local real heal
local real dam
local unit caster
local trigger trg 

set trg = GetTriggeringTrigger()
set caster = GetHandleUnit(trg, "LABEL")
set attacked = GetAttackedUnitBJ()
set life = GetUnitState(attacked,UNIT_STATE_LIFE)
set dmg = GetEventDamage()*0.60
set heal = life+dmg
set dam = life-dmg

call SetUnitLifeBJ (attacked, heal)
call SetUnitLifeBJ (caster, dam)

set caster = null
set attacked = null

endfunction


function Trig_Chained_Souls_Actions takes nothing returns nothing

    local unit cast
    local unit targ
    local trigger trg

    set targ = GetSpellTargetUnit()
    set cast = GetSpellAbilityUnit()
    set trg = CreateTrigger()
    call SetHandleHandle(trg, "LABEL", targ)
    call TriggerRegisterUnitEvent(trg, cast, EVENT_UNIT_ATTACKED)
    call TriggerAddAction(trg, function Attacked)    

    loop
        exitwhen (UnitHasBuffBJ(targ,'B000')==false)
        call TriggerSleepAction (0.00)
    endloop

    set trg = null
    set targ = null
    set cast = null     

endfunction

There is still some error at the handle variable but I have no idea how it works (copied a script...).
 
Level 4
Joined
Sep 21, 2004
Messages
110
So, locals can ONLY be used in one function? I thought they can be used anywhere in the whole trigger. Why dont you use a couple globals for the stuff you need in another function? I dont need it to be multiinstance.
 
Level 11
Joined
Jul 20, 2004
Messages
2,760
Because there may be more than one unit affected by the spell at the same time. That is the whole problem. Making it with triggers would be very buggy... And with JASS without locals... I wouldn't see the point because it would be buggy again. I'll try to have only one caster and more targets but I don't know if it will work. I want this spell perfect btw... :D
 
Level 6
Joined
Sep 9, 2004
Messages
152
First Daelin i'm REALLY srry i didn't answer.Man the messenger should have notifited me(i was playing Sacred)Second such functions does not exist!Reason:you copyed this from Vexorian didn't you?Well those are his functions and he maded them!You have to copy the functions from one of his maps CS sections.Good luck to find them!
 
Level 6
Joined
Sep 9, 2004
Messages
152
Anyways Vexorian uses gamecaches to store memory that's what i tryed to do but it seems it doesn't work!That's why i posted the topic "Problem with gamechaches"If you wish try the script out or i shall make a new function by myself! :wink:
 
Level 11
Joined
Jul 20, 2004
Messages
2,760
Ok... I realized that the gamecache was not a solution and that the only way I can do it would be to take the unit itself but... look over the code.

JASS:
function Trig_Chained_Souls_Conditions takes nothing returns boolean
    if ( not ( GetSpellAbilityId() == 'A000' ) ) then
        return false
    endif
    return true
endfunction

function Attacked takes unit caster returns nothing

local unit attacked
local real life
local real dmg
local real heal
local real dam
local unit caster
local trigger trg 

set trg = GetTriggeringTrigger()
set attacked = GetAttackedUnitBJ()
set life = GetUnitState(attacked,UNIT_STATE_LIFE)
set dmg = GetEventDamage()*0.60
set heal = life+dmg
set dam = life-dmg

call SetUnitLifeBJ (attacked, heal)
call SetUnitLifeBJ (caster, dam)

set caster = null
set attacked = null

endfunction


function Trig_Chained_Souls_Actions takes nothing returns nothing

    local unit cast
    local unit targ
    local trigger trg

    set targ = GetSpellTargetUnit()
    set cast = GetSpellAbilityUnit()
    set trg = CreateTrigger()

    call TriggerAddAction(trg, function Attacked(cast)) //the problem is here   

    loop
        exitwhen (UnitHasBuffBJ(targ,'B000')==false)
        call TriggerSleepAction (0.00)
    endloop

    set trg = null
    set targ = null
    set cast = null     

endfunction
[/code]
 
Status
Not open for further replies.
Top