HomeUser Control Panel (unavailable in archive)ForumsTutorialsArt GalleryResourcesMaps

Some Questions

04-28-2004, 05:05 PM#1
macho271
1.I have 3 regions, and i want a unit to spawn, randomly in one of those regions, how do i do that?

2. The way you earn money in my map is to stand inside a region. I have a pesant to stand inside a region and every 5 second the owner earns 10 gold, but the problem is that it doesent stack. Lik if i put 2 peasant in that area I still only earn 10 gold per second.. that sucks..

The trigger I have so far:
Hore enter
Events
Unit - A unit enters Hore Start <gen>
Unit - A unit enters Hore Slutt <gen>
Unit - A unit enters Region 026 <gen>
Unit - A unit enters Region 027 <gen>
Unit - A unit enters Region 028 <gen>
Unit - A unit enters Region 029 <gen>
Unit - A unit enters Region 030 <gen>
Unit - A unit enters Region 031 <gen>
Unit - A unit enters Region 032 <gen>
Unit - A unit enters Region 033 <gen>
Unit - A unit enters Region 034 <gen>
Unit - A unit enters Region 035 <gen>
Unit - A unit enters Region 036 <gen>
Unit - A unit enters Region 037 <gen>
Unit - A unit enters Region 038 <gen>
Unit - A unit enters Region 039 <gen>
Unit - A unit enters Region 040 <gen>
Unit - A unit enters Region 041 <gen>
Unit - A unit enters Region 042 <gen>
Unit - A unit enters Region 043 <gen>
Unit - A unit enters Region 044 <gen>
Unit - A unit enters Region 045 <gen>
Conditions
(Unit-type of (Triggering unit)) Equal to pesant
(Owner of (Triggering unit)) Equal to Player 1 (Red)
Actions
Trigger - Turn on Hore pl1 <gen>
________________________________________________________
Hore pl1
Events
Time - Every 5.00 seconds of game time
Conditions
Actions
Player - Add 10 to Player 1 (Red) Current gold
______________________________________________
Hore leave
Events
Unit - A unit Dies
Unit - A unit leaves Hore Start <gen>
Unit - A unit leaves Hore Slutt <gen>
Unit - A unit leaves Region 026 <gen>
Unit - A unit leaves Region 027 <gen>
Unit - A unit leaves Region 028 <gen>
Unit - A unit leaves Region 029 <gen>
Unit - A unit leaves Region 030 <gen>
Unit - A unit leaves Region 031 <gen>
Unit - A unit leaves Region 032 <gen>
Unit - A unit leaves Region 033 <gen>
Unit - A unit leaves Region 034 <gen>
Unit - A unit leaves Region 035 <gen>
Unit - A unit leaves Region 036 <gen>
Unit - A unit leaves Region 037 <gen>
Unit - A unit leaves Region 038 <gen>
Unit - A unit leaves Region 039 <gen>
Unit - A unit leaves Region 040 <gen>
Unit - A unit leaves Region 041 <gen>
Unit - A unit leaves Region 042 <gen>
Unit - A unit leaves Region 043 <gen>
Unit - A unit leaves Region 044 <gen>
Unit - A unit leaves Region 045 <gen>
Conditions
(Unit-type of (Triggering unit)) Equal to Pesant
(Owner of (Triggering unit)) Equal to Player 1 (Red)
Actions
Trigger - Turn off Hore pl1 <gen>
_____________________________________

And I did alot of work because I had to make this trigger for all players! o_O
04-29-2004, 01:26 AM#2
Panto
Well, in essence, to do the random region bit,

Assign each region to an index of a region array, probably at Map Init. So,

Set regionArraySpawn[1] = monkey
Set regionArraySpawn[2] = partridge
Set regionArraySpawn[3] = farthing

where regionArraySpawn is a region array variable, and the three other bits are the names of your three regions.

Then, when you spawn the unit, have the event be:

For A = 1 to 12
Create 1 Flaming Pants for Player(Integer A) at center of regionArraySpawn(Random integer between 1 and 3)

This will create a Flaming Pants unit for each player, 1 through 12, at the middle of a random region.

For your income trigger, roughly,

Every 32.00 seconds

Pick every unit of unit-type Cake in region Marsupial.
Add 10 to owner of Picked Unit's gold.

Sorry this isn't in trigger-speak, but they're relatively straightforward GUI triggers.
04-29-2004, 01:54 AM#3
ThyFlame
Unit enters region, region == X

Set count[player number (owner of (entering unit))] = count[player number (owner of (entering unit))] + 1
Set gold = gold + (10 * count)


Unit leaves a region, region == X
Set count[player number (owner of (entering unit))] = count[player number (owner of (entering unit))] - 1