Problem with making a semi-MUI spell

Erkki2

New Member
Reaction score
0
I'm trying to make a spell that creates a dummy unit at 90% chance to cast stun spell (sleep) to target. After 2-10 seconds (random) the buff should be removed from target unit. There may be several units casting this ability at the same time, but never more than 100. I'm using wait function so I must save target unit into a variable. But how can I do that? Is it possible using arrays?
 

skyblader

You're living only because it's illegal killing.
Reaction score
159
Er, ill whip up a trigger fer u.

Code:
ability
    Events
        Unit - A unit Is attacked
    Conditions
        (Attacking unit) Equal to UnitVariable
    Actions
        Set intergerVar = (Random integer number between 1 and 10)
        If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            If - Conditions
                intergerVar Less than or equal to 9
            Then - Actions
                Unit - Create 1 Dummy for (owner of (attacking unit)) at (position of (attacking unit)) facing Default building facing degrees
                Set UnitVariable = (Last created unit)
                Unit - Add Sleep to UnitVariable
                Unit - Order UnitVariable to Undead Dreadlord - Sleep (Triggering unit)
                Unit - Remove UnitVariable
            Else - Actions
Ok, all this does is, if u hit an enemy, 90% chance , a dummy will spawn and cast sleep on the unit and will be destroyed.
U have to create 2 unit variables, and 1 interger variable. If more than 1 of this happens at a type, dummy units might not go away, of course its ok, but it makes lag and so on.(and may not have a chance to cast sleep.) To solve this, u can get help from someone to loop this. Idk how. And also, at the start of the game, please set UnitVariable 1, to the hero. Lets say:
Code:
Event - A unit enters playable map area
condition - Unit type of triggering unit is so and so
Actions - Set unitvariable 1 to triggering unit
This works for if the hero can only be selected once. er if not, get help to loop(again). Its something like set variable, and then, set it to var+1, but it must be in a loop. Hope i helped.
 

darkbeer

Beer is Good!
Reaction score
84
@ skyblade: dont use teh remove function for the dummy, your way it will be removed before it even gets the cahcne to cast a spell, use a expiration timer instead much simpler.

easiest way are as often locals^^

Code:
ability
    Events
        Unit - Starts the effect of an ability
    Conditions
        Ability being cast == "whatever"
    Actions
        Custom script: local unit u = GetSpellTargetUnit()
        Set intergerVar = (Random integer number between 1 and 10)
        Set TempPoint = Position of (triggering unit)
        If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            If - Conditions
                intergerVar Less than or equal to 9
            Then - Actions
                Unit - Create 1 Dummy for (owner of (triggering unit)) at TempPoint facing Default building facing degrees
                Unit - Add Sleep to UnitVariable
                Unit - Order UnitVariable to Undead Dreadlord - Sleep (Triggering unit)
                Unit - Add 2 second generic expiration timer to Last created unit
                Custom script: call RemoveLocation(udg_TempPoint)
                Wait - Random integer between 2 and 10
                Custom script: set TempUnit = u
                Unit - Remove buff "UR BUFF" from TempUnit
            Else - Actions
 

skyblader

You're living only because it's illegal killing.
Reaction score
159
Lol my bad at the remove part but, idk how to use custom scripts so, lol.
 

Erkki2

New Member
Reaction score
0
I thought locals couldn't be used in if-then-else-functions. I tried it and it works perfectly. Thank you very much!
 

vypur85

Hibernate
Reaction score
803
Pseudo-locals cannot be used in conditions. But there's workaround. You can globalise it back and then use it.

Code:
    Actions
        Custom script: local unit u = GetSpellTargetUnit()
        Set intergerVar = (Random integer number between 1 and 10)
        Set TempPoint = Position of (triggering unit)
        [B]Set u = TempUnit[/B]
        If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            If - Conditions
                [B]TempUnit is alive Equal to True[/B]
                intergerVar Less than or equal to 9
            Then - Actions
        ....

This'll work. Anyway, this is just for future references since it's not related to the trigger you want :p.
 

MoonSlinger

I Love using Cheap Tricks... only Results matters
Reaction score
74
Shorter way which makes it totally MUI.

Object Editor
Make your dummy's spell have 9 levels (more if you need)
Lv1 - sleep 1s
Lv2 - sleep 2s
Lv3 - sleep 3s
etc... etc...

Trigger:
Code:
    Actions
        Set intergerVar = (Random integer number between 1 and 10)
        If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            If - Conditions
                intergerVar equal to 10
            Then - Actions
            Else - Actions
                Set TempPoint = Position of (triggering unit)
                Unit - Create 1 Dummy for (owner of (triggering unit)) at TempPoint facing Default building facing degrees
                Unit - Add Sleep to (Last created unit)
                Unit - Set level of Sleep for (Last created unit) to intergerVar 
                Unit - Order (Last created unit) to Undead Dreadlord - Sleep (Triggering unit)
                Unit - Add 2 second generic expiration timer to (Last created unit)
                Custom script: call RemoveLocation(udg_TempPoint)
 

Erkki2

New Member
Reaction score
0
Thanks for replies. Now I'm making a similar spell but AOE. There are only 1 vs 1 battles on my map, so I can set t to random enemy unit in the area of spell effect. I get an error:
Code:
Custom script:   set t = GroupPickRandomUnit(GetUnitsInRangeOfLocMatching(200.00, GetSpellTargetLoc(), Condition( IsPlayerEnemy(GetFilterPlayer(), GetOwningPlayer(GetTriggerUnit())) == true )
"Invalid argument type (boolean)"
I don't see any reason for the error. What's wrong?
 

AceHart

Your Friendly Neighborhood Admin
Reaction score
1,495

Erkki2

New Member
Reaction score
0
Thanks, I made it in jass and got it work.

Edit: I guess locals can't be used in loops?
 
General chit-chat
Help Users
  • No one is chatting at the moment.
  • Monovertex Monovertex:
    How are you all? :D
    +1
  • Ghan Ghan:
    Howdy
  • 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

      The Helper Discord

      Members online

      No members online now.

      Affiliates

      Hive Workshop NUON Dome World Editor Tutorials

      Network Sponsors

      Apex Steel Pipe - Buys and sells Steel Pipe.
      Top