• 0

posted a message on Round Based Deathmatch

Start by putting all the player units into some unit group to keep track of them easily.

Event:
Periodic Event - every 0.25 game seconds

Actions:
if Number of units in (your unit group) <= 1 then
Unit 1 from (your unit group) is the winner!
-Start next round

Posted in: Triggers
• 0

posted a message on Who does the processing?

My guess is that the server does all the behind-the-scenes work. I had a friend test my (laggy) AI, and when he tested it in single player he was lagged to death. But when I published and we both tested the same map in multiplayer (with even more bots than before) he ran perfectly fine.

Just my anecdote; could be more complex than that.

Posted in: Triggers
• 0

posted a message on [Question] Move unit along a xyz

Well it depends how you want to implement it. With physics and momentum? You'd need to apply a force and have it update momentum periodically.

Without that, you could just use Move Unit Instantly with Blend enabled. Move it to a Point With Offset.

Offset X = X of Point (Position of Unit) + Speed * cosine (yaw) * cosine (pitch)

Offset Y = Y of Point (Position of Unit) + Speed * sine (yaw) * cosine (pitch)

Then, make another action Set Unit Property. Set the unit's Height property to:

Height = Unit Property (Unit's current Height) + Speed * sine (pitch)

For the second question do you mean the vector as in a point or location? You can get the vector between two points by subtracting their X, Y and Z components.

Posted in: Triggers
• 0

posted a message on [Question] Move unit along a xyz

So, you want the unit to move in the direction your camera is facing, using the unit's speed as the distance? It's hard to understand what you mean. I'm assuming you have it set to third person camera.

Anyway, for the trig it's something like this:

X = cosine (yaw) * cosine (pitch)

Y = sine (yaw) * cosine (pitch)

Z = sine (pitch)

Although my pitch might be mixed up where you have to swap its sine with cosine and vice versa.

Posted in: Triggers
• 0

posted a message on Speed of Trigger to Custom Action

It should work fine as long as you offload the temp global to a local immediately. You don't need to wait for it to execute.

Posted in: Triggers
• 0

posted a message on Unit Uses Ability

Kynth why don't I see you in our channel anymore?

Anyway, you're using the wrong condition for enemy checking. Use: Get Relationship Between Players.

Posted in: Triggers
• 0

posted a message on Help with conditions

I wasn't using script, that just just pseudocode.

To make a global variable just click outside the trigger and press control+B.

Posted in: Triggers
• 0

posted a message on Help with conditions
```Global Variables
X = 1.0 (Real)
X_Increasing = true (Boolean)

Events
Periodic Event: every 0.0 seconds

Actions
If (X_Increasing == true) then
Set X = X + 0.1
If (X >= 4.0) then
Set X_Increasing = false
Else
Set X = X - 0.1
If (X <= 1.0) then
Set X_Increasing = true
```
Posted in: Triggers
• 0

posted a message on Question about multiple condition checks

I guess I didn't read close enough.

So instead, you could pass them using temporary globals as Kueken suggested. It would be simpler than doing a binary search by assigning integers to represent spells.

Posted in: Triggers
• 0

posted a message on Question about multiple condition checks
Quote from Enexy: Go

Or if there were passable parameters through "Run Trigger" action.

That's what action definitions are for. You should never need to use Run Trigger.

Posted in: Triggers
• 0

posted a message on Best way to implement a moving object

Not sure what you mean, but I'd just use 2 custom values for each unit to represent their X and Y velocities.

And yeah Blend makes it so the actor is interpolated between the two points until the next game loop, so if you have a high fps you should notice the difference.

Posted in: Triggers
• 0

posted a message on Best way to implement a moving object

The first option would be perfectly fine. Just don't forget to enable Blend. Also, move the unit every 0.0 seconds (which makes it one game loop, the shortest time gap you can do).

Also, you don't need any SIGN variable. Just use positive and negative real numbers for the X and Y velocity components.

Posted in: Triggers
• 0

posted a message on Map of the Week [Waiting new system before complaining]

If worst comes to worst, I'd recommend the Mineralz exploit where you provide an incentive for players to sit afk in the map after the actual game is over. Just give them free points every hour up to whatever the maximum is, I think 9 hours.

It's a dirty tactic, but it works. And isn't the point of this project to beat the shitty system? Why else would we resort to promoting an already popular map?

I figure if we did this, we wouldn't even need to use Mafia. Just make sure the next map also has cosmetic rewards and the points carry over from the previous map. Call them "MotW Promotion Points" since you'd be helping promote MotW by boosting.

Posted in: General Chat
• 0

posted a message on Need help with a very tricky trigger task

I'd make an array of records, where the record contains the unit, the order string, the order location/unit, and the game time when the order was issued. The array would have to be pretty big since I'm not sure if you can make a resizing array or vector.

When the order is given, simply record it in the next unused array record. That way, the orders will be stored chronologically, and when you want to retrieve them when reading it, you only need to read through the array one index at a time. Do this by looking at the game time of the next order on the list, and waiting until that time has been reached (might need to be compared to a timer's duration instead of the game time, come to think).

Edit: You might also need to include an integer in the record representing order type. For example, 0 for order with no target, 1 for order targeting a point, and 2 for order targeting a unit. Then you can just query that to know which action to use.

Posted in: Triggers
• 0

posted a message on Wall bouncing

You're in luck because I wrote a function for exactly this.

```GetCliffNormal
Options: Function
Return Type: Real
Parameters
loc = No Point <Point>
Grammar Text: GetCliffNormal(loc)
Hint Text: (None)
Custom Script Code
Local Variables
integerA = 0 <Integer>
testPoint = No Point <Point>
avgX = (X of loc) <Real>
avgY = (Y of loc) <Real>
weight = 0.0 <Real>
Actions
General - For each integer integerA from 0 to 11 with increment 1, do (Actions)
Actions
Variable - Set testPoint = (loc offset by 0.5 towards ((Real(integerA)) * 30.0) degrees)
Variable - Set weight = ((Ground height at loc) - (Ground height at testPoint))
Variable - Set avgX = (avgX + (weight * ((X of testPoint) - (X of loc))))
Variable - Set avgY = (avgY + (weight * ((Y of testPoint) - (Y of loc))))
General - Return (((Angle from loc to (Point(avgX, avgY))) + 0.0) mod 360.0)
```

It tests a series of 12 points 0.5 units away from the target point, and puts a positive weight on those that are downhill from the target location, and a negative weight from those that are uphill, and puts them all together. You might want to experiment with the number of test points and the distance, though.

Posted in: Triggers