• Listen to a special audio message from Bill Roper to the Hive Workshop community (Bill is a former Vice President of Blizzard Entertainment, Producer, Designer, Musician, Voice Actor) 🔗Click here to hear his message!
  • Read Evilhog's interview with Gregory Alper, the original composer of the music for WarCraft: Orcs & Humans 🔗Click here to read the full interview.

[Trigger] Is This Skill Possible in GUI?

Status
Not open for further replies.
Level 8
Joined
Sep 25, 2007
Messages
382
hi ppl , is this skill possible in GUI...

Broke Bones

gives a strong punch to the enemy , it deal great (not monster) damage, and then , every 200 range the enemy run , it damage itself (damage and Effect damage increase per level), the spell is melee.
 
Level 29
Joined
Jul 29, 2007
Messages
5,174
If you want it to be MUI it must be made in JASS because it will need seperate timers for each unit.
I'll try making it just for the hell of it, but don't expect much because im a noob in JASS.
I will need however some info.

- Will the damage-upon-walking stop when he dies ? after some time ? after he damage's himself a certain amount of damage ? after he moved a certain distance ?

- Will you want no-body to damage the target, or the hero that casted it to damage him ? (this is diffrent, because if he dies, you need to say who will get the credit)

[Edit] w0000000t !? I actualy made it to work !

The spell can be based on any Unit-Target spells (I.E - spells that target units, NOT locations, although if you want it to be AoE I can probably make that too).

This is the code, I will explain everything that needs to be explained.
I put it in code tags and not in jass tags so I could color the text and explain by the colors.
Code:
function Cons takes nothing returns boolean
    return GetSpellAbilityId() == '[COLOR="red"]A001[/COLOR]'
endfunction
function TimerActions takes nothing returns nothing
    local timer t = GetExpiredTimer()
    local unit caster = GetHandleUnit(t, "caster")
    local unit target = GetHandleUnit(t, "target")
    local integer i = GetHandleInt(t, "i")
    local integer ablevel = GetHandleInt(t, "ablevel")
    local real oldx = GetHandleReal(t, "oldx")
    local real oldy = GetHandleReal(t, "oldy")
    local real x = GetUnitX(target)
    local real y = GetUnitY(target)
    local real distance = DistanceBetweenPointsXY(oldx,oldy,x,y)
    local real totaldistance = GetHandleReal(t, "totaldistance")
    set totaldistance = totaldistance+distance
    [COLOR="yellow"]if totaldistance >= 200 then[/COLOR]
        call UnitDamageTarget(caster, target, [COLOR="Lime"]ablevel*100[/COLOR], true, false, [COLOR="lime"]ATTACK_TYPE_MELEE[/COLOR], DAMAGE_TYPE_NORMAL, WEAPON_TYPE_WHOKNOWS)
        set totaldistance = 0.00
    endif 
    [COLOR="pink"]if i >= 500 then[/COLOR]
        call FlushHandleLocals(t)
        call DestroyTimer(t)
    else
        call SetHandleInt(t, "i", i + 1)
    endif   
    call SetHandleReal(t, "totaldistance", totaldistance)
    call SetHandleReal(t, "oldx", x)
    call SetHandleReal(t, "oldy", y)
    set t = null
    set caster = null
    set target = null
endfunction
function Casting takes nothing returns nothing
    local unit caster = GetTriggerUnit()
    local unit target = GetSpellTargetUnit()
    local integer ablevel = GetUnitAbilityLevel(caster, '[COLOR="red"]A001[/COLOR]')
    local timer t = CreateTimer()
    local integer i = 0
    call SetHandleInt(t, "i", i)
    call SetHandleHandle(t, "caster", caster)
    call SetHandleHandle(t, "target", target)
    call SetHandleInt(t, "ablevel", ablevel)
    call TimerStart(t, 0.02, true, function TimerActions)
    set caster = null
    set target = null
    set t = null
endfunction
    
//===========================================================================
function InitTrig_[COLOR="cyan"]Untitled_Trigger_002 [/COLOR]takes nothing returns nothing
    set gg_trg_[COLOR="cyan"]Untitled_Trigger_002 [/COLOR]= CreateTrigger(  )
    call TriggerRegisterAnyUnitEventBJ( gg_trg_[COLOR="cyan"]Untitled_Trigger_002[/COLOR], EVENT_PLAYER_UNIT_SPELL_EFFECT )
    call TriggerAddCondition( gg_trg_[COLOR="cyan"]Untitled_Trigger_002[/COLOR], Condition( function Cons ) )
    call TriggerAddAction( gg_trg_[COLOR="cyan"]Untitled_Trigger_002[/COLOR], function Casting)
endfunction


First thing first, you need Kattana's Handle Vars which you can get here.
Copy that long code into your MAP HEADER.
The map header is that scroll icon (its half blue) that contains your map name in the trigger editor.

Now, things you will need to change:

[Rawcodes] the red colored texts are a rawcode.
In case you don't know what is a rawcode - its basicly the code of any unit/ability/item/etc.
You will need to change those A001 to your abilitie's rawcode.
To check whats your abilitie's rawcode, click Ctrl+D (and again to deactivate) and all the names in the object manager will turn to rawcodes.

[Damage] the green text is the damage done to the unit.
Currently it is {Ability_Level x 100} , you can change that to whatever you want.
Currently, the damage type is normal, terefor armor REDUCE the damage !
If you want it to not reduce change the DAMAGE_TYPE_MELEE to DAMAGE_TYPE_NORAML (I don't know why, but the 'spells' type is 'normal' in JASS).

[Time] the pink line basicly say "when i = 500 stop this", the timer works every 0.02 and thus 500/0.02 = 10 seconds.
If you want it for more/less time, change that.

If you want it to not be based on time - say whatever you want and ill change it.

[Distance] the yellow part is the distance needed to damage the unit.

It is 200 as you asked, but just incase you want to change it, change that 200 to whatever you want.

[Implanting] to implant this into your map, make a trigger and call it "Untitled Trigger 002", go to Edit and click on the "Convert to Custom Text", now put this code into it, then you can change the name to whatever you want.

Another way is to change all the parts with this color to your trigger's name.

[Tip] Always remember that spaces are "_" in jass (example: if your trigger's name is "Im Cool" it will be "Im_Cool" in jass !).


[Update] I changed the script a bit so it will be more efficient.

You will need to also add this script to your header
Code:
function DistanceBetweenPointsXY takes real oldx, real oldy, real x, real y returns real
    local real dx = oldx - x
    local real dy = oldy - y
    return SquareRoot(dx * dx + dy * dy)
endfunction
 
Last edited:
Level 8
Joined
Sep 25, 2007
Messages
382
Thanks a Lot !!!!!

+REP

but , there is a problem on implementation , it throws me like 100 errors , saying things that are wrong... any idea of what is happening? it occurs with all JASS triggers..
 
Last edited:
Level 29
Joined
Jul 29, 2007
Messages
5,174
I will repeat, you will need to add Kattana's Handle Vars script and my little script at the end of my last comment to your map header.

Look at the attached picture, insert it there.
 

Attachments

  • map header.JPG
    map header.JPG
    8.3 KB · Views: 198
Level 8
Joined
Sep 25, 2007
Messages
382
i add the handle vars , and it doesnt work , i dunno my problem T_T ... xD...

the only triggers that have problems with it , are the JASS triggers...

somebody help xD.
 
Level 29
Joined
Jul 29, 2007
Messages
5,174
Does this line in your code look like this

local real distance = DistanceBetweenPointsXY(oldx,oldy,x,y)

or look like this

local real distance = DistanceBetweenPoints(oldloc,loc)


If its the first one, you need to add also the little script I put in my post (down there...) to the header, just put it beneath Kattana's script.

I will even post it again here

Code:
function DistanceBetweenPointsXY takes real oldx, real oldy, real x, real y returns real
    local real dx = oldx - x
    local real dy = oldy - y
    return SquareRoot(dx * dx + dy * dy)
endfunction


If it still shows you problems (which I don't see any reason why it should), type some of them.
The most important are Syntax errors, though there shouldn't be any as I fully tested the code and it worked perfectly.


[nontopic] is it only me or everybody's JASS tags get ruined every time we do edit ? >.<
 
Level 8
Joined
Sep 25, 2007
Messages
382
well , my WC is in spanish , so it is difficult to explain the errors.

it appears a window and it say for example: "Line 90; A Variable was Exapected to be There". and things like that , but with names, variables, ends , etc. This Errors starts When you create the Local Variables.

maybe there is a problem with Warcraft Language. though.
 
Level 8
Joined
Sep 25, 2007
Messages
382
If you want, you can send me the map, ill implant it and then send it back to you.

ok ghost , thanks.

also , can you change the code so it have a special effect everytime the unit run the 250 range? so , when the unit is damage , add an effect. Rock Destoying effect or somethinng like that. please. thanks a lot. again.
 
Last edited:
Status
Not open for further replies.
Top