• 🏆 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!

Upkeep/Teir

Status
Not open for further replies.
Level 16
Joined
May 25, 2004
Messages
1,170
I was thinking could I make it possible to requirements of upgrading to a higher tier involve not by having an alter, but by your upkeep? in other words instead of tax, make it so u cant upgrade to tier2 until u hit Low upkeep, and likewise for tier 3 and high upkeep. I am not sure if that helped much so here is another way to explain it. In order to upgrade your great hall into a stronghold, you have to have at least 50 units. doesn't matter what unit they are. Just have to have at least 50. and for a fortress, you have to have 70 units!

I don't want it to automatically upgrade it, I want it to be restricted, until u get 50, then u cant upgrade, if u get below 50 before u tell it to upgrade, it gets restricted again.
 
Level 12
Joined
May 20, 2009
Messages
822
Uuuuuh. Try this:

  • Untitled Trigger 001
    • Events
      • Time - Every 1.00 seconds of game time
    • Conditions
    • Actions
      • For each (Integer PlayerInit) from 1 to 12, do (Actions)
        • Loop - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • ((Player(PlayerInit)) Food used) Greater than or equal to 50
              • (Number of units in (Units owned by (Player(PlayerInit)) of type DummyUnit1)) Equal to 0
            • Then - Actions
              • Unit - Create 1 DummyUnit1 for (Player(PlayerInit)) at (Center of (Playable map area)) facing Default building facing degrees
              • Unit - Order (Last created unit) to Orc Blademaster - Wind Walk
            • Else - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • ((Player(PlayerInit)) Food used) Greater than or equal to 80
              • (Number of units in (Units owned by (Player(PlayerInit)) of type DummyUnit2)) Equal to 0
            • Then - Actions
              • Unit - Create 1 DummyUnit2 for (Player(PlayerInit)) at (Center of (Playable map area)) facing Default building facing degrees
              • Unit - Order (Last created unit) to Orc Blademaster - Wind Walk
            • Else - Actions
          • Unit Group - Pick every unit in (Units owned by (Player(PlayerInit)) of type DummyUnit1) and do (Actions)
            • Loop - Actions
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • ((Player(PlayerInit)) Food used) Less than 50
                • Then - Actions
                  • Unit - Remove (Picked unit) from the game
                • Else - Actions
          • Unit Group - Pick every unit in (Units owned by (Player(PlayerInit)) of type DummyUnit2) and do (Actions)
            • Loop - Actions
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • ((Player(PlayerInit)) Food used) Less than 80
                • Then - Actions
                  • Unit - Remove (Picked unit) from the game
                • Else - Actions
These Dummy Units will have no model, no shadow, no sight range, and they will have no minimap display. The Windwalk to be a modified WindWalk with as high of a duration as it'll go, 3600, which will be a 60 (Ingame) minute duration.

Wind Walk is important because it disables the units pathing, meaning other units, friend or foe, can walk through them with no problem.

Now, if you want that Wind Walk to last forever on the unit, there's something you can do about that. I'll tell you if you ask. xP

After that, you just make your buildings require those Dummy Units and that's it!
 
Level 25
Joined
Sep 26, 2009
Messages
2,378
It is very possible to do this. This system will require at most 3 dummies for each player using this system.
First off, look at for example the human main structure "Castle" in object editor. Look at the "Techtree - Requirements" field. You will see it requires "Altar of Kings". That's exactly the requirement that is needed for you to build/upgrade to that building.

It will be similar for your own buildings that you want to change.

Now, make 3 dummy units (or less, depends on how many tiers you want). Name one "No Upkeep", another "Low Upkeep" and last "High Upkeep".
These units won't do anything in the game, they should be untargetable (= have locust), have no model, no sound, etc. - all a dummy unit should have.

Make these 3 dummies as requirements for your buildings that should require them (just like with "Altar of Kings" for Castle unit) - a unit that requires "No Upkeep" should have dummy unit "No Upkeep" in requirements, etc.

When game starts, create one of each dummy unit and save them into variable. E.g. something like this:
  • Actions
    • Unit - Create 1 No Upkeep for Player 1 (Red) at loc facing Default building facing degrees
    • Set No_Upkeep = (Last created unit)
    • Unit - Create 1 Low Upkeep for Player 1 (Red) at loc facing Default building facing degrees
    • Set Low_Upkeep = (Last created unit)
    • Unit - Create 1 High Upkeep for Player 1 (Red) at loc facing Default building facing degrees
    • Set High_Upkeep = (Last created unit)
And last, when unit enters map - and it's something that takes your food, you check the food amount for that player. Then you change owner of those 3 dummies - the one dummy who corresponds to current Upkeep level will be owned by that player, while the rest will be owned by Neutral Passive.
You will need to constantly change the ownership like this.

What it will do is: when the dummy (e.g. High_Upkeep) is owned by Neutral Passive, every building of player X will have their buildings with "High Upkeep" requirement grayed out with text "Requires: High Upkeep". (note - the High Upkeep in this text is actually the name of the dummy unit)


---
Edit: aple beat me to it as he basically wrote about the same, however you should avoid unnecessary unit group picking and unit creating if you can use only 1 unit per upkeep level per player for the whole thing
 
Level 12
Joined
May 20, 2009
Messages
822
It is very possible to do this. This system will require at most 3 dummies for each player using this system.
First off, look at for example the human main structure "Castle" in object editor. Look at the "Techtree - Requirements" field. You will see it requires "Altar of Kings". That's exactly the requirement that is needed for you to build/upgrade to that building.

It will be similar for your own buildings that you want to change.

Now, make 3 dummy units (or less, depends on how many tiers you want). Name one "No Upkeep", another "Low Upkeep" and last "High Upkeep".
These units won't do anything in the game, they should be untargetable (= have locust), have no model, no sound, etc. - all a dummy unit should have.

Make these 3 dummies as requirements for your buildings that should require them (just like with "Altar of Kings" for Castle unit) - a unit that requires "No Upkeep" should have dummy unit "No Upkeep" in requirements, etc.

When game starts, create one of each dummy unit and save them into variable. E.g. something like this:
  • Actions
    • Unit - Create 1 No Upkeep for Player 1 (Red) at loc facing Default building facing degrees
    • Set No_Upkeep = (Last created unit)
    • Unit - Create 1 Low Upkeep for Player 1 (Red) at loc facing Default building facing degrees
    • Set Low_Upkeep = (Last created unit)
    • Unit - Create 1 High Upkeep for Player 1 (Red) at loc facing Default building facing degrees
    • Set High_Upkeep = (Last created unit)
And last, when unit enters map - and it's something that takes your food, you check the food amount for that player. Then you change owner of those 3 dummies - the one dummy who corresponds to current Upkeep level will be owned by that player, while the rest will be owned by Neutral Passive.
You will need to constantly change the ownership like this.

What it will do is: when the dummy (e.g. High_Upkeep) is owned by Neutral Passive, every building of player X will have their buildings with "High Upkeep" requirement grayed out with text "Requires: High Upkeep". (note - the High Upkeep in this text is actually the name of the dummy unit)

I completely forgot about Locust...I dunno why I did. Locust is a MUCH better Dummy Spell to remove pathing on a unit then Wind Walk...xD

But anyway, it's better to have 1 MPI compatible trigger then 1 for each player, just FYI. xP

Although I should have made mine to have no leaks, but eh.
 
Level 25
Joined
Sep 26, 2009
Messages
2,378
That really depends imo on how the map actually plays out - if he has many units in map, then creating 48 unit groups every second for this takes unnecessarily too much resources, if you can do this all via variable or array in case of MPI.


Edit: This is what I had in mind:
  • Map Initialization
    • Events
      • Map initialization
    • Conditions
    • Actions
      • Set loc = (Center of Upkeep Spawn <gen>)
      • For each (Integer LoopInt) from 1 to 12, do (Actions)
        • Loop - Actions
          • Unit - Create 1 No Upkeep for (Player(LoopInt)) at loc facing Default building facing degrees
          • Set No_Upkeep[LoopInt] = (Last created unit)
          • Unit - Create 1 No Upkeep for Neutral Passive at loc facing Default building facing degrees
          • Set Low_Upkeep[LoopInt] = (Last created unit)
          • Unit - Create 1 High Upkeep for Neutral Passive at loc facing Default building facing degrees
          • Set High_Upkeep[LoopInt] = (Last created unit)
      • Custom script: call RemoveLocation(udg_loc)
  • Food Checking
    • Events
      • Unit - A unit enters (Playable map area)
      • Unit - A unit Dies
    • Conditions
    • Actions
      • Set player = (Owner of (Triggering unit))
      • Set food = (player Food used)
      • Set i = (Player number of player)
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • food Less than 50
        • Then - Actions
          • Unit - Change ownership of No_Upkeep[i] to player and Change color
          • Unit - Change ownership of Low_Upkeep[i] to Neutral Passive and Change color
          • Unit - Change ownership of High_Upkeep[i] to Neutral Passive and Change color
        • Else - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • food Greater than 80
            • Then - Actions
              • Unit - Change ownership of No_Upkeep[i] to player and Change color
              • Unit - Change ownership of Low_Upkeep[i] to player and Change color
              • Unit - Change ownership of High_Upkeep[i] to player and Change color
            • Else - Actions
              • Unit - Change ownership of No_Upkeep[i] to player and Change color
              • Unit - Change ownership of Low_Upkeep[i] to player and Change color
              • Unit - Change ownership of High_Upkeep[i] to Neutral Passive and Change color
Of course the map ini trigger can be more optimized by using player group and iterating only through used player slots, instead of creating dummies for unused players.
 
Last edited:
Level 16
Joined
May 25, 2004
Messages
1,170
That really depends imo on how the map actually plays out - if he has many units in map, then creating 24 unit groups every second for this takes unnecessary too much resources, if you can do this all via variable or array in case of MPI.
The idea is based on the old Warhammer 40k if memory serves, I just want to try it with a Warcraft III feel before i use it for anything major.

New Question, without editing the AI, would it be possible to use computer opponent in a regular melee game? in other words, the ai wouldn't know the difference.

As I am learning about editing ai (not really yet, but soonish), I still like t learn how to manipulate the regular ai so it doesn't know the difference between changes.

EDIT: I will begin a new map from scratch, my old idea had a different approach and I want to use the idea you guys both gave.
 
Status
Not open for further replies.
Top