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.
  • Ghan Ghan:
    Still lurking
    +3
  • The Helper The Helper:
    I am great and it is fantastic to see you my friend!
    +1
  • The Helper The Helper:
    If you are new to the site please check out the Recipe and Food Forum https://www.thehelper.net/forums/recipes-and-food.220/
  • Monovertex Monovertex:
    How come you're so into recipes lately? Never saw this much interest in this topic in the old days of TH.net
  • Monovertex Monovertex:
    Hmm, how do I change my signature?
  • tom_mai78101 tom_mai78101:
    Signatures can be edit in your account profile. As for the old stuffs, I'm thinking it's because Blizzard is now under Microsoft, and because of Microsoft Xbox going the way it is, it's dreadful.
  • The Helper The Helper:
    I am not big on the recipes I am just promoting them - I use the site as a practice place promoting stuff
    +2
  • Monovertex Monovertex:
    @tom_mai78101 I must be blind. If I go on my profile I don't see any area to edit the signature; If I go to account details (settings) I don't see any signature area either.
  • The Helper The Helper:
    You can get there if you click the bell icon (alerts) and choose preferences from the bottom, signature will be in the menu on the left there https://www.thehelper.net/account/preferences
  • The Helper The Helper:
    I think I need to split the Sci/Tech news forum into 2 one for Science and one for Tech but I am hating all the moving of posts I would have to do
  • The Helper The Helper:
    What is up Old Mountain Shadow?
  • The Helper The Helper:
    Happy Thursday!
    +1
  • Varine Varine:
    Crazy how much 3d printing has come in the last few years. Sad that it's not as easily modifiable though
  • Varine Varine:
    I bought an Ender 3 during the pandemic and tinkered with it all the time. Just bought a Sovol, not as easy. I'm trying to make it use a different nozzle because I have a fuck ton of Volcanos, and they use what is basically a modified volcano that is just a smidge longer, and almost every part on this thing needs to be redone to make it work
  • Varine Varine:
    Luckily I have a 3d printer for that, I guess. But it's ridiculous. The regular volcanos are 21mm, these Sovol versions are about 23.5mm
  • Varine Varine:
    So, 2.5mm longer. But the thing that measures the bed is about 1.5mm above the nozzle, so if I swap it with a volcano then I'm 1mm behind it. So cool, new bracket to swap that, but THEN the fan shroud to direct air at the part is ALSO going to be .5mm to low, and so I need to redo that, but by doing that it is a little bit off where it should be blowing and it's throwing it at the heating block instead of the part, and fuck man
  • Varine Varine:
    I didn't realize they designed this entire thing to NOT be modded. I would have just got a fucking Bambu if I knew that, the whole point was I could fuck with this. And no one else makes shit for Sovol so I have to go through them, and they have... interesting pricing models. So I have a new extruder altogether that I'm taking apart and going to just design a whole new one to use my nozzles. Dumb design.
  • Varine Varine:
    Can't just buy a new heatblock, you need to get a whole hotend - so block, heater cartridge, thermistor, heatbreak, and nozzle. And they put this fucking paste in there so I can't take the thermistor or cartridge out with any ease, that's 30 dollars. Or you can get the whole extrudor with the direct driver AND that heatblock for like 50, but you still can't get any of it to come apart
  • Varine Varine:
    Partsbuilt has individual parts I found but they're expensive. I think I can get bits swapped around and make this work with generic shit though
  • Ghan Ghan:
    Heard Houston got hit pretty bad by storms last night. Hope all is well with TH.
  • The Helper The Helper:
    Power back on finally - all is good here no damage
    +2
  • V-SNES V-SNES:
    Happy Friday!
    +1
  • The Helper The Helper:
    New recipe is another summer dessert Berry and Peach Cheesecake - https://www.thehelper.net/threads/recipe-berry-and-peach-cheesecake.194169/

      The Helper Discord

      Members online

      Affiliates

      Hive Workshop NUON Dome World Editor Tutorials

      Network Sponsors

      Apex Steel Pipe - Buys and sells Steel Pipe.
      Top