Intelligence = Basic Attack damage?

Status
Not open for further replies.
Level 8
Joined
Jun 13, 2010
Messages
344
Hi guys,
Simple question:
How do I make a summoned unit deal damage equal to a percentage of the summoners intelligence?

Advanced question:
I am making a Shaman who summons a Spirit Wolf. So the Spirit Wolf is supposed to deal damage equal to the amount of intelligence the Shaman has. How do I fix that? It doesn't have to show the damage it deals on the Spirit Wolf, but as long as the damage is dealt to its target.

Thanks for reading!
 

Dr Super Good

Spell Reviewer
Level 64
Joined
Jan 18, 2005
Messages
27,243
How do I make a summoned unit deal damage equal to a percentage of the summoners intelligence?
Trigger all the summon unit's damaging abilities. For attack damage use some property modifying system or make your own by either using the "item ability level exploit" or tomes (which have to be removed after use to stop leaks).

I am making a Shaman who summons a Spirit Wolf. So the Spirit Wolf is supposed to deal damage equal to the amount of intelligence the Shaman has. How do I fix that? It doesn't have to show the damage it deals on the Spirit Wolf, but as long as the damage is dealt to its target.
Same as the above steps? Trigger damaging abilities and modify the summons attack damage. This is done when the unit is summoned and if an event for that is not available you can always trigger the entire summoning process.
 
The way I'd do it:

- Use a Unit Indexer
- Use a DDS

When the unit is summoned, store the summoner in a unit variable with the array as the index of the summoned unit. Then, each time the summoned unit deals damage, set the damage = the intelligence of the summoner.

This stores the summer for future identification. Using Bribe's Unit Indexer. (Just copy the one in the DDS linked below)
  • Summoning
    • Events
      • Unit - A unit Spawns a summoned unit
    • Conditions
      • (Unit-type of (Summoned unit)) Equal to Spirit Wolf
    • Actions
      • Set ID = (Custom value of Summoned Unit)
      • Set Summoner[ID] = (Summoning unit)
This sets the damage. Using Bribe's Damage Engine.
  • Modify Damage
    • Events
      • Game - DamageModifierEvent becomes Equal to 1.00
    • Conditions
      • (Unit-type of DamageEventSource) Equal to Spirit Wolf
    • Actions
      • Set ID = (Custom value of DamageEventSource)
      • Set DamageEventAmount = (Real((Intelligence of Summoner[ID] (Include bonuses))))
Also I guess set Summoner[ID] to No Unit when the spirit wolf dies.

Or use hashtables.
 
Last edited:

Chaosy

Tutorial Reviewer
Level 40
Joined
Jun 9, 2011
Messages
13,213
2d arrays are not that slow. It's true about that flushing though. Personal preference on my part, I don't like to import systems that requires other systems. Which is basically what this is. To create X import two systems.

So yeah, I just find hashtables superior in this situation as you only need two lines to use the hashtable (not including initializing of the hashtable) vs two systems. I am no speed demon.

edit: sure you need a small trigger to flush the hashtable but you also need a small trigger to (kind of) deindex with your system too apparently. @third trigger.
 
That's true and hashtables are an alternative, but they will get more and more complex as more systems need to be introduced in the map. With hashtables, there is no way to detect when a unit has been removed (with a summon, it's usually when the death event happens - but not if the summon was manually removed). A DDS is still needed to modify the damage, though, so technically there is just one potentially-unnecessary system to solve this problem.
 
Level 12
Joined
May 22, 2015
Messages
1,051
Assuming that you only mean attack damage, I think a stat modification system is the easiest solution (already mentioned by Dr Super Good). Just set the damage when you spawn the wolves to the caster's intelligence. They won't update if the caster's intelligence changes, but it won't require any cleaning up.
 

Dr Super Good

Spell Reviewer
Level 64
Joined
Jan 18, 2005
Messages
27,243
A DDS is still needed to modify the damage, though, so technically there is just one potentially-unnecessary system to solve this problem.
No you trigger all damaging summon abilities and then modify the summon's attack damage with a property system. No need for a damage detection system to implement it in a hacky way.

With hashtables, there is no way to detect when a unit has been removed (with a summon, it's usually when the death event happens - but not if the summon was manually removed).
Depending on requirements a polling system could be made that checks the validity of all parent handle keys. When such a handle is no longer valid (eg the unit it represented was removed) then it flushes the parent index. Although the detection is not immediate, it is inevitable so technically no leaks will occur.

Efficiency is not a concern as you might only need to run it every minute or check a parent every few seconds. Although the cleanup will not occur immediately, it will occur eventually. There should only ever be 1-2 hashtables per map that need this.

If only WC3 has the "Unit is Removed" event that SC2 has...
 
Level 8
Joined
Jun 13, 2010
Messages
344
Trigger all the summon unit's damaging abilities.

Do you mean an ability for the summoned unit?

Assuming that you only mean attack damage, I think a stat modification system is the easiest solution (already mentioned by Dr Super Good). Just set the damage when you spawn the wolves to the caster's intelligence. They won't update if the caster's intelligence changes, but it won't require any cleaning up.

How do I trigger the summoned units attack dmg = summoners intelligence?
 
Last edited by a moderator:
Status
Not open for further replies.
Top