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

Weapons, Armor, to infinity and beyond.

Status
Not open for further replies.
Level 4
Joined
Nov 10, 2008
Messages
84
Yeah, need triggers that prevent a hero from having more than two types of items in his inventory.

e.g:
Weapons: YOU FOOL, You cannot carry two Gigaton Hammers.
Armor: Yeah, whatever.
Accessory: 2 maximum.
Shields: I'm still stuck whether I should implement shields or not. Meh, I have the attachments.

Also, I need floating texts that display the damage done by a spell or an attack.
I have an idea of how to do this, but I don't like guessing that much. :D
 
Level 4
Joined
May 4, 2008
Messages
113
Heres one for show damage.

You need two triggers - one that fires off whenever a unit enters the map, and one to show the damage.

Teh first trigger is essentially this;

Code:
Events
 A unit enters playable map area

Actions
 Add to ShowDamage <gen> the event "(Entering unit) Takes damage"

Then, the second trigger (ShowDamage) is:

  • ShowDamage
    • Events
    • Conditions
      • (Damage taken) Greater than or equal to 1.00
    • Actions
      • Floating Text - Create floating text that reads (Player_Colors[(Player number of (Owner of (Damage source)))] + ((String((Integer((Damage taken))))) + |r)) above (Triggering unit) with Z offset 0.00, using font size 9.45, color (100.00%, 100.00%, 100.00%), and 0.00% transparency
      • Floating Text - Show (Last created floating text) for (All players)
      • Floating Text - Set the velocity of (Last created floating text) to 64.00 towards (Random real number between 60.00 and 120.00) degrees
      • Floating Text - Change (Last created floating text): Disable suspend state
      • Floating Text - Change the fading age of (Last created floating text) to 2.50 seconds
      • Floating Text - Change the lifespan of (Last created floating text) to 4.00 seconds
      • Floating Text - Change the lifespan of (Last created floating text) to 4.00 seconds
      • Floating Text - Change (Last created floating text): Disable permanence
The condition is to stop a bunch of 0's popping up every now and then.

For the conversion of Damage taken into a string, you have to do a Real to Integer with the damage taken, and then Integer to String to get the string. If you go straight from a Real to a String, your damage taken will come up with 12.421 and 19.865 and all this other nonsense.

The "Player_Colours" variable is an array with values set to the colour code of the respective player number's colour.

Hope that helps.

NOTE: If a unit say, enters a region that transports him to another region, the unit will be added to the event TWICE - to avoid this, you can use custom values. For example:

Code:
Events
 A unit enters playable map area

Conditions
 Custom value of (Triggering unit) Not equal to 50

Actions
 Add to ShowDamage <gen> the event "(Entering unit) Takes damage"
 Set Custom Value of (Triggering unit) to 50

There are other ways to do it if you are already using Custom value, such as adding an invisible ability that does nothing, or using point value.

Hope that helps!
 
That was nice one ZiggyMcjoney but I can tell you one thing!

That trigger will fail! Because it don't affect units that are already placed on map!

But if you create one dummy unit (delete model, make it invulnerable, add locust ability you know what I mean) anywhere on the map and then just add condition unit comes within 1000000000 range of that dummy unit!

You will create dmg system with only 1 trigger!
 
Level 7
Joined
Apr 12, 2009
Messages
188
Yeah, need triggers that prevent a hero from having more than two types of items in his inventory.

e.g:
Weapons: YOU FOOL, You cannot carry two Gigaton Hammers.
Armor: Yeah, whatever.
Accessory: 2 maximum.
Shields: I'm still stuck whether I should implement shields or not. Meh, I have the attachments.

Also, I need floating texts that display the damage done by a spell or an attack.
I have an idea of how to do this, but I don't like guessing that much. :D

Preventing a hero from having more than two types of items in his inventory:
  • Only One Blue Shard
    • Events
      • Unit - A unit Acquires an item
    • Conditions
      • And - All (Conditions) are true
        • Conditions
          • ((Triggering unit) is A Hero) Equal to True
          • (Item-type of (Item being manipulated)) Equal to |cff4263FFBlue Shard|r
    • Actions
      • Set ItemCollectingHero = (Hero manipulating item)
      • Set HeroHasArmor = 0
      • For each (Integer A) from 1 to 6, do (Actions)
        • Loop - Actions
          • Set ItemArray[(Integer A)] = (Item carried by ItemCollectingHero in slot (Integer A))
          • If ((Item-type of ItemArray[(Integer A)]) Equal to |cff4263FFBlue Shard|r) then do (Set HeroHasArmor = (HeroHasArmor + 1)) else do (Do nothing)
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • HeroHasArmor Greater than 1
        • Then - Actions
          • Hero - Drop (Item being manipulated) from ItemCollectingHero
          • Game - Display to (All players matching ((Matching player) Equal to (Owner of ItemCollectingHero))) the text: You may only carry ...
        • Else - Actions
Sorry the variable names are a little weird (ripped it from my map) but this prevents any unit from picking up two "Blue Shards" by checking the unit's inventory slot by slot to see if he has an item of type "Blue Shard". Hopefully it helps.

For floating damage text (seems like a lot of ppl are trying to figure this one out!) go to the link below, and install Weep's damage detection system in your map. It's an easy copy paste of 3 triggers.

GUI Friendly Damage Detection

Then you can make a trigger like this:

  • Create Text
    • Events
      • Game - GDD_Event becomes Equal to 0.00
    • Conditions
      • GDD_Damage Greater than 1.00
    • Actions
      • Floating Text - Create floating text that reads (String((Integer(GDD_Damage)))) above GDD_DamagedUnit with Z offset 0.00, using font size 8.00, color (100.00%, 14.00%, 14.00%), and 0.00% transparency
      • Floating Text - Hide (Last created floating text) for (All players matching ((Owner of GDD_DamageSource) Not equal to (Matching player)))
      • Floating Text - Change (Last created floating text): Disable permanence
      • Floating Text - Set the velocity of (Last created floating text) to (Random real number between 50.00 and 100.00) towards (Random real number between 70.00 and 110.00) degrees
      • Floating Text - Change the lifespan of (Last created floating text) to 2.00 seconds
      • Floating Text - Change the fading age of (Last created floating text) to 1.00 seconds

And obviously you could tailor it to your liking to have it do what you want. And there's lots of other stuff you can do with that damage detection system! It's a lot better than ZiggyMcjoney's method as it does not leak trigger events.

There are many more elaborate damage detection systems done in vJass out there, but this one will only take you 10 minutes to get working!
 
Level 4
Joined
May 4, 2008
Messages
113
That was nice one ZiggyMcjoney but I can tell you one thing!

That trigger will fail! Because it don't affect units that are already placed on map!

But if you create one dummy unit (delete model, make it invulnerable, add locust ability you know what I mean) anywhere on the map and then just add condition unit comes within 1000000000 range of that dummy unit!

You will create dmg system with only 1 trigger!

That's true, you could also do a unit-group action at map initialization to pick all units that are already on the map and then do the effect.

It's a bit of a fidgety trigger. A damage detection system works too, obviously, but I've never found I had to use them because I can do it all myself anyway with enough trial and error! :p
 
Level 4
Joined
Nov 10, 2008
Messages
84
Svenski's idea seems to be the most promising. I'm not too fond of weep's damage display system since it looks like it will flood the screen with too many messages, but I'm considering using it if no one can provide a suitable method to use. I prefer the floating messages but it poses a problem since it does not include units that are already on the map, like -Kobas- said.
 
Level 7
Joined
Apr 12, 2009
Messages
188
Svenski's idea seems to be the most promising. I'm not too fond of weep's damage display system since it looks like it will flood the screen with too many messages, but I'm considering using it if no one can provide a suitable method to use. I prefer the floating messages but it poses a problem since it does not include units that are already on the map, like -Kobas- said.

Weeps system really doesn't have anything to do with how many messages pop up. In my example trigger for creating the floating text, this line:

  • Floating Text - Hide (Last created floating text) for (All players matching ((Owner of GDD_DamageSource) Not equal to (Matching player)))
...prevents the text from spamming from all players dealing damage, only showing the damage your units do. You could filter it even further if you want, to only show damage from/to a specific unit, or whatever you want, using GDD_DamagedUnit and GDD_DamageSource for comparisons. My condition:

  • Conditions
    • GDD_Damage Greater than 1.00
...filters out damages that are less than 1. You could filter out damage that is below 50 if you really wanted.

Plus the system accounts for all units on the map at initialization, and units added in the future :D

The only limitations that I find annoying are that you can't tell if the damage is spell or physical (or other various types), and it can't pick up healing.

If you want to see it in action, test out my Basement Defense :D
 
Status
Not open for further replies.
Top