• 🏆 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!
  • ✅ The POLL for Hive's Texturing Contest #33 is OPEN! Vote for the TOP 3 SKINS! 🔗Click here to cast your vote!

A limit on how many times something can be built?

Status
Not open for further replies.
Level 4
Joined
Dec 16, 2007
Messages
70
how would you do this, put a limit on for instance a blacksmith so that they can only build one and then it disappears from the peasants "build" menu
 
Level 12
Joined
Mar 16, 2006
Messages
992
how would you do this, put a limit on for instance a blacksmith so that they can only build one and then it disappears from the peasants "build" menu

I'd just use two triggers. One to detect when its built and remove it from the menu, and the other to detect when the building is destroyed and put the ability to make blacksmiths back.

Not sure how I would code it, seeing how I haven't acquainted myself with the full range of triggers available though. Hope this helps.
 
Level 5
Joined
Jul 11, 2007
Messages
152
I'm not on WE right now but here's what I would do:

Unit - a unit finishes construction

Constructed unit equal to blacksmith

Remove triggering unit (builder) from the game
Unit - Create 1 Dummy unit at position of builder
Unit - Create One (builder2) at position of dummy
Set health of builder2 to health of last removed unit
Wait 1 second
Remove all units of type - Dummy from the game

With this you just copy and paste a second builder and the second builder does not have the option of building a blacksmith
If the blacksmith is destroyed do a similar trigger:

Unit - Unit dies

Unit type of dying unit equal to blacksmith

Remove units of type (builder2) from the game [tricky this is assuming you have one builder because he is not associated with the blacksmiths death]
Unit - Create 1 Dummy unit at position of builder2
Unit - Create One (builder) at position of dummy
Set health of builder to health of last removed unit
Wait 1 second
Remove all units of type - Dummy from the game

Hope this helped!
 
Level 19
Joined
Aug 24, 2007
Messages
2,888
Disable it after building for building player ....
and enable on sell (if you have a sell function)
 
Level 4
Joined
Dec 4, 2007
Messages
76
Ok, your trigger is way to overcomplicated...simply do this:

Code:
Disable
    Events
        Unit - A unit Finishes construction
    Conditions
        (Unit-type of (Constructed structure)) Equal to Blacksmith
    Actions
        Player - Make Blacksmith Unavailable for training/construction by (Owner of (Constructed structure))

Code:
Enable
    Events
        Unit - A unit Dies
    Conditions
        (Unit-type of (Dying unit)) Equal to Blacksmith
    Actions
        Player - Make Blacksmith Available for training/construction by (Owner of (Constructed structure))

Do that for whatever buildings or units you need. Its that simple.
 
Level 4
Joined
Dec 4, 2007
Messages
76
Well, after working with world editor for over 2 years, im like...a master of all the basic triggers and im really good with advanced triggering (although I cant figure out exactly how to fix leaks...) anyways, if you need anymore help, I'll always be here =)

(Oh and thanks for the rep ^^, The favor has been returned)
 
Level 4
Joined
Dec 16, 2007
Messages
70
thank you very much and also your name will be featured in the loading screen and credits of my map that is in my signature :)
 
Level 4
Joined
Dec 4, 2007
Messages
76
Thanks, but I dont feel like I've done enough to be on loading screen, credits are fine =) (Use the loading screen for descriptions about the game)


-Edit

Btw I just noticed I messed one thing up in the Enable trigger. In the action it says "Enable training/construction for owner of contstructed structure" Change it to "Enable training/construction for owner of *Dying Unit*" Sorry bout that =)
 
Last edited:
Level 3
Joined
May 30, 2007
Messages
54
if u just want 1 at a time

im martian troll tribes, u can enter placeable builings, but i couldnt mass interiors , so ive set variables for every building type (only 1 of type per players in team) ((mostly like u can have 3 terminals and mass turrets)) but iof building gets destroyed varible resets, keeps limit but not just only 1 build.

variables r cool if u dont know even what jass means, like me, nothing ive tried i cant script in gui
 
Status
Not open for further replies.
Top