World Edit idea/question
- Ardis
- Terran Nuclear Silo Safety Inspector
- Posts: 228
- Joined: Tue Sep 05, 2006 5:03 pm
- Location: Ohio, USA
World Edit idea/question
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.
I'm not unstable.
Unstable implies that I could BECOME more dangerous than I am now.
Unstable implies that I could BECOME more dangerous than I am now.
-
- Zerg Hydralisk Nail Stylist
- Posts: 597
- Joined: Tue Sep 19, 2006 7:37 pm
Re: World Edit idea/question
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.
- Mucky
- Protoss Khalai Missionary
- Posts: 1014
- Joined: Thu Aug 24, 2006 10:35 pm
Re: World Edit idea/question
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)
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)
- Ardis
- Terran Nuclear Silo Safety Inspector
- Posts: 228
- Joined: Tue Sep 05, 2006 5:03 pm
- Location: Ohio, USA
Re: World Edit idea/question
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.
I'll probably go ask the people who make Project Revolution to see if they have any suggestions.
I'm not unstable.
Unstable implies that I could BECOME more dangerous than I am now.
Unstable implies that I could BECOME more dangerous than I am now.
-
- Zerg Hydralisk Nail Stylist
- Posts: 597
- Joined: Tue Sep 19, 2006 7:37 pm
Re: World Edit idea/question
Then you're just screwed.Phantom wrote: Unfortunately, neither of those ideas helped because I don't want my game held together by triggers when it's done.
- Ricky_Honejasi
- Xel'naga Solar Moderator
- Posts: 2011
- Joined: Wed Aug 16, 2006 3:50 pm
Re: World Edit idea/question
Agreed, I really can't see a method without using triggers some way or another, Phantom.tipereth wrote:Then you're just screwed.Phantom wrote: Unfortunately, neither of those ideas helped because I don't want my game held together by triggers when it's done.
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.
- X
- Terran Refinery Attendant
- Posts: 28
- Joined: Thu Nov 09, 2006 6:29 pm
Re: World Edit idea/question
I can gurantee that if you dont trigger it...it wont be that good go with muckies.
I am X, I have seen countless worlds fall to great evils and their own foolishness, I have seen atrocities you cannot imagine, as well as things of incredible beauty of both the material world and of the spirit.
- Ardis
- Terran Nuclear Silo Safety Inspector
- Posts: 228
- Joined: Tue Sep 05, 2006 5:03 pm
- Location: Ohio, USA
Re: World Edit idea/question
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?
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?
I'm not unstable.
Unstable implies that I could BECOME more dangerous than I am now.
Unstable implies that I could BECOME more dangerous than I am now.
- Zilla-
- Protoss Dragoon Shooting Target
- Posts: 993
- Joined: Thu Sep 07, 2006 8:28 am
Re: World Edit idea/question
Will your map have other (legitemate) flying units? If not have the dudes be able to attack both ground and air.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?
- Mucky
- Protoss Khalai Missionary
- Posts: 1014
- Joined: Thu Aug 24, 2006 10:35 pm
Re: World Edit idea/question
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.
- Milldawg
- Zerg Defiler Nutritionist
- Posts: 729
- Joined: Fri Aug 25, 2006 1:00 pm
- Location: US
Re: World Edit idea/question
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.
- Ardis
- Terran Nuclear Silo Safety Inspector
- Posts: 228
- Joined: Tue Sep 05, 2006 5:03 pm
- Location: Ohio, USA
Re: World Edit idea/question
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.
I'm not unstable.
Unstable implies that I could BECOME more dangerous than I am now.
Unstable implies that I could BECOME more dangerous than I am now.
- Milldawg
- Zerg Defiler Nutritionist
- Posts: 729
- Joined: Fri Aug 25, 2006 1:00 pm
- Location: US
Re: World Edit idea/question
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.