Defend like ability help!

Grobak

New Member
Reaction score
1
Hi!

I want to create a spell, if possible auto-castable, that gives buffed units a defend like buff, so they get a chance to deflect arrows. I couldnt work out any solution so if someone can help i would greatly appreciate it.
 

GFreak45

I didnt slap you, i high 5'd your face.
Reaction score
130
Thats very difficult and would not be easy unless you were advanced, if you want an auto-cast ability that blocks damage, you could do something like this:

Base it off ice armor with nothing on it (no armor, 0.01 slow time, 0% slow, no special effect (cept the one you want))
Make another ability based off stoneskin (has a chance to block a specified damage ammount)

then make a trigger like this:
Trigger:
  • Defense Spell
    • Events
      • A unit finishes casting an ability
    • Conditions
      • Ability cast is equal to (your ability)
    • Actions
      • Custom Script: local unit u = GetSpellTargetUnit()
      • Unit - Add (stone form based ability) to (Target unit of ability cast)
      • Wait - 30.0 seconds (or however long you want)
      • Custom Script: set udg_Unit_Variable = u
      • Custom Script: set u = null
      • Unit - Remove (stone form based ability) from Unit_Variable
 

Accname

2D-Graphics enthusiast
Reaction score
1,462
Several problems with your posted answer:
1). You cannot remove the slow of ice armor, its hardcoded in the system, you can set the slow percentage of all ice spells directly in the gameplay constants though.
=> Better base spell is inner fire.

2). There is no "target unit" with the event "unit finishes casting".
=> Better use "unit starts the effect of an ability" instead.

3). Instead of using the hardened skin from the mountain giant you should rather use elunes grace which is exactly like defend but passive, use it in combination with a disabled spellbook to hide the icon.

Other then that the basic outlet of the trigger posted above should work.
 

GFreak45

I didnt slap you, i high 5'd your face.
Reaction score
130
Mah bad, havent done anything in the editor in forever, been working on C++ and playing SWTOR [noparse]>:D[/noparse]
 

Grobak

New Member
Reaction score
1
I couldnt get this working....i dont really understand those custom script thingies. Could you explain them a little more?

Edit: So I've found out a solution but im not sure its the best. I made two triggers, each with a peroidic event of 1 second, and made them pick every unit in the map, the first picked the ones with the buff of this ability, the second picked all units without this buff. The first gave the passive elunes grace to all picked units, the second removed, so the result is quite nice. My only doubt is that i know that with the pick every destructible trigger i cant pick all of the destructibles only a limited number, adn i dont know wether there is such a limit for picked units too.
 

GFreak45

I didnt slap you, i high 5'd your face.
Reaction score
130
a local variable is a variable unique to that trigger that run instance, basically, if that trigger runs again and you are using a normal variable it will be over-written, but with this variable, it saves the unit regardless of additional trigger runs, then we set your "normal" unit variable to the local in the line set udg_Unit_Variable = u, please note the udg_ as it is a prefix for variables when using them in custom scripts, also... ALL custom scripts are CASE SENSITIVE
 

KaerfNomekop

Swim, fishies. Swim through the veil of steel.
Reaction score
613
I highly doubt that there's a limit for Pick Every Unit actions. But instead of picking units WITHOUT the buff, you should add all units WITH the buff to a unit group, and in the same trigger check units in the group. If units in the unit group don't have the buff, then remove the Elune's Grace ability and remove them from the group. That way only those that have had the buff before will get checked, and stop getting checked once they lose the buff.
 

GFreak45

I didnt slap you, i high 5'd your face.
Reaction score
130
i believe there is a limit to the pick every unit function, because something that gui users dont realize is, groups are all the same, unit groups, doodad/destructible groups, player groups, all of them are the same type of variable. a group. so any limits on doodads would more than likely be the same with units, or something proportionally similar. You should use the trigger i posted slightly modified, you dont need to edit the custom scripts, just copy and past them.
 

NotInTheFace

Member
Reaction score
17
i believe there is a limit to the pick every unit function, because something that gui users dont realize is, groups are all the same, unit groups, doodad/destructible groups, player groups, all of them are the same type of variable. a group. so any limits on doodads would more than likely be the same with units, or something proportionally similar.

I'm afraid that this is mistaken. Unit groups and player groups are completely different, and there is no such thing as a destructible group. There is no group type. The limitations for iterating over destructibles and units are different.

Sorry, I normally just lurk, but it would be unfortunate if people were to get confused by mistaken information.
 

GFreak45

I didnt slap you, i high 5'd your face.
Reaction score
130
no you are right, my derp, i thought for a second i had stumbled upon something :/ for some reason i was under the impression there was a [ljass]GroupAddPlayer[/ljass] function which took a regular [ljass]group[/ljass] argument but i was mistaken, misread the functions list in JNGP

now that im using c++ i have a rough time distinguishing what is exactly "different" from something else, when i realized everything was made from integers everything both clicked and came dissassembled at once (even strings are just short integer arrays (-255 to 255) where [0] is the first character [1] is the second, etc...)
 

Accname

2D-Graphics enthusiast
Reaction score
1,462
[...]

now that im using c++ i have a rough time distinguishing what is exactly "different" from something else, when i realized everything was made from integers everything both clicked and came dissassembled at once (even strings are just short integer arrays (-255 to 255) where [0] is the first character [1] is the second, etc...)

Actually string are not integer arrays but char arrays. A char is an 8-bit-string which represents numbers from 0 to 255. If you use Ascii or UTF-8 at least.
If you use UTF-32 it would be made with integers, or something like integers. But who uses utf-8? That is enough space to save all symbols from all the common used languages around the world.
 

GFreak45

I didnt slap you, i high 5'd your face.
Reaction score
130
char = short integer hence why i said short integer -.- at least thats the way multiple proffessionals and high end tutorials have refered to it as... (my proffessor in my C++ class
and a char is not a string, if you do something like this:
JASS:

#include <iostream>

void main ()
{
    char c;
    while (int x = 0, x == 1, x = 0)
    {
        cout<<"Press any key to display the ASCII code, x to exit."
        cin>>c
        if (c == 'x')
        {
            break;
        }
        else
        {
            cout<<c
        }
    }
}

you will notice it displays integers, not letters when it outputs anything
also why you refer to char codes like this: 'letter' rather than "letter", its ASCII code for a letter; Note: the 'x' in the code, actually refers to: 78

EDIT: i just realized that its actually un-signed and 1 bit less than when i did the math, so you are right on that front, its 0-255 not -255 to 255
 

Accname

2D-Graphics enthusiast
Reaction score
1,462
And a char is not a string, but a string is an array of chars. A char is the smallest memory unit you can access with high level scripting languages. Its exactly 1 byte.
A "short integer" is a 2 byte unit. It cannot be used for ascii code, at least not for the format i know.
Maybe if you are using UTF-16 you are using short integers. But even then the elements of a string should be called chars although they are larger then 8 bit i guess.
 

GFreak45

I didnt slap you, i high 5'd your face.
Reaction score
130
i get what you were saying now, i guess its all in the way you look at it :/
 
General chit-chat
Help Users
  • No one is chatting at the moment.

      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