Page 1 of 1

World Edit idea/question

Posted: Fri Nov 30, 2007 7:22 pm
by Ardis
Okay, I'm making a map that is basically supposed to have all of its own races and such, but I've run across a problem. I want to make a building behave much like the Zerg Hatchery/Lair/Hive in where it constantly produces a unit, but only if it has less than a certain amount. I've come up with a temporary solution, but it's not that great.

Re: World Edit idea/question

Posted: Sat Dec 01, 2007 10:42 am
by tipereth
The only way I can think of would be to use Pocket Factory and make the units last x times as long as the spawn time, but you would need a dummy unit.

Re: World Edit idea/question

Posted: Sat Dec 01, 2007 12:57 pm
by Mucky
Here's something you can try instead of pocket factory:

Events
    Time - Every X seconds of game time
Conditions
Actions
    Player Group - Pick every player in (All players) and do (Actions)
        Loop - Actions
            If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                If - Conditions
                    ((Number of units in (Units owned by (Picked player) of type Footman)) / Y) Less than (Number of units in (Units owned by (Picked player) of type Town Hall))
                Then - Actions
                    Unit Group - Pick every unit in (Units owned by (Picked player) matching (((Unit-type of (Matching unit)) Equal to Town Hall) and ((Custom value of (Matching unit)) Less than Y))) and do (Actions)
                        Loop - Actions
                            Unit - Create 1 Footman for (Picked player) at (Position of (Picked unit) facing (Random angle) degrees
                            Unit - Set the custom value of (Picked unit) to ((Custom value of (Picked unit)) + 1)
                Else - Actions

X = whatever interval you want
Y = however many units you want to spawn per building

The custom value is what keeps the trigger from spawning footmen indefinitely. If a player has 0 town halls, this does nothing. If you want the town halls to replace footmen, you'll need to make a trigger that subtracts from their custom value like this one:

Events
    Unit - A unit Dies
Conditions
    (Unit-type of (Triggering unit)) Equal to Footman
Actions
    Unit Group - Pick every unit in (Random 1 units from (Units owned by (Owner of (Triggering unit)) of type Town Hall)) and do (Actions)
        Loop - Actions
            Unit - Set the custom value of (Picked unit) to ((Custom value of (Picked unit)) - 1)

Re: World Edit idea/question

Posted: Tue Dec 04, 2007 3:08 pm
by Ardis
Unfortunately, neither of those ideas helped because I don't want my game held together by triggers when it's done. And I seem to be having trouble with the pocket factory idea because when I try to upgrade the end unit into something else, some (but not all) of them would drop dead immediately.

I'll probably go ask the people who make Project Revolution to see if they have any suggestions.

Re: World Edit idea/question

Posted: Tue Dec 04, 2007 4:00 pm
by tipereth
Phantom wrote: Unfortunately, neither of those ideas helped because I don't want my game held together by triggers when it's done.
Then you're just screwed.

Re: World Edit idea/question

Posted: Tue Dec 04, 2007 5:27 pm
by Ricky_Honejasi
tipereth wrote:
Phantom wrote: Unfortunately, neither of those ideas helped because I don't want my game held together by triggers when it's done.
Then you're just screwed.
Agreed, I really can't see a method without using triggers some way or another, Phantom.

Mucky's method is probably the least complicated way overall to trigger it. It's possible that his code might be buggy or that you didn't implant it correctly.

Re: World Edit idea/question

Posted: Sat Dec 08, 2007 12:15 pm
by X
I can gurantee that if you dont trigger it...it wont be that good go with muckies.

Re: World Edit idea/question

Posted: Tue Dec 18, 2007 1:41 pm
by Ardis
Okay, I went back to my original idea which was just to purchase the unit with a max quantity.

Also, even though it sounds like an oxymoron, does anyone know a why to make a unit that can move over the terrain like a flying unit, but be targeted as a ground unit in combat?

Re: World Edit idea/question

Posted: Wed Dec 19, 2007 8:31 am
by Zilla-
Phantom wrote: Okay, I went back to my original idea which was just to purchase the unit with a max quantity.

Also, even though it sounds like an oxymoron, does anyone know a why to make a unit that can move over the terrain like a flying unit, but be targeted as a ground unit in combat?
Will your map have other (legitemate) flying units? If not have the dudes be able to attack both ground and air.

Re: World Edit idea/question

Posted: Wed Dec 19, 2007 9:03 am
by Mucky
Go down to where it says "Movement - Type" and set that to "None." The unit will bypass cliffs and such as a flying unit would but retain its ground status. I think it'll even walk over map boundaries. If you don't want that, you can try to set the movement type to "Fly," then go to where it says "Combat - Targeted as" and set that to ground. Not sure if either one of these will work to your liking.

Re: World Edit idea/question

Posted: Wed Dec 19, 2007 11:06 am
by Milldawg
Try using the Undead Graveyard's ability, which produces corpses periodically (you can of course set it to something other than corpses).  I think I tried that once and it worked pretty well.

Re: World Edit idea/question

Posted: Wed Dec 19, 2007 1:48 pm
by Ardis
Milldawg, the graveyard will only produce corpses to my knowledge, I know you can only set it to produce corpses of a different unit, though because my friend did that for a map he was making.

Re: World Edit idea/question

Posted: Wed Dec 19, 2007 10:30 pm
by Milldawg
Oh, maybe that's what I did, and then had them automatically revived into the appropriate unit (perhaps by simply giving such an ability to the graveyard itself).  In any case it could still be useful for what's-his-face's project.