• 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.

[Spell] Help getting started with a spell involving Hashtables

Status
Not open for further replies.
Level 3
Joined
Aug 25, 2013
Messages
22
Hello Hive.

After being told that some spells I was looking to fix required Hashtables, I decided to read the tutorial and then make a spell using them

However I'm still kinda clueless on how to do it.

Here's what I want the spell to do
When cast on a unit, it creates a locust unit for 20 seconds. The locust unit attacks the target unit for the duration.
Then, each summoned locust unit grants the caster a raw bonus to damage and a %based movement speed bonus depending on the level (Let's say +5/6/7 to damage and +5/10/15% to movespeed), this effect stacks up to 5 times (meaning you can't have more than +25/30/35 to damage and +25/50/75% movespeed regardless of the amount of locusts alive.). This bonus is constantly updated based on the number of existing locusts (since they are locusts and invulnerable, it is not much of a problem since they only die when their time runs out).

The idea I had to make it:
1: Create 3 "Command Aura" spells with 5 levels each and 3 "Endurance aura" spells with 5 levels each for the whole stacks thing
2: Create a spellbook with 4 levels. At level 1 it holds no spells, at level 2,3,4 it contains Command/Endurance Aura 1/2/3. The hero in question has the spellbook as an ability.


However I'm completely unable to figure the trigger for it
I know I should use hashtables, but I don't know how I should proceed with it.
I figure I would need the following variables

2 Unit Variables (Caster and Target)
1 Point Variable (Target Location)
2 Integer Variables (Number of Stacks and Spell level)

But from that point onwards I'm kinda clueless

Could anyone shed some light on this?
Thanks in advance
 

yip

yip

Level 3
Joined
Jan 15, 2014
Messages
69
Hello Hive.

After being told that some spells I was looking to fix required Hashtables, I decided to read the tutorial and then make a spell using them

However I'm still kinda clueless on how to do it.

Here's what I want the spell to do
When cast on a unit, it creates a locust unit for 20 seconds. The locust unit attacks the target unit for the duration.
Then, each summoned locust unit grants the caster a raw bonus to damage and a %based movement speed bonus depending on the level (Let's say +5/6/7 to damage and +5/10/15% to movespeed), this effect stacks up to 5 times (meaning you can't have more than +25/30/35 to damage and +25/50/75% movespeed regardless of the amount of locusts alive.). This bonus is constantly updated based on the number of existing locusts (since they are locusts and invulnerable, it is not much of a problem since they only die when their time runs out).

The idea I had to make it:
1: Create 3 "Command Aura" spells with 5 levels each and 3 "Endurance aura" spells with 5 levels each for the whole stacks thing
2: Create a spellbook with 4 levels. At level 1 it holds no spells, at level 2,3,4 it contains Command/Endurance Aura 1/2/3. The hero in question has the spellbook as an ability.


However I'm completely unable to figure the trigger for it
I know I should use hashtables, but I don't know how I should proceed with it.
I figure I would need the following variables

2 Unit Variables (Caster and Target)
1 Point Variable (Target Location)
2 Integer Variables (Number of Stacks and Spell level)

But from that point onwards I'm kinda clueless

Could anyone shed some light on this?
Thanks in advance

You don't need hashtables or indexing unless you have more than one unit per player with this ability, methinks.

What triggers do you have so far? Do you know how to use dummy spellbooks and edit them? (I'm a total JASS noob btw, so I probably won't be able to help you if you don't use GUI.)

In short, I think it would be this:

1 - Unit starts effect of your ability, create your locust unit, set it's expiration timer to whatever you want and order it to attack the target of the ability being cast.

I'm not sure if it has a chase range though, just test that and in case it does you can have a periodic trigger order all units of the same type attack the target stored by a unit (preferrably array) variable.

2 - Have a periodic trigger set the level of the abilities in the spell book to the number of units of type (your locust) controlled by your player - as you suggested. (You can even use the timed attack order trigger if you need it.)

Another way would be to increase the spell levels by 1 every time a unit of unit type (your locust) spawned. Would work the same.

I don't think you'd even need integer variables, and no point variables either since it's a target-point spell (I'm assuming. Or at least, it should be.)

If you need more help on something specific let me know. Or if you really need to make it MUI (use hashtables/indexing etc.)
 
Status
Not open for further replies.
Top