Need some help with spawn points

Sartan

New Member
Reaction score
23
Hello i need some help to make a trigger for spawn points via triggers. and store them in point varriables

My problem:


I got a moving spawn point(a unit with a model fo a flag) that moves every 30 seconds.
I got 2 teams, with a random amount of units between 1-6 untis. (based on how many units that are alive when this event happen)
team 1 should spawn above the spawning point and team 2 shoudl spawn under it.
the unit should stand in a row like this:
Code:
   = = = =        4 units in team 1 (centered between unit 2-3 to the spawn point)
      *            spawn point
  = = = = =        5 units in team 2(centered at unit 3 to the spawn point)

As i tried to show in the above, i want the mid number of the units spawn points to be centered with the "main" spawn point(in the case of a even number pof units, i would want it to be centered between the 2 mid points)

How should i achive this in the best possible way?

Note: i do not want to use regions, i rather want it to be stored as points than regions.

my guess is that this could be achived with point with polar offset from the spawn points, however my mathematical knowledge isn't enough for this.
 

GFreak45

I didnt slap you, i high 5'd your face.
Reaction score
130
you would have to get the first point (middle one) and spawn units offset from that point by x range in x degrees and have the other points the same range +180 degrees and branch out from there
 

Smitty

Member
Reaction score
20
I did something similar, where I wanted units to spawn in a line behind another unit. Lemme get home and I'll post it here since I can't remember it off the top of my head. The answer is to use (here's me trying to remember)
Set TempPoint=position of your marker
Set TempPoint2=TempPoint offset by X on angle Y
Set PointAlt=1
Integer 1 to A loop;
>Set PointAlt=PointAlt*(-1)
>Set TempPoint3=TempPoint2 offset by J on angle (Y+(PointAlt*90))
>Set J=(J+K)
>Create one [Unit] at TempPoint3 facing angle (depends where you want them to face)
>Custom Script: call RemoveLocation(udg_TempPoint3)
Custom Script: call RemoveLocation(udg_TempPoint)
Custom Script: call RemoveLocation(udg_TempPoint2)

Where X is the distance from the flag to the closest (middle) unit, Y is the angle between them.
PointAlt is an integer variable
TempPoints 1, 2 and 3 are points (duh)
A is the number of units you want spawned on that line
J is an integer variable (initially 0)
K is the distance you want between each unit.

Pretty sure this is about right for one line of units. Not at home yet though. I need to stop typing shit like this on my phone. Hope it helps ^^
 

afisakov

You can change this now in User CP.
Reaction score
37
Smitty's answer seems pretty good, just 2 corrections I can see.
1. K=1/2 the distance between units, since J will inc twice before putting unit on same side
2. This only makes units for one of the 2 players, should fix by making: TempPoint4=TempPoint offset by X on angle Y+180
run same kind of loop for point4 as u did for point2
3. set J=0 before the loop, otherwise it keeps growing every time trigger runs
4. A will have to be a variable set by a formula earlier in the trigger, since request wanted units spawned based on units alive before trig runs
 

Smitty

Member
Reaction score
20
Yeh, as I said, this is only for one side. K is actually the distance, since the distance between the first 2 units is K. Then the distance between the 2nd and 3rd units is 2K. 3rd and 4th is 3K. Since they are alternately placed on either side of the central unit, they will be K away from the closest unit. Yes, J must be set to 0, forgot it. Was writing this on my way home from work. And yes, if the number of units produced is going to vary, then A will have to be set in the trigger.
 

afisakov

You can change this now in User CP.
Reaction score
37
Then the distance between the 2nd and 3rd units is 2K. 3rd and 4th is 3K. Since they are alternately placed on either side of the central unit, they will be K away from the closest unit.
I must disagree with this statement
The trigger u originally wrote says
Set TempPoint3=TempPoint2 offset by J on angle (Y+(PointAlt*90)) ; Set J=(J+K)
J increases every time a new point is made in either direction of center, thus increasing twice before next point in same direction.
All offsets are from the original point2. So the first unit appears on point2, the second a distance k to the right of point2, the third 2k left of point2, the fourth 3k right of point2, the fifth 4k left of point2, etc.
as a diagram drawn using u=unit, with first bold, the spacing is
ukkukkukukkukku
meaning aside from the first 2 units are k apart, the rest are 2k apart.

No argument with anything else u said.
 

Smitty

Member
Reaction score
20
Aaah, of course, sorry, that's slightly different to how I did mine, hence the confusion. Mine measured from the position of the previously placed unit. I'd suggest using an alternator, increasing J by K every other loop. You were right XD
 
General chit-chat
Help Users
  • No one is chatting at the moment.

      The Helper Discord

      Staff online

      Members online

      Affiliates

      Hive Workshop NUON Dome World Editor Tutorials

      Network Sponsors

      Apex Steel Pipe - Buys and sells Steel Pipe.
      Top