• 🏆 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!
  • ✅ Time to vote for the top 3 models! The POLL for Hive's 6th HD Modeling Contest: Mechanical is now open! 📅 Poll close on July 16, 2024! 🔗 Cast your vote now!
  • ✅ The POLL for Hive's Texturing Contest #33 is OPEN! Vote for the TOP 3 SKINS! 🔗Click here to cast your vote!

(trigger) Can only buy 1 unit,if it dies u can buy another 1?

Status
Not open for further replies.
Level 1
Joined
Feb 2, 2010
Messages
3
Well this is what i need..

You can buy a unit, if u then try to buy another 1 it displays some text, and u won't be able to buy it. If the unit dies, you can buy another 1

Unit = Force Recon,Rifleman or Scout Sniper (1 in Total).

This is what i have:

Only it doesnt WORK! :( As it looks like it does.. :(

Thanks!

  • Class Selecting 1
    • Events
      • Unit - A unit Sells a unit
    • Conditions
      • ((Selling unit) is A structure) Equal to True
      • ((Buying unit) is A ground unit) Equal to True
    • Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • Player_Bought Equal to 1
        • Then - Actions
          • Game - Display to (Player group((Owner of (Sold unit)))) for 5.00 seconds the text: You already have a ...
          • Unit - Remove (Sold unit) from the game
        • Else - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • Player_Bought Equal to 0
            • Then - Actions
              • Unit - Move (Sold unit) instantly to (Random point in Wait Spawn <gen>)
            • Else - Actions
  • Class Selecting 2
    • Events
      • Unit - A unit Dies
    • Conditions
      • Or - Any (Conditions) are true
        • Conditions
          • (Unit-type of (Dying unit)) Equal to |cff995500Force Recon|r
          • (Unit-type of (Dying unit)) Equal to |cff995500Rifleman|r
          • (Unit-type of (Dying unit)) Equal to |cff995500Stealth Sniper|r
    • Actions
      • Set Player_Bought = 0
  • Class Selecting 3
    • Events
      • Unit - A unit Sells a unit
    • Conditions
      • Or - Any (Conditions) are true
        • Conditions
          • (Unit-type of (Dying unit)) Equal to |cff995500Force Recon|r
          • (Unit-type of (Dying unit)) Equal to |cff995500Rifleman|r
          • (Unit-type of (Dying unit)) Equal to |cff995500Stealth Sniper|r
    • Actions
      • Set Player_Bought = 1
 
Level 5
Joined
Nov 22, 2009
Messages
181
in melee init trigger just use unit- limit training of (unit-type) to (number) for player
for example:
Unit-Limit training of Sorceress to 1 for player 1 (red)
 
Level 5
Joined
Nov 22, 2009
Messages
181
oh wait. that only works when trying to train units. if you purchase units from a mercenary camp or w/e it will not work. i read a post about that somewhere.
 
Level 12
Joined
Aug 22, 2008
Messages
911
If you don't currently use heroes in your map you could use the hero system for that.
Otherwise you can count the units of that type for a certain player when he tried to buy it, like this:
  • Trigger
    • Events
      • Unit - A unit sells a unit
    • Conditions
    • Actions
      • Set tempgroup = (Units owned by (Owner of (Triggering Unit)) matching ((Unit-type of (Matching Unit)) equal to YourUnitType)))
      • If((Count units in tempgroup) greater than or equal to 1) do (Then - Actions) else do (Else - Actions)
        • Then - Actions
          • Unit - Remove (Sold Unit) from the game
          • Game - Display "Already have unit!" to (Owner of (Triggering Unit))
      • Else - Actions
 
Status
Not open for further replies.
Top