• 🏆 Texturing Contest #33 is OPEN! Contestants must re-texture a SD unit model found in-game (Warcraft 3 Classic), recreating the unit into a peaceful NPC version. 🔗Click here to enter!
  • It's time for the first HD Modeling Contest of 2024. Join the theme discussion for Hive's HD Modeling Contest #6! Click here to post your idea!

What do you think about how this system has been created?

Status
Not open for further replies.
Level 3
Joined
Apr 21, 2012
Messages
33
Well, first I would like to say that this is not my own idea! I just saw it in DotA map and I wonder too much how this has been coded, so I start the thread because I think there are many great people here that can make some discussion.

That system is Invoker's orb system, but for some that don't play DotA I have explained below:

Invoker has 3 abilities: Quas, Wex, Exort and one ultimate Invoke. Quas will call water orb that give you extra health regen rate per orb.(Also has special effect frost orb circle around hero). Wex is the same but give extra movement and attack speed, and Exort will give extra damage.

You can only have maximum 3 orbs at a time, which can be all mix between those 3 orbs. If you already has 3 orbs and you call for another one, the oldest orb will be replaced by the new one.

And then if you use Invoke, you will get a new ability that base on orbs that you have right now. For example: If you have 3 Quas you will get Cold Snap, and if you have 1 Wex and 2 Exort you will get Chaos Methor and etc.

I wanna see your discussion about how these has been created, I have some programming experience and world editor experience so feel free to use whatever you want to explain. Thanks!
 

Kusanagi Kuro

Hosted Project: SC
Level 10
Joined
Mar 11, 2012
Messages
708
I play DotA too. And here is my opinion:
First, I think the Quas, Exort, Wex is base on Sphere ability, that's how the orb appear on Invoker, and they're just dummy spell. Nothing to do with them.
Second, I think u can make trigger so that when Invoker press Quas, it will give him an item regeneration ability which will increase level each time u press Quas. Each Level of Quas will give u different item regeneration ability. Wex and Exort also work in the same way.
About the Invoke spell, I think it will check the level of the ability which Wex, Exort, Quas give u when u press them.
That's all. Hope I dont use wrong grammar. :))
 
Level 25
Joined
Jul 10, 2006
Messages
3,315
The current orb order is saved either as 3 integers (one for each orb, e.g. 132 for Quas Exort Wex), or a string (e.g. QEW). When the Invoke spell is cast, the game looks at this combination and converts that into an index number for the spell list, and gives that spell, overwriting the old one. The current spells are saved using variables.
 
Level 28
Joined
Jan 26, 2007
Messages
4,789
Bonus Stats:
It is very easy to give bonus stats to a unit. Earth-Fury's Bonus Mod-system works like a charm (though it has been removed from the hive because he got banned).
You basically could do something like UnitSetBonus( unit, BONUS_LIFE_REGEN, 10 ) and it would give the unit +10 HP regen (other stats can be increased the same way).


Maximum Orbs:
Just set a variable to the amount of orbs you currently have.


Ultimate Invoke:
You can do this with a fake triple array.
A triple array would look like: "Set OrbAbility[3][0][0] = Cold Snap" (3 Quas, 0 Wex, 0 Exort), or "Set OrbAbility[0][1][2] = Chaos Meteor" (0 Quas, 1 Wex, 2 Exort).
To fake this, it basically becomes "Set OrbAbility[ Quas*16 + Wex*4 + Exort ] = Ability".
Once you've got this, you can easily derive which ability to give without a loop or ITE's or whatever.
 
Last edited:
Level 3
Joined
Apr 21, 2012
Messages
33
Bonus Stats:
It is very easy to give bonus stats to a unit. Earth-Fury's Bonus Mod-system works like a charm (though it has been removed from the hive because he got banned).
You basically could do something like UnitSetBonus( unit, BONUS_LIFE_REGEN, 10 ) and it would give the unit +10 HP regen (other stats can be increased the same way).


Maximum Orbs:
Just set a variable to the amount of orbs you currently have.


Ultimate Invoke:
You can do this with a fake triple array.
A triple array would look like: "Set OrbAbility[3][0][0] = Cold Snap" (3 Quas, 0 Wex, 0 Exort), or "Set OrbAbility[0][1][2] = Chaos Meteor" (0 Quas, 1 Wex, 2 Exort).
To fake this, it basically becomes "Set OrbAbility[ Quas*16 + Wex*4 + Exort ] = Ability".
Once you've got this, you can easily derive which ability to give without a loop or ITE's or whatever.

I understand the bonus part and invoke part, but I don't get the maximum orb part. How to remove the oldest one then if you reach the limit?
Also, How to declare triple arrays in WE? I never seen it before in map editing. and how the 16 and 4 come? I guess it's something about hexadecimal, but can you explain a little more?
Anyway thanks a lot! +REP to everyone of course!
 
Level 12
Joined
Oct 16, 2010
Messages
680
he's just faked the triple array

like you want double array [a] you can do it like array [c + a*b]

so you get something like this _ _ _ _ _ | _ _ _ _ _ | _ _ _ _ _ | _ _ _ _ _ | _ _ _ _ _

eg: in array [5][5] - you can refer to array [2][2] as array [2 + 5*2]
like you have an array and slice it into pieces.

same with array [a][c] ------> refer to one of its item as array [ d + a * e + a * b * f]
 
Level 28
Joined
Jan 26, 2007
Messages
4,789
Lender is completely correct. The WE cannot handle triple arrays (not even double), so we have to fake them.
Because you already know the max arrays (you can have 0-3 orbs, so each array can go from [0] to [3]), you can work without the use of a lot of variables for our array.

You've got 3 arrays, each ranging from 0 to 3. That means there are 4 possibilities, so you set the array to:
( 42 * Array1 ) + ( 41 * Array2 ) + ( 40 * Array3 )​
(This is the equivalent of [Array1][Array2][Array3] by the way).
Simplified, this gives us
( 16 * Array1 ) + ( 4 * Array2 ) + Array3​

This means that orbAmount[ (16 * 2) + ( 4 * 0 ) + 3 ] is the logical equivalent of orbAmount[2][0][3].

Once all variables are set up, you can just do call addAbility( GetTriggerUnit(), Quas, Wex, Exort) and it will instantly know which ability to add without counting the orbs, without looping through them, without If/Then/Elses (ITE's).
(You don't even need to create the function "addAbility", it's just to make it more readable - you can also add the ability without calling another function).


Edit: the downside is that the arrays can't be too big. You can have a maximum of [20][20][20] with an equal array size for every array (the formula would also be different by the way :p).
 
Level 3
Joined
Apr 21, 2012
Messages
33
Yeah I see it now, thanks!
BTW I still wonder about the orb limiting and replacing.
 
Level 28
Joined
Jan 26, 2007
Messages
4,789
I'll talk about both of them at the same time.
(Little note: I will have to change the previous triple array slightly as well, I will do my best at explaining how and why).

So you can have 2 variables:
integer array orbType
integer orbAmount
(Maybe a third one to store the sphere-spell in - could come in handy :D).

For the integer stored in "orbType", we won't use 1, 2, 3 (nor 0, 1, 2), but rather 1, 4, 16 (see the reference to the triple array? :D).
So when an ability is cast, you can do:
JASS:
// Set Orb-details

set orbAmount = orbAmount +1
set orbType[orbAmount] = 1/4/16
// orbType = 16: Quas
// orbType =  4: Wex
// orbType =  1: Exort
Since those abilities are probably separate triggers, you can easily set orbType to the correct value (inside the Wex-spell, set it to 4 for example).

But when you already have 3 orbs, then:
JASS:
if orbAmount == 3 then
    set orbType[1] = orbType[2]
    set orbType[2] = orbType[3]
    set orbType[3] = 1/4/16
endif
(I think the order matters, so I've maintained their order while removing the oldest orb)
So when a new spell is cast, you overwrite the oldest orb and then rewrite the newest one.
This both limits the amount of orbs as well as replaces them.


Now the triple array changes as well.
Instead of having to multiply each array with the amount of orbs, you can just do:
orbAbility[ orbType[1] + orbType[2] + orbType[3] ]​
And this will also always returns the correct ability for all orb combinations.

Little example:
New method: 16 + 4 + 4 = 24
Old method: 16 * 1 + 4 * 2 + 0 = 16 + 8 = 24

So now you don't even need any variables to count the amount of each orb, you need about 4 variables total for limiting and replacing the orbs and getting the correct ability.
(orbType, orbAmount orbAbility and orbSphereAbility - did I miss something?)


I hope you can see the logic in this.
Good luck, and don't hesitate if you've got any questions left unanswered.
 
Level 3
Joined
Apr 21, 2012
Messages
33
ap0calypse, Has I ever told you that you are like the light of the god that clear out the cloud in my mind! That's very awesome. Thanks!

I give you another REP with this, again thanks for your kind. :)

EDIT: Well I know this is a little off-topic and I don't know whether I can ask something like this, but do you have any copy of Earth-Fury's Bonus Mod-system? I lost mine when I formatted my computer.
 
Status
Not open for further replies.
Top