• 🏆 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!
  • 🏆 Hive's 6th HD Modeling Contest: Mechanical is now open! Design and model a mechanical creature, mechanized animal, a futuristic robotic being, or anything else your imagination can tinker with! 📅 Submissions close on June 30, 2024. Don't miss this opportunity to let your creativity shine! Enter now and show us your mechanical masterpiece! 🔗 Click here to enter!

Same Custom Value to all units with the same Unit-Type?

Status
Not open for further replies.
Level 20
Joined
Jul 14, 2011
Messages
3,213
I'm trying to make a damage system with multiple damage types. I want to give each unit-type some values (damage values and resistance values)... I've been trying to do this with hashtables for over 2 days, but doesn't work... But I should be able to call the values of the DamagedUnit and DamageSource based on their custom values, but then all the units of the same type must have the same custom value... And I think this would have conflict with Bribe's system, which I plan to use later...
 
Level 8
Joined
Dec 9, 2009
Messages
397
what system were you going to use?

In my map every creep as a different custom value, kind of it's identifier.
so most of my stats are saved in integer arrays with (custom value of unit) so each unit can have something different.

Would be more useful to you as that, in the initial loop to set the ID's you could

if
unit = unit type a
set attacktype[custom value of unit] = 1
else
if
unit = unit type b
set attacktype[custom value of unit] = 2
else
....
 
Level 20
Joined
Jul 14, 2011
Messages
3,213
Thanks a lot for your answer. While waiting, I managed to accomplish the half what I've been trying to do for over a week, and was quite easy, hehe. I successfully added Hashtable data to Unit Type ID. Now I need to know how to work this for heroes, since these values depends on players.

I solved this doing:
  • Damage Set
    • Events
      • Time - Elapsed game time is 0.00 seconds
    • Conditions
    • Actions
      • Hashtable - Create a hashtable
      • Set DamageHash = (Last created hashtable)
      • Custom script: set udg_i = 'hfoo'
      • Hashtable - Save 100.00 as 1 of i in DamageHash
      • Hashtable - Save 0.15 as 2 of i in DamageHash
And calling damage this way

  • Damage Itself
    • Events
      • Game - GDD_Event becomes Equal to 0.00
    • Conditions
    • Actions
      • Trigger - Turn off (This trigger)
      • Custom script: set udg_I_DS = GetUnitTypeId(udg_GDD_DamageSource)
      • Custom script: set udg_I_DU = GetUnitTypeId(udg_GDD_DamagedUnit)
      • Set PD = ((Load 1 of I_DS from DamageHash) x (1.00 - (Load 2 of I_DU from DamageHash)))
      • Custom script: call UnitDamageTarget(udg_GDD_DamageSource, udg_GDD_DamagedUnit, udg_PD, true, false, ATTACK_TYPE_HERO, DAMAGE_TYPE_NORMAL, WEAPON_TYPE_WHOKNOWS )
      • Trigger - Turn on (This trigger)
This is my Damage Table:
JASS:
1 - Physical Damage
2 - Physycal Resistance
3 - Fire Damage
4 - Fire Resistance
5 - Wind Damage
6 - Wind Resistance
7 - Earth Damage
8 - Earth Resistance
9 - Water Damage
10 - Water Resistance
11 - Pure Damage

I'm using '-st' to display the selected unit status (Damage and Resistance values), but if i say "Physical Damage", "Fire Damage", etc. all gets messed up. I need to know how to configure an 'ASCII' table to display the data.

It's like this right now:
attachment.php


I'd like it to be

JASS:
Unit name: Level ##
------------------------------
Physical Damage: #### / ###% Resistance
Fire     Damage: #### / ###% Resistance
Wind     Damage: #### / ###% Resistance
Earth    Damage: #### / ###% Resistance
Water    Damage: #### / ###% Resistance
Pure Damage: ####

Since warcraft 3 text characters doesn't have the same size, I doubt It's possible. If i say everything just like it's, It gets really messed up, and I'd like to have it... 'pretty'. BTW, if the unit has 0 dmg and 0% resistance, the value isn't displayed.
 

Attachments

  • Text.jpg
    Text.jpg
    35 KB · Views: 149
Last edited:
Level 7
Joined
Dec 3, 2006
Messages
339
Since warcraft 3 text characters doesn't have the same size, I doubt It's possible. If i say everything just like it's, It gets really messed up, and I'd like to have it... 'pretty'. BTW, if the unit has 0 dmg and 0% resistance, the value isn't displayed.

TextSplats could accomplish this since it has an align part in it:
http://www.hiveworkshop.com/forums/spells-569/textsplat-1-3-1-a-147358/

Though you'd have to place spaces or something for the digit parts and include some kind of check code for the values. This would take some work. You could use |n to get the next line which might help in organization.
 
Level 20
Joined
Jul 14, 2011
Messages
3,213
Hehe.. Thanks for taht Switch33, I had already seen that before, and didn't understand it, just like I didn't understand what you said.

I think it would require too much work for something so... trivial.

My other option was using a Multiboard... But again, too much work xD Maybe I'll just leave it like it's and hope for someone to help me with the project later :)
 
Now I need to know how to work this for heroes, since these values depends on players.

Does each player have only 1 hero? If so, then you can just create a separate hashtable for heroes and save under their player integer, and then whatever other key depending on which data you are saving.

You can also save the hero's rawcode as something like 'H000' * playerNumber if you need to. Then if you need to read it, just check if the unit is a hero, then if so, load the hashtable of their unitId * playerNumber (the owner of that hero).

For your other question about text alignment, I'm afraid that you have to just get used to disorder :\ even multiboards have varying character sizes. The only alternative would be probably to change the font of your map to something that does not have varying character sizes, but that would change the font of everything in that map which might not be the desired effect.
 
Level 20
Joined
Jul 14, 2011
Messages
3,213
@-Kobas- I struggled with Damage Engine for too long, and never felt comfortable with it. It seems like a good system, also everyone says that, but I still can't feel ok with it.

@PurgeandFire111 That's it! I noticed that, in numbers, all Units Id's are really long, like 34730663. In that case, using the same Hash using player number (1, 2, 3, 4, 5) should work and not have conflict with any other Unit ID.

About the text size, thanks to everyone. I'll leave it like it's right now. Since only values higher than 0 are displayed, the 'messyness' is not that much. In the worst of the cases, I could try another ways to display the data to simulate more order.

EDIT: I found a lot of trouble working with the Heroes... but that's another subject. I'll create a different thread for that.
 
Last edited:
Status
Not open for further replies.
Top