Complicated trigger spell help

Smitty

Member
Reaction score
20
I vaguely remember the reason I had trouble installing newgen was because I'm on a mac, although I have to say I never really tried that hard, always worked around it. Just checking, anyone know where I can get me a mac version? Or am I being intolerably stupid? >.<
 

Smitty

Member
Reaction score
20
Yep. Leaves me kinda fuxed. Presumably newgen isn't a requirement to actually use this spell? I've not yet found it to be overly inhibiting, or restricting in what I can and can't do.
 

GFreak45

I didnt slap you, i high 5'd your face.
Reaction score
130
NewGen adds the following:
Libraries
Scopes
Structs
Textmacros
Modules
Methods (functions in structs)

And both the spell and all of it's requirements have a requirement of NewGen (Or at least JassHelper)
 

Smitty

Member
Reaction score
20
So I can't use that :( buggeration, I guess I'll just send you a slice of a cake ;-; thanks for trying anyways.
 

Smitty

Member
Reaction score
20
Sorry to double post, but; what do I need to do to this to allow me to use it without newgen? :s
 

GFreak45

I didnt slap you, i high 5'd your face.
Reaction score
130
it becomes way more complicated, ill make something that works without it though...
 

GFreak45

I didnt slap you, i high 5'd your face.
Reaction score
130
You will need a unit indexing system for this to work, one that uses a variable or function to store the units saved, and make sure to edit the settings (first function) and the line: [ljass]set u = whichUnit[this][/ljass] to propperly reference the unit saved in the index (this), if it is a variable, replace [ljass]whichUnit[/ljass] with [ljass]udg_VariableName[/ljass] or if it is a function that takes an integer and returns the unit use something like this: [ljass]set u = FunctionName(this)[/ljass]

Implementation:
  • Create a new trigger named StaticShock
  • Edit -> Convert to custom text
  • Delete whats inside and paste the code there
  • Edit the function: [ljass]SetSettings[/ljass]
  • Create the variables listed below
  • Try to save the map
  • If you got any errors tell me, do not worry the map will have saved, but you wont be able to open it in game until you delete my code or i fix the error, you will be able to open it in the editor though.

You will need the following variables:

Integer array [8190] variable: SS_NEXT
Integer array [8190] variable: SS_PREV
Player array [8190] variable: SS_CASTER
Boolean array [8190] variable: SS_SHOCKED

Integer variable: SS_ABIL_ID
Integer variable: SS_DUMMY_ID
Integer variable: SS_BUFF_ID
Real variable: SS_RADIUS
Real variable: SS_FREQUENCY
Boolean variable: SS_PAUSED
Timer variable: SS_TIMER
String variable: SS_CAST_STRING

JASS:
function SS_SetSettings takes nothing returns nothing
    set udg_SS_ABIL_ID = &#039;A000&#039;  //the id for the ability
    set udg_SS_DUMMY_ID = &#039;hfoo&#039; //dummy unit used to cast the ability to bounce
    set udg_SS_BUFF_ID = &#039;A000&#039;  //the id for the buff that the ability applies
    set udg_SS_CAST_STRING = &quot;&quot;  //put the cast string inside the &quot;&quot;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

function SS_PERIODIC takes nothing returns nothing
    local integer this = udg_SS_NEXT[0]
    local unit u
    local unit a
    local real x
    local real y
    loop
        exitwhen 0 == this
        set u = whichUnit[this] //&lt;----- replace whichUnit with the variable holding the units for each index
        if 0 &lt; GetUnitAbilityLevel(u, udg_SS_BUFF_ID) then
            set x = GetUnitX(u)
            set y = GetUnitY(u)
            call GroupEnumUnitsInRange(bj_lastCreatedGroup, x, y, udg_SS_RADIUS, null)
            loop
                set a = FirstOfGroup(bj_lastCreatedGroup)
                exitwhen a == null
                if IsUnitAlly(a, GetOwningPlayer(u)) and IsUnitType(a, UNIT_TYPE_HERO) then
                    call CreateUnit(udg_SS_CASTER[this], udg_SS_DUMMY_ID, x, y)
                    call UnitApplyTimedLife(bj_lastCreatedUnit, 0, 3)
                    call IssueTargetOrder(bj_lastCreatedUnit, udg_SS_CAST_STRING, a)
                endif
                call GroupRemoveUnit(bj_lastCreatedGroup, a)
            endloop
            set this = udg_SS_NEXT[this]
        else
            set this = udg_SS_NEXT[this]
            set udg_SS_SHOCKED[udg_SS_PREV[this]] = false
            set udg_SS_NEXT[udg_SS_PREV[udg_SS_PREV[this]]] = this
            set udg_SS_PREV[this] = udg_SS_PREV[udg_SS_PREV[this]]
            if 0 == udg_SS_NEXT[0] then
                call PauseTimer(udg_SS_TIMER)
                set udg_SS_PAUSED = true
            endif
        endif
    endloop
    set u = null
endfunction

function SS_OnCast takes nothing returns boolean
    local integer this = GetUnitUserData(GetTriggerUnit())
    if GetSpellAbilityId() == udg_SS_ABIL_ID then
        if not udg_SS_PAUSED then
            call TimerStart(udg_SS_TIMER, udg_SS_FREQUENCY, true, function SS_Periodic)
            set udg_SS_PAUSED = false
        endif
        if not udg_SS_SHOCKED[this]
            set udg_SS_NEXT[this] = 0
            set udg_SS_PREV[this] = udg_SS_PREV[0]
            set udg_SS_NEXT[udg_SS_PREV[0]] = this
            set udg_SS_PREV[0] = this
            set udg_SS_SHOCKED[this] = true
        endif
        set udg_SS_CASTER[this] = GetOwningPlayer(GetTriggerUnit())
    endif
    return false
endfunction

function Init_Trig_StaticShock takes nothing returns nothing
    local trigger t = CreateTrigger()
    call SS_SetSettings()
    call TriggerAddCondition(t, Filter(function SS_OnCast))
    call TriggerRegisterAnyUnitEventBJ(t, EVENT_PLAYER_UNIT_SPELL_EFFECT)
    set udg_SS_TIMER = CreateTimer()
    call TimerStart(udg_SS_TIMER, udg_SS_FREQUENCY, true, function SS_Periodic)
    set t = null
endfunction


DISCLAIMER: i have not gotten to compile this, will do so when i get home, but it should work without JNGP
 

Smitty

Member
Reaction score
20
You, sir, are a legend of decidedly epic proportions. I may need a small amount of help implementing this, but straight away I shall dispatch to you a cake of the finest quality. Not able to test it yet, but thanks :D
 

GFreak45

I didnt slap you, i high 5'd your face.
Reaction score
130
kk :) i expect it within 2 weeks :p, there will probably be issues with it at first but ill deal with them when i get home tonight
 

Smitty

Member
Reaction score
20
Yeh, might need you to explain some of that 'unit index variable' stuff. Not able to try it yet, but :D!!
 

Smitty

Member
Reaction score
20
I'm being stupid... How do i even get this into a trigger? XD

No, really, I'm not that bad usually, but for the life of me I can't seem to get this thing integrated :(

EDIT: OK, so I got that far... creating variables and stuff, might need you to explain a small amount regarding the trigger. Can't say I understand... any of it. Giving it a whirl but expect cries for help soon :)

RE-EDIT: Only part I seem to be having a problem with is the 'whichunit' part. When you say 'variable holding the units for each index' I have no idea what you mean :] Turns up 32 compile errors also :p
 

GFreak45

I didnt slap you, i high 5'd your face.
Reaction score
130
ok the 32 compile errors is actually good, that usually means there is 1 issue with referencing a variable in creation... and you need an indexing system for this to work, i would go with the GUI AIDS indexing system cuz it works for GUI users...

the whichUnit is the way you get which unit it is checking at the moment, whatever unit is [this] when this is an integer variable, so like if your unit is unit number 1, then this = 1, therefore its whichUnit[1] which would be your unit, get it?
 

Smitty

Member
Reaction score
20
Right. No. So what exactly am I replacing in that part? The 'This'?

EDIT: hang on, does that refer to a unit array variable? :s

RE-EDIT: Just realised, unit indexing thingumy needed. Right, I'll grab that and see if this makes more sense :)
 

Smitty

Member
Reaction score
20
Ok, got my hands on AIDS, just working out how to match the two together... I think I want AIDS_IndexUnit, but I can't know because I can't test the map :p Any movement on those compiling errors? And massive thanks for the support, sorry to be a JASS nub :(
 

GFreak45

I didnt slap you, i high 5'd your face.
Reaction score
130
well before i can do anything you need the indexing system working, make sure u are using the GUI one, not the jass one
after that copy and paste the errors you get once it is...
 

Smitty

Member
Reaction score
20
Got it working, 11 errors. Here goes;

Line 364: Invalid number of arguments
Line 388: Expected a function name
Line 391: Expected 'then'
Line 399: Expected 'endif'
Line 402: Need return value in function
Line 404: Expected end of line
Line 406: Expected a name
Line 407: Expected a name
Line 409: expected a function name
Line 410: Expected a variable name
Line 410: Expected 'endif'

Thanks for all the help so far. Your first piece of cake is on its way. I couldn't find your address though so I sent one to every address. EVERY. ADDRESS.
 

GFreak45

I didnt slap you, i high 5'd your face.
Reaction score
130
ill have time to wrap this up in about an hour and 20 mins
 
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

      Staff online

      Members online

      Affiliates

      Hive Workshop NUON Dome World Editor Tutorials

      Network Sponsors

      Apex Steel Pipe - Buys and sells Steel Pipe.
      Top