Staredit Network > Forums > SC1 UMS Mapmaking Assistance > Topic: Changing available units
Changing available units
Jul 25 2017, 8:35 am
By: SegFault  

Jul 25 2017, 8:35 am SegFault Post #1



Greetings.
I'm making a map where players have to make some choices when the game starts, and then they're given a base.
Depending on the choices they made, I want only a few kind of units to be available for being built, while the others will be locked, but I can't find any way to do this.
So the question is: is it possible to change what are the available units for a certain player during the game?



None.

Jul 25 2017, 9:01 am Pr0nogo Post #2



You would have to mod the dat requirements using Firegraft, which is only available for version 1.16.1. Otherwise the best you can do is make certain buildings unbuildable and create/give them to the player based on what choices they make at the start. You could create/give these structures to the players all at once, or once they complete some prerequisites if you want them to only be available after a certain time.




Jul 25 2017, 10:26 am SegFault Post #3



Thanks for your reply.
Unfortunately giving buildings to players wouldn't allow me to lock units without requirements, like marines.
Also I was hoping the make the game like a regular melee match, with the exception of the locked units, so probably it wouldn't fit.

The best solution that doesn't require modding I came up with was using triggers to remove units a certain player was not supposed to build and to refund the resources. I don't know if this can be improved.



None.

Jul 25 2017, 10:30 am NudeRaider Post #4

We can't explain the universe, just describe it; and we don't know whether our theories are true, we just know they're not wrong. >Harald Lesch

A few workarounds:

- refund illegal units

- destroy the necessary tech or factory buildings

- use a shop system instead of letting the players build themselves. Can still be quite convenient using a dropship system.

Post has been edited 1 time(s), last time on Jul 26 2017, 4:41 pm by NudeRaider.




Jul 25 2017, 9:48 pm rockz Post #5

ᴄʜᴇᴇsᴇ ɪᴛ!

So you can kind of do this using logic, but I'm not sure if it's possible to cancel building units. I think you can remove the unit while its being built.

You can store 2^32 bits in Gas and 2^32 bits in minerals. Lets say minerals cost the normal amount, but gas is a special variable.

If you know you have a tier system, so that later in the game you can build additional items, you can set their gas requirements higher. The downside is that you can't take away the ability to build lower tier units once you're high tier, but you can have nearly infinite tiers.


The other option is to have 32 units or 32 tiers tied to a specific bit for gas. IE marines could cost 2^32-1 gas (-1 gas) and the usual 40 minerals. If you have exactly -1 gas (this is actually a lot of gas), you can build the marine. If you don't, it's disabled obviously. Lets say vultures only cost 8 gas though. You can use binary countoffs to remove each bit starting with 2^31, then 2^30, all the way down to 2^3, which would be the amount required to build a vulture. When you build the vulture, the game will recognize that you no longer have that 8 gas and you can cancel building of the vulture.

This method would likely be instant, and it would allow you to say something like "can't build vultures right now" but it has a hard limit of 32 units or tiers. Vultures and wraiths could both cost 8 gas, and you wouldn't know which was being built at a particular time, but you'd know at least one was, so you can remove both.

It might be safer to do this with 31 tiers instead, but the major drawback is that you essentially are playing a mineral only starcraft, which might not work for your purposes and you want vespene to be mined/gathered in some way.



"Parliamentary inquiry, Mr. Chairman - do we have to call the Gentleman a gentleman if he's not one?"

Jul 26 2017, 3:12 pm SegFault Post #6



This idea of having 32 tiers is really cool. It does require a mineral only game but that might not be that big of an issue.
However I don't know how I could stop a building from creating a unit. I tried looking at the trigger conditions but I couldn't find any way to detect wich building is making a certain kind of unit, or even if a building isn't idle at all.



None.

Jul 26 2017, 5:04 pm NudeRaider Post #7

We can't explain the universe, just describe it; and we don't know whether our theories are true, we just know they're not wrong. >Harald Lesch

rockz' idea is great but it can be improved upon to make it a lot simpler.

The assumption is that nobody is fast enough to create 2 units in a single hyper trigger cycle. Then you can set the gas to say 1000 and have each unit cost a different amount of gas between 1-999. You detect which unit was built by the amount of missing gas. To do that you add binary numbers until you're at 1000 again and add each binary number to a counter. The sum of that counter stores the amount of gas that corresponds to the unit. Have one trigger for each unit to decide if it's legal or not.

Now what do you do when an illegal unit was built? Well you have a problem there in a melee setting. But there's a few things you can try:
- I'm not sure if it works but it's worth a shot. You just gonna have to quickly test that: I think when you give the factory to a computer or neutral player the building of the unit is canceled. If it doesn't work right off the bat you can try disabling the units for the computer or have him run an AI. Might take a few cycles for the AI cancel to kick in though.
- If all that is unsuccessful, you could destroy the factories and, if you're nice enough, have a trigger recreate it. Prone to unplaceable errors though.

This would of course also affect legal units that are built inside the factories. It's a major punishment especially if you destroy the factory, but you can always pretend that the player has to be punished for illegal actions. :P Just make sure you make the concept and the legal units very clear or anger will ensue.




Jul 27 2017, 9:18 am SegFault Post #8



I tried and giving the building to an AI player and then giving ti back to a human player does stop the unit production. It also refunds resources to the human player and preserves rally points and control groups, so this would be a perfect solution for terran and protoss.
However it does not work for zerg egg, they keep morphing. I could just kill all the eggs, but that does not refund resources. A possible solution could be using counters to keep track of how many eggs of a certain kind are currently beeing morphed and refund accordingly.

This method may work, but whitout a way to block only the unallowed unit it might too big of a punishment for what could simply be a missclick or a misunderstanding of the rules. Maybe killing the locked units when their construction is completed is the best way to do this.



None.

Jul 28 2017, 6:28 am NudeRaider Post #9

We can't explain the universe, just describe it; and we don't know whether our theories are true, we just know they're not wrong. >Harald Lesch

Quote from SegFault
eggs of a certain kind are currently beeing morphed and refund accordingly.
All eggs are the same when they are building a unit.

Quote from SegFault
Maybe killing the locked units when their construction is completed is the best way to do this.
It very well may be.




Options
  Back to forum
Please log in to reply to this topic or to report it.
Members in this topic: None.
[2024-10-31. : 12:30 am]
ClansAreForGays -- When you join a pub lobby because you see 7/8 players, but then realize host is bating you with computers. :flamer: :flamer:
[2024-10-30. : 11:48 pm]
O)FaRTy1billion[MM] -- :wob:
[2024-10-30. : 6:24 pm]
Ultraviolet -- :wob:
[2024-10-29. : 4:33 pm]
Vrael -- :wob:
[2024-10-29. : 1:32 pm]
Zoan -- :wob:
[2024-10-28. : 5:21 pm]
Ultraviolet -- :wob:
[2024-10-27. : 4:34 pm]
jjf28 -- :wob:
[2024-10-27. : 9:01 am]
Zycorax -- :wob:
[2024-10-27. : 3:31 am]
RIVE -- :wob:
[2024-10-26. : 7:12 pm]
Ultraviolet -- :wob:
Please log in to shout.


Members Online: lil-Inferno, Roy, Ultraviolet