1. Find your way through the deepest dungeon in the 18th Mini Mapping Contest Poll.
    Dismiss Notice
  2. A brave new world lies beyond the seven seas. Join the 34th Modeling Contest today!
    Dismiss Notice
  3. Check out the Staff job openings thread.
    Dismiss Notice
Dismiss Notice
Hive 3 Remoosed BETA - NOW LIVE. Go check it out at BETA Hive Workshop! Post your feedback in this new forum BETA Feedback.
Dismiss Notice
60,000 passwords have been reset on July 8, 2019. If you cannot login, read this.

Weapons, Armor, to infinity and beyond.

Discussion in 'Triggers & Scripts' started by Mystic_Revelation, Apr 5, 2010.

  1. Mystic_Revelation

    Mystic_Revelation

    Joined:
    Nov 10, 2008
    Messages:
    45
    Resources:
    0
    Resources:
    0
    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
     
  2. -Kobas-

    -Kobas-

    Joined:
    Jan 17, 2010
    Messages:
    5,892
    Resources:
    28
    Icons:
    1
    Tools:
    2
    Maps:
    10
    Spells:
    4
    Template:
    5
    Tutorials:
    6
    Resources:
    28
    Dude I just made tutorial about that! Check it IDS if you still need any help pm me!

    EDIT: And about that Damage Show system i can help but I re-edit system from some guy out there because it wasn't working in my map so It will be fail if you credit only me (I don't know that dude name :sad:)
     
  3. supertoinkz

    supertoinkz

    Joined:
    Dec 29, 2008
    Messages:
    2,814
    Resources:
    25
    Models:
    15
    Icons:
    7
    Maps:
    1
    Tutorials:
    2
    Resources:
    25
    Use -Kobas-'s tutorial/system/spell/whatever
    For the damage to show, copy and paste Critical, set the levels to 1 and damage multiplier to 1. Set the chance to 100%.
     
  4. -Kobas-

    -Kobas-

    Joined:
    Jan 17, 2010
    Messages:
    5,892
    Resources:
    28
    Icons:
    1
    Tools:
    2
    Maps:
    10
    Spells:
    4
    Template:
    5
    Tutorials:
    6
    Resources:
    28
    Y but critical will fail when unit cast spell! Also Some other stuff will be triggered like attack animation!
     
  5. supertoinkz

    supertoinkz

    Joined:
    Dec 29, 2008
    Messages:
    2,814
    Resources:
    25
    Models:
    15
    Icons:
    7
    Maps:
    1
    Tutorials:
    2
    Resources:
    25
    Okay. :/
     
  6. ZiggyMcjoney

    ZiggyMcjoney

    Joined:
    May 4, 2008
    Messages:
    109
    Resources:
    1
    Maps:
    1
    Resources:
    1
    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 (Text):
    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 (Text):
    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!
     
  7. -Kobas-

    -Kobas-

    Joined:
    Jan 17, 2010
    Messages:
    5,892
    Resources:
    28
    Icons:
    1
    Tools:
    2
    Maps:
    10
    Spells:
    4
    Template:
    5
    Tutorials:
    6
    Resources:
    28
    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!
     
  8. Dark_Axl

    Dark_Axl

    Joined:
    Dec 12, 2007
    Messages:
    472
    Resources:
    2
    Maps:
    1
    Spells:
    1
    Resources:
    2
    try use a Damage Detection System...
     
  9. Svenski

    Svenski

    Joined:
    Apr 12, 2009
    Messages:
    180
    Resources:
    5
    Icons:
    3
    Maps:
    2
    Resources:
    5
    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!
     
  10. ZiggyMcjoney

    ZiggyMcjoney

    Joined:
    May 4, 2008
    Messages:
    109
    Resources:
    1
    Maps:
    1
    Resources:
    1
    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
     
  11. Mystic_Revelation

    Mystic_Revelation

    Joined:
    Nov 10, 2008
    Messages:
    45
    Resources:
    0
    Resources:
    0
    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.
     
  12. Svenski

    Svenski

    Joined:
    Apr 12, 2009
    Messages:
    180
    Resources:
    5
    Icons:
    3
    Maps:
    2
    Resources:
    5
    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