HomeUser Control Panel (unavailable in archive)ForumsTutorialsArt GalleryResourcesMaps

Building is loaded with unit-type trigger

08-31-2002, 12:04 AM#1
Abu
I am trying to make a Human farm have 6 slots so that each peasant you put in the farm adds +1 to the maximum population limit, i.e. 1 farm w/ 5/6 peasants contributes +5 to your pop. limit. If the farm is destroyed it should subtract from the food limit equal to the number of peasants that were in it, and the peasants should come out of the destroyed farm. If a peasant leaves the farm it should subtract 1 from the pop. limit as well. I just can't seem to find any triggers suitable for this... any help would be greatly appreciated! :)
08-31-2002, 06:50 AM#2
Guest
You can detect when a unit is loaded into a transport easy enough, and take appropriate action (i.e., add to food cap).

But there is no known way to detect when a unit leaves a transport except by doing a periodic event. You then run the risk of bogging down your game if the event is too frequent with too many events going off at the same time.

In a nutshell, once the unit enters the farm begin checking every...1 second? Short enough so the player won't be able to unload a peasant and do something with him then put him back and keep his food benefit. Anyway, begin checking every second to see if that loaded unit is still being transported by the transporting unit. If it is still being transported, re-run the trigger. If not, decrement the food cap and stop. Trigger is done.

I would try and make a workaround until Blizzard hopefully patches the game to add an unload event. It's just that for every peasant that's in a farm you're going to have this constantly running trigger, and for every player.

One suggestion off the top of my head would be to actually replace the Farm with a new custom unit and remove the peasant. Say base farm is +0 supply. First peasant enters, remove peasant and convert farm to new unit, Farm I that has +1 supply. Next peasant enters, is removed, and farm is converted to Farm II with +2 supply. Etc., etc. You could then have the farms able to create a special custom unit called, "Remove Peasant from Farm" or something that you would detect the creation of in a trigger. When that unit is created, remove it and turn the farm into the next lowest building (i.e., if the building unit is Farm III, then remove the special peasant and turn the farm into Farm II, etc.) Hope this helps.

Take care.
08-31-2002, 03:41 PM#3
Abu
Thanks. I like your suggestion on a custom farm. I don't think I want to use a check every second, you're right, it would slow things down a lot. It's not critical, just an interesting idea I thought I might put in. Thanks :)