Complicated trigger spell help

Smitty

Member
Reaction score
20
Yeh, I'm pretty sure I did. One thing which may be an issue is that the dummy lightning I was using is a different spell to the original... Dunno if that makes a difference. I'll try reshuffling around all the settings things again, pretty sure I've tried them all. Trying again :)
 

Smitty

Member
Reaction score
20
Ah, it occurs to me that one issue may be that the hero ability itself doesn't apply a buff (it's based on finger of death and can't place the buff itself) I'll try using a different base ability.
 

GFreak45

I didnt slap you, i high 5'd your face.
Reaction score
130
lol that would present a problem, as this whole spell is based off the assumption that the unit recieves a buff
 

Smitty

Member
Reaction score
20
right, tried using a spell based off Frost Nova (one that definitely applies a buff to the target) and still no success. I think I must be entering the IDs wrong somehow or something, but I've tried each different combination of possibilities :(
 

GFreak45

I didnt slap you, i high 5'd your face.
Reaction score
130
post the code that you have (the settings function) in these tags: [noparse]
JASS:
here
[/noparse]
 

Smitty

Member
Reaction score
20
JASS:
function SS_SetSettings takes nothing returns nothing
    set udg_SS_ABIL_ID = 'AUfn'  //the id for the ability
    set udg_SS_DUMMY_ID = 'nwe1' //dummy unit used to cast the ability to bounce
    set udg_SS_BUFF_ID = 'B00B'  //the id for the buff that the ability applies
    set udg_SS_CAST_STRING = "frostnova"  //put the cast string inside the ""s (if you dont know it, search the order string of the base ability)
    set udg_SS_RADIUS = 500      //distance targets can be from the unit
    set udg_SS_FREQUENCY = 0.5   //interval in seconds that it shocks units around it
endfunction


Mind you, this is just one configuration I've tried :(
 

GFreak45

I didnt slap you, i high 5'd your face.
Reaction score
130
and the dummy unit has the spell as well? this works by making a dummy that casts the same spell on a nearby enemy

PS: i guess im not as mature as i thought, i loled at:
JASS:
'B00B'
 

Smitty

Member
Reaction score
20
ah, that may be the issue. How'd I not think of that? XD right then, trying it now.

EDIT: also lol'd ^^
 

GFreak45

I didnt slap you, i high 5'd your face.
Reaction score
130
I found some errors with the unit indexing system i posted, heres an updated but not-yet compiled version that should work...
JASS:
// GUI Unit Indexing v1.00
// by G_Freak45
// 
// Requires:
//   
//   -Some GUI knowledge and the attention span to read the "How to"
//
// How to:
//   
//   Implementation:
//     
//     -Create a new trigger named "GUIUnitIndexing"
//     -Copy and paste this code in there, deleting what is inside
//     -Create the unit array variable using an array size of 8191 named "GUI_UI_IndexUnit"
//     -Create the integer array variable using an array size of 8191 named "GUI_UI_Recycle"
//     -Create the integer variable named "GUI_UI_ListSize"
//     -Create the real variable named "GUI_UI_Event_Enter_Map"
//     -Create the real variable named "GUI_UI_Event_Decay"
//     -Create the unit variable named "GUI_UI_Triggering_Unit"
//     
//   Using the system:
//     
//     -The system automatically assigns integers to units that enter the map.
//     -Custom value of a unit is it's assigned integer
//     -GUI_UI_IndexUnit[number] is the unit for the number selected
//     -Replace the event "A unit enters the map" with "Game - GUI_UI_Event_Enter_Map becomes equal to 0.00"
//     -The event "Game - GUI_UI_Event_Decay becomes equal to 0.00" refers to when a unit is about to be
//       deallocated, this is so that you can get any information on the unit before it is removed
//       NOTE: this must only be used with instant triggers, the unit and integer are lost after 0.01 seconds
//     -GUI_UI_Triggering_Unit refers to the unit that just entered the map or is being deallocated for
//       the above events
//
//============================================================================
//=========================== CONFIGURABLE OPTIONS ===========================
//============================================================================

function GUI_UI_Index_Filter takes nothing returns boolean
    return GetUnitAbilityLevel(GetFilterUnit(), 'Aloc') <= 0
    //replace this^ line with "return true" if you want to index locusted units
endfunction

function GUI_UI_Deallocate_Filter takes unit u returns boolean
    return not IsUnitType(u, UNIT_TYPE_HERO)
    //replace this^ line with "return true" if you want to de-index decaying heroes
endfunction

//============================================================================
//========================= END CONFIGURABLE OPTIONS =========================
//============================================================================

function GUI_UI_Deallocate takes integer this returns boolean
    if GUI_UI_Deallocate_Filter(udg_GUI_UI_IndexUnit[this]) then
        set udg_GUI_UI_Triggering_Unit = udg_GUI_UI_IndexUnit[this]
        set udg_GUI_UI_Event_Decay = 1
        set udg_GUI_UI_Event_Decay = 0
        call TriggerSleepAction(0.01)
        call SetUnitUserData(udg_GUI_UI_IndexUnit[this], 0)
        set udg_GUI_UI_Recycle[this] = udg_GUI_UI_Recycle[0]
        set udg_GUI_UI_Recycle[0] = this
    endif
    return false
endfunction

function GUI_UI_Allocate takes nothing returns boolean
    local integer i = udg_GUI_UI_Recycle[0]
    local unit u = GetTriggerUnit()
    if GetUnitUserData(u) != 0 then
        if 0 == i then
            set udg_GUI_UI_ListSize = udg_GUI_UI_ListSize + 1
            call SetUnitUserData(u, udg_GUI_UI_ListSize)
            set udg_GUI_UI_IndexUnit[udg_GUI_UI_ListSize] = u
        else
            call SetUnitUserData(u, udg_GUI_UI_Recycle[0])
            set udg_GUI_UI_IndexUnit[udg_GUI_UI_Recycle[0]] = u
            set udg_GUI_UI_Recycle[0] = udg_GUI_UI_Recycle[udg_GUI_UI_Recycle[0]]
        endif
        set udg_GUI_UI_Triggering_Unit = u
        set udg_GUI_UI_Event_Enter_Map = 1
        set udg_GUI_UI_Event_Enter_Map = 0
    endif
    set u = null
    return false
endfunction

function InitFilter takes nothing returns boolean
    set udg_GUI_UI_ListSize = udg_GUI_UI_ListSize + 1
    call SetUnitUserData(GetFilterUnit(), udg_GUI_UI_ListSize)
    set udg_GUI_UI_IndexUnit[udg_GUI_UI_ListSize] = GetFilterUnit()
    return false
endfunction

function InitTrig_GUIUnitIndexing takes nothing returns nothing
    local trigger t = CreateTrigger()
    local region r = CreateRegion()
    call RegionAddRect(r, GetWorldBounds())
    call GroupEnumUnitsInRect(bj_lastCreatedGroup, GetWorldBounds(), Filter(function InitFilter))
    call TriggerAddCondition(t, Filter(function GUI_UI_Allocate))
    call TriggerRegisterEnterRegion(t, r, Filter(function GUI_UI_Index_Filter))
    set t = CreateTrigger()
    call TriggerAddCondition(t, Filter(function GUI_UI_Deallocate))
    call TriggerRegisterAnyUnitEventBJ(t, EVENT_PLAYER_UNIT_DECAY)
    set t = null
    set r = null
endfunction


EDIT:
If you copied it before this edit recopy it
 

Smitty

Member
Reaction score
20
Just quickly, can a unit cast a hero spell if it's given to it as a unit spell then made into a hero spell? :p

EDIT: Still not working ;-; I don't get the problem. Have you had it working yourself?
 

GFreak45

I didnt slap you, i high 5'd your face.
Reaction score
130
I have done almost all of this at work, i barely had time to compile it, i work 50 hrs a week and have 12 units this semester in school

did you get errors when you compiled it? and if so what line was hi-lighted and what did the errors say?
 

Smitty

Member
Reaction score
20
No compiling errors. And I'm not having a go, I just wondered. Really appreciate the work you've done, wouldn't be asking you to do more on my behalf ^^ I just don't get why it's not working :(
 

GFreak45

I didnt slap you, i high 5'd your face.
Reaction score
130
its fine, ill compile/fix this tomorow night when i have some free time, just struggling for air :*(
 

Smitty

Member
Reaction score
20
Don't rush it. I have a million other things to be working on with this map. It's so vast, but starting to look oh so good... Just whenever you have some time and motivation :)

Thanks for all so far ^^
 

Smitty

Member
Reaction score
20
By the way, your GUI unit indexing was crashing my WC3 every time a unit started to decay. Just so you're aware :) I was going through EVERY single trigger I had looking for the proble, tearing my hair out and all XD
 

GFreak45

I didnt slap you, i high 5'd your face.
Reaction score
130
ok i think thats because it was using a unit that had already decayed as an argument, i need to adjust that...

EDIT:
so here is the updated version, i added a variable GUI_UI_IsHero, so make sure to check that part, it should clear up the issue of crashing on decay
if you have any issues with it tell me

also, i added a changelog

JASS:
// GUI Unit Indexing v1.03
// by G_Freak45
// 
// Requires:
//   
//   -Some GUI knowledge and the attention span to read the "How to"
//
// How to:
//   
//   Implementation:
//     
//     -Create a new trigger named "GUIUnitIndexing"
//     -Copy and paste this code in there, deleting what is inside
//     -Create the unit array variable using an array size of 8191 named "GUI_UI_IndexUnit"
//     -Create the integer array variable using an array size of 8191 named "GUI_UI_Recycle"
//     -Create the boolean array variable using an array size of 8191 named "GUI_UI_IsHero"
//     -Create the integer variable named "GUI_UI_ListSize"
//     -Create the real variable named "GUI_UI_Event_Enter_Map"
//     -Create the real variable named "GUI_UI_Event_Decay"
//     -Create the unit variable named "GUI_UI_Triggering_Unit"
//     
//   Using the system:
//     
//     -The system automatically assigns integers to units that enter the map.
//     -Custom value of a unit is it's assigned integer
//     -GUI_UI_IndexUnit[number] is the unit for the number selected
//     -Replace the event "A unit enters the map" with "Game - GUI_UI_Event_Enter_Map becomes equal to 0.00"
//     -The event "Game - GUI_UI_Event_Decay becomes equal to 0.00" refers to when a unit is about to be
//       deallocated, this is so that you can get any information on the unit before it is removed
//       NOTE: this must only be used with instant triggers, the unit and integer are lost after 0.01 seconds
//     -GUI_UI_Triggering_Unit refers to the unit that just entered the map or is being deallocated for
//       the above events
//     
// Change Log:
//     
//                 Major Changes                                      Variable changes
//     
//     v1.00 - Test Release (for smitty)
//     v1.01 - Fixed Initialization to index existing units
//     v1.02 - Fixed Decay issue causing crashes (hopefully) - "GUI_UI_IsHero" variable added
//     v1.03 - Made the allocation method slightly quicker   - Was referencing a global instead of a local
//
//============================================================================
//=========================== CONFIGURABLE OPTIONS ===========================
//============================================================================

function GUI_UI_Index_Filter takes nothing returns boolean
    return GetUnitAbilityLevel(GetFilterUnit(), 'Aloc') <= 0
    //replace this^ line with "return true" if you want to index locusted units
endfunction

function GUI_UI_Deallocate_Filter takes integer this returns boolean
    return not udg_GUI_UI_IsHero[this]
    //replace this^ line with "return true" if you want to de-index decaying heroes
endfunction

//============================================================================
//========================= END CONFIGURABLE OPTIONS =========================
//============================================================================

function GUI_UI_Deallocate takes integer this returns boolean
    if GUI_UI_Deallocate_Filter(this) then
        set udg_GUI_UI_Triggering_Unit = udg_GUI_UI_IndexUnit[this]
        set udg_GUI_UI_Event_Decay = 1
        set udg_GUI_UI_Event_Decay = 0
        call TriggerSleepAction(0.01)
        call SetUnitUserData(udg_GUI_UI_IndexUnit[this], 0)
        set udg_GUI_UI_Recycle[this] = udg_GUI_UI_Recycle[0]
        set udg_GUI_UI_Recycle[0] = this
    endif
    return false
endfunction

function GUI_UI_Allocate takes nothing returns boolean
    local integer i = udg_GUI_UI_Recycle[0]
    local unit u = GetTriggerUnit()
    if GetUnitUserData(u) != 0 then
        if 0 == i then
            set udg_GUI_UI_ListSize = udg_GUI_UI_ListSize + 1
            call SetUnitUserData(u, udg_GUI_UI_ListSize)
            set udg_GUI_UI_IndexUnit[udg_GUI_UI_ListSize] = u
            set i = udg_GUI_UI_ListSize
        else
            call SetUnitUserData(u, i)
            set udg_GUI_UI_IndexUnit<i> = u
            set udg_GUI_UI_Recycle[0] = udg_GUI_UI_Recycle<i>
        endif
        if IsUnitType(u, UNIT_TYPE_HERO) then
            set udg_GUI_UI_IsHero<i> = true
        else
            set udg_GUI_UI_IsHero<i> = false
        endif
        set udg_GUI_UI_Triggering_Unit = u
        set udg_GUI_UI_Event_Enter_Map = 1
        set udg_GUI_UI_Event_Enter_Map = 0
    endif
    set u = null
    return false
endfunction

function InitFilter takes nothing returns boolean
    set udg_GUI_UI_ListSize = udg_GUI_UI_ListSize + 1
    call SetUnitUserData(GetFilterUnit(), udg_GUI_UI_ListSize)
    set udg_GUI_UI_IndexUnit[udg_GUI_UI_ListSize] = GetFilterUnit()
    return false
endfunction

function InitTrig_GUIUnitIndexing takes nothing returns nothing
    local trigger t = CreateTrigger()
    local region r = CreateRegion()
    call RegionAddRect(r, GetWorldBounds())
    call GroupEnumUnitsInRect(bj_lastCreatedGroup, GetWorldBounds(), Filter(function InitFilter))
    call TriggerAddCondition(t, Filter(function GUI_UI_Allocate))
    call TriggerRegisterEnterRegion(t, r, Filter(function GUI_UI_Index_Filter))
    set t = CreateTrigger()
    call TriggerAddCondition(t, Filter(function GUI_UI_Deallocate))
    call TriggerRegisterAnyUnitEventBJ(t, EVENT_PLAYER_UNIT_DECAY)
    set t = null
    set r = null
endfunction</i></i></i></i>
 

Smitty

Member
Reaction score
20
I'ma call this off, can't seem to get it working. I'll have another crack using GUI but then I think I'll lay it to rest ;-; first surrender :( Thanks very much for your time and help. rep anyway of course.
 
General chit-chat
Help Users
  • No one is chatting at the moment.

      The Helper Discord

      Staff online

      • Ghan
        Administrator - Servers are fun

      Members online

      Affiliates

      Hive Workshop NUON Dome World Editor Tutorials

      Network Sponsors

      Apex Steel Pipe - Buys and sells Steel Pipe.
      Top