• Listen to a special audio message from Bill Roper to the Hive Workshop community (Bill is a former Vice President of Blizzard Entertainment, Producer, Designer, Musician, Voice Actor) 🔗Click here to hear his message!
  • Read Evilhog's interview with Gregory Alper, the original composer of the music for WarCraft: Orcs & Humans 🔗Click here to read the full interview.

Indexing system inside another indexing system? MUI things...

Status
Not open for further replies.
Level 14
Joined
Aug 8, 2010
Messages
1,022
Hi there! I wanna ask how i can create an ability. So i want when i cast the spell, some animations of the model to play (this is easy, LOL) and to damage all the enemies in an AoE every 0.5 seconds. The hard part is here : i want to slow enemies in this AoE every 0.5 seconds (when the damage occurs), and as time passes, the slow gets harder (the ability is a channel type ability, based off of Bladestorm). And when an unit is within this AoE for X period of time, it gets frozen.

So, the animation part is easy, lol. But i want this slow to get stronger and stronger as time passes. I will create a dummy slow ability with a set amount of levels. 1 lvl - 5% slow, 2 lvl - 15% slow, etc.
And now my question - how can i create a real variable FOR EACH UNIT IN THE AOE OF ALL THE INSTANCES OF THE SPELL that shows for how long the unit has been there (this variable will be increased as time passes, duh...)?
If i do this somehow, it will be easy afterwise. Every 0.5 seconds since the unit is in the AoE, i create a dummy and execute this slow dummy spell and each time, the level of this slow is greater than the previous (the level of this slow should also be stored in a variable).

So, when an unit stays within this AoE for 0.5 sec., slow lvl 1 is executed. If this unit stays for 1 sec, slow lvl 2 is executed, for 1.5 seconds, slow level 3 is executed. And when this time reaches 4 seconds (slow lvl 8), the target gets frozen for 3 seconds.

I know what is MUI, and i personally make spells MUI trough Hanky's Dynamic Indexing System but this spell will be kinda harder because i need to like... uhm... create a smaller indexing system in the bigger one... so this variable i talk about must have... 2 arrays? One of them displays the instance it is in, the second represents the number of the unit in the AoE for this instance?

BUT...

HOW should i do this? Help me, give me an idea, create a small trigger that represents your idea. I don't have triggers at the moment because i will start this spell after 2-3 days for which i'm sorry. I was SO curious to see the answer...

I reward with a +rep !
 
Level 25
Joined
Jun 5, 2008
Messages
2,573
Use combined hashtables and indexing.

Here is the basic idea:
Create a UnitData hashtable.
Every time a unit is affected by your spell do the following:
x = Load integer from UnitData, primary key = CurrentSpellIndex, secondary key = GetHandleId(unit).
set x = x +1
Save integer into UnitData, primary key = CurrentSpellIndex, secondary key = GetHandleId(unit), integer value = x

Do this in a periodic trigger of every Y seconds.
If you want the spell to freeze the target after Z seconds simply do the following:
If x >= Z/Y then
// freeze target, do actions.
// reset x?
endif

That is the base idea, this way casting the same spell nearby multiple times won't result in units getting frozen faster, if you want that, don't use spell index as a key.
Also saving / loading units data with Index key + Unit handle key ensures that the data is separate for every spell instance.
 
Level 14
Joined
Aug 8, 2010
Messages
1,022
This may be the solution, i will try but i forgot to mention something REALLY IMPORTANT. I aaam... not sure if you gave me a Jass explanation to the problem but if it IS Jass, then i need a GUI one. I am a GUIer... Had to mention this small little piece of information.

However, the idea would be almost the same.. LOL!

I think i get what you guys say. So i have to do the normal indexing (the Hanky system indexing) but i also have to create a hashtable to pick all units in an instance's AoE and create a variable for the time spended in the AoE that is stored within the unit's Handle ID with a string as a key for each unit. Then i load that variable and change it, right?
 
you dont need another index inside the indexing loop, just CHEAT the timer by making a real
variable, e.g. set realV[udg_index2] = 0
in your loop, say 0.05/sec do >>> realV[udg_index2] = realV[udg_index2] + 0.05, then put a condition:
  • Custom script: set realV[udg_index2] = realV[udg_index2] + 0.05
  • //Below this line is the condition
  • Custom script: if realV[udg_index2]==0.5 then
  • //Cast level 1 spell here, pick everything in AOE
  • Custom script: elseif realV[udg_index2]==1.0 then
  • //Cast level 2 spell here, pick everything in AOE
  • Custom script: elseif realV[udg_index2]==1.5 then
  • //Cast level 3 spell here, pick everything in AOE
  • Custom script: elseif realV[udg_index2]==4.0 then
  • //Cast level 8 spell here, pick everything in AOE
  • //And resets the realV cheat timer
  • Custom script: set realV[udg_index2] = 0
  • Custom script: endif
the thing is, the spell will not execute if the realV is not equal to 0.5/1/1.5/4...
 
Level 14
Joined
Aug 8, 2010
Messages
1,022
@mckill2009, i am... not sure if this is going to work and if you understood me. I think i know what you told me in your post but i think it won't be accurate. This
  • //Cast level 1 spell here, pick everything in AOE
worries me. It picks EVERYTHING in its AoE. What you made is to order the spell to slow enemies every 0.5, 1, 1.5, 4 seconds since IT'S CASTED. I want it to slow in those times since a unit has ENTERED THE AOE. Or... perhaps i don't understand you well. Could you give me a deeper explanation? I don't understand why i have to put a condition..

By the way, what timer i cheat? You haven't created a timer in your trigger. :D

+rep given to Kingz and mckill2009.
@defskull, i can't give rep to you because i have to spread some...
 
The timer I mentioned is 'Timer - Every 0.05 seconds of game time'

The trigger I made can do like this;
So, when an unit stays within this AoE for 0.5 sec., slow lvl 1 is executed. If this unit stays for 1 sec, slow lvl 2 is executed, for 1.5 seconds, slow level 3 is executed. And when this time reaches 4 seconds (slow lvl 8), the target gets frozen for 3 seconds.

But you need to add the frozen state when it reaches lvl 8, you this via;
  • Unit - Pause/Unpase
  • Animation - Change Unit Animation Speed
And needs to Unpause and Reset the unit's animation speed when spell ends...

Take note that this method can affect entering units, by the 'current' level of the dummy caster NOT the entering unit individually...

BUT, if you want the unit to be affected individually, then a hashtable, like Kingz explained...
 
Well to be honest I'd just use hashtables for this. Set an integer to keep track of the instances it has been looped on, then use the correct slow. It's really easy in hashtables but you have to bend over backwards in indexing to do it.

To show you what I mean

---Loop through all the units inside the unit group
------load handle from the unit
------set integer = load hash value of unit + 1
------Your integer is now the number of instances it has been looped
------ Create dummy, add corresponding slow and use (or use set movement speed)
------Hashtable - save integer as value ______
 
Level 33
Joined
Mar 27, 2008
Messages
8,035
Never use set movements speed, i had sever issues with it, permanently reducing units speed and such things.
That's because you're so bad in saving values before reducing it ;p
I faced this problem too, but I realize the current movement speed of the unit should be saved before we reduce it, and load it up once again after loop ends.

Let's say we have a spell that slows the unit by 50MS per second and lasts for 5 seconds.
Initially before we reduce the unit's speed, we save the current MS of that unit, let's say 450.

Spell Situation
1 Second = 400 MS
2 Second = 350 MS
3 Second = 300 MS
4 Second = 250 MS
5 Second = 200 MS

At the 5th Second, the spell would have ended by then, and at that time, we load the saved MS of that unit and set it to that unit (450 MS).

Of course this is the most basic spell example.

However, if there's like 3 Spells in your map that has the current mechanics (3 different abilities, but uses the same mechanics, reduce MS per second by using SetUnitMoveSpeed), there is totally a different approach to it as you can't simply set the loaded movement speed to that unit while 2 other instances is running.
I don't know, perhaps Indexing is the way since it will support Data Stacking.
 
Level 25
Joined
Jun 5, 2008
Messages
2,573
If a object editor spell raises your move speed to the max (522) and then you reinstate your speed odd effects may happen.

Not to mention
At the 5th Second, the spell would have ended by then, and at that time, we load the saved MS of that unit and set it to that unit (450 MS).

Might be a buffed unit move speed, thus you are permanently raising it's move speed after the spell.
Edit:

Point being, use object editor spells.
 
Level 33
Joined
Mar 27, 2008
Messages
8,035
Ah I forgot, it should be increase unit's current speed after load, not to set the unit's movement speed after load,

For example, you have a spell that slows the unit by 250 MS and that unit has 500 MS, note that this is a single-time spell, where the -MS will happen only once, lasts for 5 seconds.

After it is targeted, the unit's MS will be 250 MS (since 500 - 250 = 250), now save the reduction value, in this case, the reduction value is 250.

After the spell has ended, load the reduction value (250) and add it to unit's current movement speed (250) and we will have that unit as 500 MS.

Let's take example via Buffs.
Same spell, but you have an additional condition, there's a Slow Buff involve.
When the unit is targeted by the spell, as always, the unit's MS will become 250 MS, right ?
Now, the Slow, let's say it reduces 25% MS, now the unit will have 187.5 MS (25% reduce MS from 250 MS).
The Slow lasts for 3 seconds while the spell lasts for 5 seconds.

As you know, Slow Reduction Speed (Buffs/Abilities) will be updated by default by War3 Engine right ?
So we don't have to worry about Slow, what we have to worry is by that spell.

After 3 seconds, the unit's MS will become 250 MS (default update by War3 Engine), and the next 2 seconds (5th second), load the reduction value (250) and add it to current MS of that unit (250 + 250 = 500)

Now do you get it ?
 
Level 25
Joined
Jun 5, 2008
Messages
2,573
If you have a unit with 500 move speed.
You increase the speed by 50 via a spell.

After spell you reduce the speed by 50, resulting speed is:
472.

Being as adding 50 will cap out at 522, reducing 50 will result in 472, not 500.
Same thing applies to negative speed, it will bug out as hell.
Just use the damn object editor Add Move Speed ability (boots of speed).
 
Level 14
Joined
Aug 8, 2010
Messages
1,022
Kingz is right! You have to store the MS GIVEN when you start an ability. Because if you have a unit with 500 MS (max is 522, duh...) and you have a skill that gives 50 MS AND you cast it on that unit, you will only give 22 MS, not 50 and this must be stored because when the effect ends you have to remove 22 MS, so that then unit has 500 MS again, not 472.

EDIT : LOL, KINGZ! :D WE POSTED THE SAME FKN THING! :D (didn't refreshed the page to see your post...)
 
Well on the point of the original question - indexing system inside another indexing system, you don't actually need to and nor do you need to use hashtables, you just add them to the same loop but just use an ID as such to seperate which "part" of the loop that they're in as that the two different parts of the spell don't effect eachother, and then it's just like any other method, you just generate an MUI wait as such to be adding the speed reductions. It's actually really quite simple if you need a visual example I do a similar thing in a few of my spells, though most of them do it in a hashtable varient of it, I'd look at "Spirit Scorpions" from memory it has the most basic one I did, While typically used to freeze units after being "cursed" for so long in that spell, the general idea is apparent
 
Status
Not open for further replies.
Top