HomeUser Control Panel (unavailable in archive)ForumsTutorialsArt GalleryResourcesMaps

making units 'repair' nearby buildings

12-30-2002, 05:27 AM#1
Sorbitol
hi all,

in the map i'm making, i have a semi-destroyed village consisting of various burned-out buildings (scorched farms etc). i want to have some neutral villagers walk around and randomly 'repair' (i.e. play their stand work animations) in front of the destroyed buildings.

my first idea was to use regions (move unit x to random destructible doodad in region y) but they only go to the trees.

i also thought of adding the buildings to a group or array, but i haven't been able to get that to work either - can't find triggers that refer to the location of building-type doodads...

any suggestions would be greatly appreciated. thanx
12-30-2002, 05:32 AM#2
KDEWolf
Send them to a location near the building and play the work animation
12-30-2002, 05:39 AM#3
Sorbitol
alright, kdewolf, that sounds good but how would i do it?

right now i have one region which encompasses the village, but if i sent a unit to a random point in it, the unit would nearly always be 'repairing' the air.

can i make a region for each building and somehow make the unit randomly pick one of these regions to move to...?
12-30-2002, 06:01 AM#4
Thunder-Hunter
yes, just do
_________________________________________________
{PICK RANDOM # BETWEEN X - Y}
------------------------------------------------------------------------------------
[PICKED # = (whatever)
-Pick unit (like Farmer001 (Has to be preplaced though)) and issue order to move to region X
-Unit enters region <Unit type equal to Farmer> and play Work animation
-Wait X seconds
- Run trigger [This]]

------------------------------------------------------------------------------------

For the < -Run Trigger [this] > Im just guessing... but I guess thats how it would work.

To get him to move to random Regions, just repeat the {PICKED # = (whatever)

------------------------------------------------------------------------------------
Like for example

PICK RANDOM # BETWEEN 1-3

Picked # = 1 <Issue order to move to Region A>
Picked # = 2 <Issue order to move to Region B>
Picked # = 3 <Issue order to move to Region C>
------------------------------------------------------------------------------------

Hope this Helps... :ggani: :ggani: :ggani:
12-30-2002, 06:05 AM#5
Sorbitol
thanks thundertrials, i'll give it a try
12-30-2002, 06:13 AM#6
Thunder-Hunter
np Im suprised to see you replyed so fast... :)
12-30-2002, 06:15 AM#7
KDEWolf
The units don't need even 2 b preplaced, u just have 2 assign it 2 a var, like this:

Unit - Create Unit.....
Set UnitTypeVar = (Last Created unit)

n on the trigger u order da var 2 move, anim, etc...
12-30-2002, 07:02 AM#8
Sorbitol
you two have been a great help...

alright, this may sound really stupid, but how do i assign each region to a number that gets chosen through the 'pick random number between x and y' function?
12-30-2002, 08:30 AM#9
Electromancer
Just do a Set (IntVariable) = random number between x and y
If # then do move unit to (region) else do nothing

The (IntVariable) is a variable you would have to make. And you can make a every x seconds of game time do set... so on and so on. Then you can do a Every x seconds do If #... so on and so on. That wouldnt actually give them a number, but since its pretty easy to do. Try it.
12-30-2002, 02:14 PM#10
ChronOmega
you could i assign all those regions into an array and use the random number as the index

would that work?