Allow only one unit of is type

Wargus is a Warcraft 2 mod that allows you to play Warcraft 2 with the Stratagus engine.
Post Reply
Mizukami999
Posts: 14
Joined: Tue Dec 20, 2016 7:00 am

Allow only one unit of is type

Post by Mizukami999 »

Hello everyone!

I wanted to make special units/heroes that can be hired, but onlu one per type.
What's the easiest way to do this by using scripting only?

I thought it's right to introduce new resource types, but I can't figure out how to, so I suppose they're within the compiled game not scripts.

Any ideas, please?
User avatar
Yukiko
Posts: 63
Joined: Sun May 24, 2015 6:52 pm

Re: Allow only one unit of is type

Post by Yukiko »

Resources are defined via scripts. However, I believe you can limit it to one via the build button. You should be able to make the button disappear when you've already got the unit.
Mizukami999
Posts: 14
Joined: Tue Dec 20, 2016 7:00 am

Re: Allow only one unit of is type

Post by Mizukami999 »

Thank you - I'll investigate about the buttons...
Mizukami999
Posts: 14
Joined: Tue Dec 20, 2016 7:00 am

Re: Allow only one unit of is type

Post by Mizukami999 »

I found the answer. At least, for SP:

viewtopic.php?t=3537
User avatar
Andrettin
Posts: 433
Joined: Sun Jun 30, 2013 9:58 pm
Location: Vienna, Austria
Contact:

Re: Allow only one unit of is type

Post by Andrettin »

Mizukami999 wrote:Hello everyone!

I wanted to make special units/heroes that can be hired, but onlu one per type.
What's the easiest way to do this by using scripting only?

I thought it's right to introduce new resource types, but I can't figure out how to, so I suppose they're within the compiled game not scripts.

Any ideas, please?
The maximum quantity of resource types is defined in the engine (namely 6), but you can define what they are in the scripts. 6 resource slots is probably enough for you to achieve what you want.
Mizukami999
Posts: 14
Joined: Tue Dec 20, 2016 7:00 am

Re: Allow only one unit of is type

Post by Mizukami999 »

The maximum quantity of resource types is defined in the engine (namely 6), but you can define what they are in the scripts. 6 resource slots is probably enough for you to achieve what you want.
Thank you! For now I used dynamic unit disallowing - too many unique units.
Post Reply