HomeUser Control Panel (unavailable in archive)ForumsTutorialsArt GalleryResourcesMaps

Global Hex

05-05-2007, 02:09 AM#1
Hsinker
Using thunderclap as a base and when casted, it hexes all desired player's heroes.

Trigger:
Global Hex
Collapse Events
Unit - A unit Starts the effect of an ability
Collapse Conditions
(Ability being cast) Equal to Thunder Clap
Collapse Actions
Unit - Order (Triggering unit) to Orc Shadow Hunter - Hex (Random unit from (Units owned by Player 1 (Red) matching (((Triggering unit) is A Hero) Equal to True)))
Unit - Order (Triggering unit) to Orc Shadow Hunter - Hex (Random unit from (Units owned by Player 4 (Purple) matching (((Triggering unit) is A Hero) Equal to True)))
Unit - Order (Triggering unit) to Orc Shadow Hunter - Hex (Random unit from (Units owned by Player 5 (Yellow) matching (((Triggering unit) is A Hero) Equal to True)))
Unit - Order (Triggering unit) to Orc Shadow Hunter - Hex (Random unit from (Units owned by Player 6 (Orange) matching (((Triggering unit) is A Hero) Equal to True)))
Unit - Order (Triggering unit) to Orc Shadow Hunter - Hex (Random unit from (Units owned by Player 8 (Pink) matching (((Triggering unit) is A Hero) Equal to True)))
Unit - Order (Triggering unit) to Orc Shadow Hunter - Hex (Random unit from (Units owned by Player 12 (Brown) matching (((Triggering unit) is A Hero) Equal to True)))
05-05-2007, 02:19 AM#2
Tide-Arc Ephemera
You might want to use Matching Unit instead of Triggering unit, and you may also want to look up dummy casting.
05-05-2007, 02:28 AM#3
Dil999
Triggering unit does not go with 'Units Matching Condition'
Make sure to read the gray text on the bottom of a trigger, function, which says some details. In this case, it reminds you you must use 'matching unit'
05-05-2007, 03:08 AM#4
Hsinker
Not much luck, i tried changing the trigger to this:
Trigger:
Global Hex
Collapse Events
Unit - A unit Starts the effect of an ability
Collapse Conditions
(Ability being cast) Equal to Thunder Clap
Collapse Actions
Unit - Create 1 Locust for (Triggering player) at (Center of (Playable map area)) facing Default building facing degrees
Unit - Order (Last created unit) to Orc Shadow Hunter - Hex (Random unit from (Units owned by Player 1 (Red) matching (((Matching unit) is A Hero) Equal to True)))
Unit - Remove (Last created unit) from the game
05-05-2007, 03:23 AM#5
Dil999
Ah, i found another problem. Your ordering the unit too fast for it to cast. Keep your first trigger, but create a dummy before each order (with your spell) and order the dummy to cast.
05-05-2007, 03:56 AM#6
Timmay
Trigger:
Global Hex
Collapse Events
Unit - A unit Starts the effect of an ability
Collapse Conditions
(Ability being cast) Equal to Thunder Clap
Collapse Actions
Unit Group - Pick every unit in (Units in (Playable map area) matching (((Matching unit) is A Hero) Equal to True)) and do (Unit - Order (Casting unit) to Orc Shadow Hunter - Hex (Picked unit))

Might not work well without dummy units, but using a similar action would probably help.
05-05-2007, 04:45 AM#7
DarthRevansith
i made this now and it doesn´t work.... i tried to help but you guys can correct my trigger, by the way, i think it isn´t working beacuse thunder calp doesn´t have a target unit so no units were added in the group and the trigger could be alot simplier if there ewould be a trigger like
"Unit - Order (Last created unit) to Orc Shadow Hunter - Hex (All units from GroupHEX)"

Trigger:
Hex1
Collapse Events
Unit - A unit Starts the effect of an ability
Collapse Conditions
(Ability being cast) Equal to Global Hex
Collapse Actions
Unit Group - Add (Target unit of ability being cast) to GroupHEX
Unit - Create 1 Dummy (duh?) for (Owner of (Casting unit)) at (Center of (Playable map area)) facing Default building facing degrees
Unit - Add Hex dummy to (Last created unit)
Unit - Set level of Hex dummy for (Last created unit) to (Level of Global Hex for (Casting unit))
Unit - Order (Last created unit) to Orc Shadow Hunter - Hex (Random unit from GroupHEX)
Wait 0.01 seconds
Unit - Order (Last created unit) to Orc Shadow Hunter - Hex (Random unit from GroupHEX)
Wait 0.01 seconds
Unit - Order (Last created unit) to Orc Shadow Hunter - Hex (Random unit from GroupHEX)
Wait 0.01 seconds
Unit - Order (Last created unit) to Orc Shadow Hunter - Hex (Random unit from GroupHEX)
Wait 0.01 seconds
Unit - Order (Last created unit) to Orc Shadow Hunter - Hex (Random unit from GroupHEX)
Wait 0.01 seconds
Unit - Order (Last created unit) to Orc Shadow Hunter - Hex (Random unit from GroupHEX)
Wait 0.01 seconds
Unit - Order (Last created unit) to Orc Shadow Hunter - Hex (Random unit from GroupHEX)
Wait 0.01 seconds
Unit - Order (Last created unit) to Orc Shadow Hunter - Hex (Random unit from GroupHEX)
Wait 0.01 seconds
Unit - Order (Last created unit) to Orc Shadow Hunter - Hex (Random unit from GroupHEX)
Wait 0.01 seconds
Unit - Order (Last created unit) to Orc Shadow Hunter - Hex (Random unit from GroupHEX)
Wait 0.01 seconds
Unit - Order (Last created unit) to Orc Shadow Hunter - Hex (Random unit from GroupHEX)
Wait 0.01 seconds
Unit - Order (Last created unit) to Orc Shadow Hunter - Hex (Random unit from GroupHEX)
Wait 0.01 seconds
Unit - Order (Last created unit) to Orc Shadow Hunter - Hex (Random unit from GroupHEX)
Wait 0.01 seconds
Unit - Order (Last created unit) to Orc Shadow Hunter - Hex (Random unit from GroupHEX)
Wait 0.01 seconds
Unit - Order (Last created unit) to Orc Shadow Hunter - Hex (Random unit from GroupHEX)
Wait 0.01 seconds
Unit - Order (Last created unit) to Orc Shadow Hunter - Hex (Random unit from GroupHEX)
Wait 0.01 seconds
Unit - Order (Last created unit) to Orc Shadow Hunter - Hex (Random unit from GroupHEX)
Wait 0.01 seconds
Unit - Order (Last created unit) to Orc Shadow Hunter - Hex (Random unit from GroupHEX)
Wait 0.01 seconds
Unit - Order (Last created unit) to Orc Shadow Hunter - Hex (Random unit from GroupHEX)
Wait 0.01 seconds
Unit - Order (Last created unit) to Orc Shadow Hunter - Hex (Random unit from GroupHEX)
Wait 0.01 seconds
Unit - Order (Last created unit) to Orc Shadow Hunter - Hex (Random unit from GroupHEX)
Wait 0.01 seconds
Unit - Order (Last created unit) to Orc Shadow Hunter - Hex (Random unit from GroupHEX)
Wait 0.01 seconds
Unit - Order (Last created unit) to Orc Shadow Hunter - Hex (Random unit from GroupHEX)
Wait 0.01 seconds
Unit - Order (Last created unit) to Orc Shadow Hunter - Hex (Random unit from GroupHEX)
Wait 0.01 seconds
Unit - Order (Last created unit) to Orc Shadow Hunter - Hex (Random unit from GroupHEX)
Wait 0.01 seconds
Unit - Order (Last created unit) to Orc Shadow Hunter - Hex (Random unit from GroupHEX)
Wait 0.01 seconds
Unit - Order (Last created unit) to Orc Shadow Hunter - Hex (Random unit from GroupHEX)
Wait 0.50 seconds
Unit Group - Remove (Target unit of ability being cast) from GroupHEX
Unit - Add a 1.00 second Generic expiration timer to (Last created unit)

by the way, my thunder clap was modified t oaffect all the playable map... so it would work as a global.
05-05-2007, 04:53 AM#8
Toink
No no no..

Thunder clap has no specific targets, which means that you can't use Target unit of ability being cast.

And you also should use a loop..

Here I'll give you the code.

Collapse JASS:
function Trig_Global_Hex_Conditions takes nothing returns boolean
    if ( not ( GetSpellAbilityId() == 'AUan' ) ) then //Remember to change this to your spell's rawcode!
        return false
    endif
    return true
endfunction

function Trig_Global_Hex_Actions takes nothing returns nothing
local unit u = GetTriggerUnit()
local unit c = CreateUnit(GetOwningPlayer(u), 'DummyRawcode', GetUnitX(u), GetUnitY(u)) // Creates the dummy unit
local unit targ
local group g = CreateGroup()
    call UnitAddAbility( c, 'Hex Rawcode')
    call GroupEnumUnitsInRange(g, GetUnitX(u), GetUnitY(u), 9999999, null)
    loop
        set targ = FirstOfGroup(g)
        exitwhen targ == null
        call IssueTargetOrderBJ( c, "Global Hex OrderString", targ)
       call GroupRemoveUnitSimple(targ, g)
    endloop
    call DestroyGroup(g)
    set u = null 
    set g = null
    set c = null
endfunction

//===========================================================================
function InitTrig_Global_Hex takes nothing returns nothing
    set gg_trg_Global_Hex = CreateTrigger(  )
    call TriggerRegisterAnyUnitEventBJ( gg_trg_Global_Hex, EVENT_PLAYER_UNIT_SPELL_EFFECT )
    call TriggerAddCondition( gg_trg_Global_Hex, Condition( function Trig_Global_Hex_Conditions ) )
    call TriggerAddAction( gg_trg_Global_Hex, function Trig_Global_Hex_Actions )
endfunction

I didn't test it, but it should work. Remember to set the Hex(Not Global!)'s cast range to 9999999
05-05-2007, 04:54 AM#9
Zwan
no no no, no need for all that.

Trigger:
Hex
Events
Conditions
Collapse Actions
Set tempHex = (Units in (Playable map area) matching ((((Unit-type of (Matching unit)) is A Hero) Equal to True) and ((Matching unit) Not equal to (Casting unit))))
Collapse Unit Group - Pick every unit in tempHex and do (Actions)
Collapse Loop - Actions
Collapse For each (Integer A) from 1 to (Number of units in tempHex), do (Actions)
Collapse Loop - Actions
Unit - Create 1 Footman for (Owner of (Casting unit)) at (Position of (Picked unit)) facing (Facing of (Casting unit)) degrees
Set HexDummy = (Last created unit)
Unit - Order HexDummy to Orc Shadow Hunter - Hex (Picked unit)
Unit - Remove HexDummy from the game
Unit Group - Destroy tempHex

This of course still leaks a point, but if you want to de-leak it, use custom script to create the dummy at X/Y of picked unit.
05-05-2007, 04:56 AM#10
Dil999
Finally someone gets it right! (Zwan) Im too lazy lately to do this on my own lately >.<.
05-05-2007, 05:05 AM#11
Toink
So Zwan get's it right and I don't? Wtf, mine is even more efficent and MUI..
05-05-2007, 05:17 AM#12
Tide-Arc Ephemera
Slightly off topic, what does "Unit Group - Clear" not do that "call DestroyGroup (udg_Blah)" does?

Like can they both be used to clear variables? On that mildly off topic thing, what about Remove Unit Group?

BTW - Toink, notice how he was using GUI?
05-05-2007, 05:17 AM#13
Pyrogasm
It's JASS, Toink. Does it look like he needed a JASS solution? No.

Oh, and unless Hex is autocast, Zwan's still isn't right.

You'll need to change
Trigger:
Unit - Remove HexDummy from the game
To
Trigger:
Unit - Add a 2.00 second generic expiration timer to HexDummy
That way it'll have time to cast.

EDIT: AH! There's still a problem; there's no need for this line: For each (Integer A) from 1 to (Number of units in tempHex), do (Actions). You're already picking every unit in that group, so you don't need to do an integer loop. Additionally, he probably doesn't have the "Destroy Unit group" action, so he'd need to subsitiute the appropriate Custom Script call in there. Alltogether, the trigger should look like this:
Trigger:
Hex
Events
Conditions
Collapse Actions
Set tempHex = (Units in (Playable map area) matching ((((Unit-type of (Matching unit)) is A Hero) Equal to True) and ((Matching unit) Not equal to (Casting unit))))
Collapse Unit Group - Pick every unit in tempHex and do (Actions)
Collapse Loop - Actions
Unit - Create 1 Footman for (Owner of (Casting unit)) at (Position of (Picked unit)) facing (Facing of (Casting unit)) degrees
Set HexDummy = (Last created unit)
Unit - Order HexDummy to Orc Shadow Hunter - Hex (Picked unit)
Unit - Add a 2.00 second generic expiration timer to HexDummy
Custom script: call DestroyGroup(udg_tempHex)


Oh, and Tide-Arc Ephemera, the difference is that DestroyGroup() actually destroys the group (aka the handle, if you know what that is); GroupClear() just clears every unit from the group without destroying it (Like the Unit Group - Clear SOMEGROUP command).
05-05-2007, 05:19 AM#14
Zwan
I can post it flawless without leaks, but since they are not using my version of the editor they dont have custom actions like;

Trigger:
Set HexDummy = (Create a unit for (Owner of (Casting unit)) of type Dummy at ((X of (Picked unit)),(Y of (Picked unit))) facing (Facing of (Casting unit)) degrees)

No point in telling them to do something they cant do.

Also kinda defeats the point to post in jass when they don't understand loops (which is not a bad thing, gotta learn sometime) and posted in GUI to begin with.

*edit
Pyro is correct, remove should be add exp timer. My bad
*edit
Dammit Pyro.. =)

He is correct on all counts. At any rate, you have your answer.
05-05-2007, 05:20 AM#15
Tide-Arc Ephemera
Couldn't you always set the unit's casting time backswing to 0?