• 🏆 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!
  • It's time for the first HD Modeling Contest of 2024. Join the theme discussion for Hive's HD Modeling Contest #6! Click here to post your idea!

Share 1 building for upgrades

Status
Not open for further replies.
Level 16
Joined
Mar 27, 2011
Messages
1,349
I used a shared research facility in my map Terran Base Defence. You create "dummy" shops which have no model and no pathing so they can be stacked upon eachother. Whenever a player clicks the building, a trigger causes the player to select the corresponding building instead.

A shop without a model won't display a portrait picture or a sound. You can play the sound via triggers though. Here's the triggers:

  • Config Armory
    • Events
      • Map initialization
    • Conditions
    • Actions
      • Set TempPoint = (Center of Armory <gen>)
      • Player Group - Pick every player in ThePlayers and do (Actions)
        • Loop - Actions
          • Unit - Create 1 Armory for (Picked player) at TempPoint facing Default building facing degrees
          • Set Shop[(Player number of (Picked player))] = (Last created unit)
      • Custom script: call RemoveLocation (udg_TempPoint)
      • -------- -------------------------- --------
      • For each (Integer Int) from 1 to 16, do (Actions)
        • Loop - Actions
          • Trigger - Add to Click Armory <gen> the event (Player - (Player(Int)) Selects a unit)
  • Click Armory
    • Events
    • Conditions
      • (Triggering unit) Equal to Armory (Fake) 0031 <gen>
    • Actions
      • -------- -------------------------- --------
      • Selection - Select Shop[(Player number of (Triggering player))] for (Triggering player)
      • -------- -------------------------- --------
      • Custom script: if GetLocalPlayer() == GetTriggerPlayer() then
      • Sound - Play ArmoryWhatSound <gen>
      • Custom script: endif
 
Level 12
Joined
Jan 2, 2016
Messages
973
I will tell you how you can make players "share upgrades"
have as event "A player begins a research"
actions: loop trought the players and disable the research for everyone, besides the triggering player.
event "A player cancels a research"
actions: loop trought the players and give them back the research.
event "A player finishes a research"
actions: loop trought the players and give them back the research + set their current research level to the level of the research of triggering player. (Actually not sure if you wouldn't need to put a "wait" for 0.01 seconds (or start a 0.00 timer), but you can test that yourself).
 
Level 12
Joined
Jan 13, 2008
Messages
559
hm, i think I will just solve it with items..thats much easier~ so i would do it like this:

Unit - A unit aquires an item

Item - Item Type if item being maniuplated is Attack Upgrade

Increase research level by 1..But I have no idea how that action is called and if its even possible to increase the research lvl via trigger.
 
  • Untitled Trigger 002
    • Events
      • Map initialization
    • Conditions
    • Actions
      • Unit - Create 1 Footman for Player 1 (Red) at (Player 1 (Red) start location) facing Default building facing degrees
      • Unit - Create 1 Blacksmith for Player 2 (Blue) at (Player 1 (Red) start location) facing Default building facing degrees
      • Set u = (Last created unit)
      • Unit - Add Select Hero to u
      • Unit - Add Select Unit to u
      • Unit - Add Research 1 to u
      • Unit - Add Research 2 to u
      • Player - Add 1000 to Player 2 (Blue) Current gold
      • Player - Add 1000 to Player 2 (Blue) Current lumber
  • Untitled Trigger 001
    • Events
      • Unit - A unit Starts the effect of an ability
    • Conditions
      • (Triggering unit) Equal to u
    • Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Ability being cast) Equal to Research 1
        • Then - Actions
          • Unit - Order u to research Iron Forged Swords
        • Else - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • (Ability being cast) Equal to Research 2
            • Then - Actions
              • Unit - Order u to research Iron Plating
            • Else - Actions
  • Untitled Trigger 003
    • Events
      • Unit - A unit owned by Player 2 (Blue) Finishes an upgrade
    • Conditions
    • Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Researched tech-type) Equal to Iron Forged Swords
        • Then - Actions
          • Player - Set the current research level of Iron Forged Swords to (Current research level of Iron Forged Swords for Player 2 (Blue)) for Player 1 (Red)
        • Else - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • (Researched tech-type) Equal to Iron Plating
            • Then - Actions
              • Player - Set the current research level of Iron Plating to (Current research level of Iron Plating for Player 2 (Blue)) for Player 1 (Red)
            • Else - Actions
Here's another way if you don't want to use dummy units.
 
Last edited by a moderator:
Level 12
Joined
May 22, 2015
Messages
1,051
What kind of upgrades does the building have? What are you trying to do exactly?

Maybe you want it to be one single building that anyone can click on to see their own upgrades (for their units) and choose them - they would be separate for all players but appear to be at the same building.
- Make dummy shops and force player selection onto the dummies when they select the visible shop.

Maybe you want it to be shared upgrades where all players units are affected by any upgrades you get there.
- Make the building owned by one player and share control. Use triggers to give all players the upgrades.

Maybe it is like one super tower in a tower defence or something.
- Just make it for another player and share control.

I don't know what else there could be, but it seems like your question is too vague.
 
Status
Not open for further replies.
Top