I've searched these forums an experimented for hours but I am stuck. Very sorry if posted elsewhere.
I want a trigger to check if the player has a planetary fortress in a region every 30 seconds and then do an action.
Currently what I found on this forum is this:
EVENTS:
-Unit Any Unit enters region 001
-Every 30 seconds of game time
CONDITIONS:
And
-Unit type of triggering unit is marine
-Owner of triggering unit is player 1
ACTIONS:
-Create 1 Leviathan unit for player 1 at location
This works. but it does not do what I want exactly. When I change the triggering unit type to planetary fortress it stops working. How can I fix this or do this a a better way? Thank you!!!
A building can't "enter" a region unless it's flying from another location, which planetary fortresses can't do. Being built is not the same as entering. That's where your problem is. Here's how I'd go about it:
1. Have the only event be "every 30 seconds of game time"
2. In the trigger actions, create an "If-Then-Else" that looks for a Planetary Fortress in the region
I could go into more detail about how to do #2, but I don't have my editor in front of my right now. If you need more help, post and I'll get back to you in an hour or so.
There might be a way to short cut it... but the solution that imedately comes to mind is...
Events:
Timer Expires - myThirtySecondTimer
Actions:
Pick each unit in unit group - Units In Region Matching Condition (Any, yourPFregion, 1, Excluded... , Any Amount)
Actions
If (unit type == P.F.)
Do This stuff like spawn a Levithan
Edit: If you are checking your WHOLE map for these P.F.s and you have a lot of units, this is going to bog down your game. If that's the case, then I'd do something like "when a unit is created, condition it's a P.F., add one to variable LevithansToBeSpawned". Then reset the variable OR track when a unit is killed, and subtract one from the varible if you want the possibility of multiple Levithans to be spawned if a P.F. remains in the region for prolonged periods
"If-Then-Else" is an action, so you have to put it in an action spot. To find it, just click the "functions" radio button, and then type "If Then" into the search bar.
Once you have that, you go to conditions in the If-Then-Else, and since "unit type ==" is a boolean comparison, you need to put it as a condition under the If-Then-Else...
Between that and mine and Berrala's script (which is exactly as I described) I'm not sure where you're getting lost. You might wanna look under tutorials for something on conditions, or If-Then-Else statements (maybe under "logic" too).
He asked how to find the things since he couldn't find it. So I pasted exactly how it wold look. Your text was an approximate of how it would look. Good enough for some, but since he asked again after, I elaborated.
Hopefully one of our detailed explanations will work for him now. :-)
I've searched these forums an experimented for hours but I am stuck.
Very sorry if posted elsewhere.
I want a trigger to check if the player has a planetary fortress in a
region every 30 seconds and then do an action.
Currently what I found on this forum is this:
EVENTS:
-Unit Any Unit enters region 001 -Every 30 seconds of game time
CONDITIONS:
And -Unit type of triggering unit is marine -Owner of triggering unit is
player 1
ACTIONS:
-Create 1 Leviathan unit for player 1 at location
This works. but it does not do what I want exactly. When I change the
triggering unit type to planetary fortress it stops working. How can I
fix this or do this a a better way? Thank you!!!
Event - Timer Periodic 30 seconds
Condition - None
Actions - If then
if condition - (Num Units iN unit group(convert units "any" (of specific type "planetary fortress ") in region to unit gourp matching conditions) > 0)
If then - do stuff because you have one of those units in the region
Create 1 Leviathan unit for player owner of (convert units "1" (of specific type "planetary fortress ") in region to unit gourp matching conditions) at location
if else - you did not find any units of that type in region
this is pretty easy stuff guys
If your doing it where only 1 player can control a region at a time suggest you look at the "region array tutorial" in my signature
I've searched these forums an experimented for hours but I am stuck. Very sorry if posted elsewhere.
I want a trigger to check if the player has a planetary fortress in a region every 30 seconds and then do an action.
Currently what I found on this forum is this:
EVENTS:
-Unit Any Unit enters region 001 -Every 30 seconds of game time
CONDITIONS:
And -Unit type of triggering unit is marine -Owner of triggering unit is player 1
ACTIONS:
-Create 1 Leviathan unit for player 1 at location
This works. but it does not do what I want exactly. When I change the triggering unit type to planetary fortress it stops working. How can I fix this or do this a a better way? Thank you!!!
A building can't "enter" a region unless it's flying from another location, which planetary fortresses can't do. Being built is not the same as entering. That's where your problem is. Here's how I'd go about it:
1. Have the only event be "every 30 seconds of game time"
2. In the trigger actions, create an "If-Then-Else" that looks for a Planetary Fortress in the region
I could go into more detail about how to do #2, but I don't have my editor in front of my right now. If you need more help, post and I'll get back to you in an hour or so.
Actually, the if then else isn't even needed. Just add your condition to the trigger directly. Something like this:
Well, that would work if the P.F. is pre-placed, but it wouldn't work if the player builds their own.
There might be a way to short cut it... but the solution that imedately comes to mind is...
Edit: If you are checking your WHOLE map for these P.F.s and you have a lot of units, this is going to bog down your game. If that's the case, then I'd do something like "when a unit is created, condition it's a P.F., add one to variable LevithansToBeSpawned". Then reset the variable OR track when a unit is killed, and subtract one from the varible if you want the possibility of multiple Levithans to be spawned if a P.F. remains in the region for prolonged periods
Wrong.
If the P.F. is placed by a trigger or built by a player, you would store it in a variable and use that as reference.
...or if the P.F. is a generic, just any P.F. acceptable, do it like Anthius said.
Thanks everyone.
I have everything in there fine up until "If (unit type == P.F.) "
I can not find how to create this.
I tried several things but all were broken.
One, I can't find "If" and two I can't find "unit type =="
Since you're checking for unit type, I assume you are using the pick all units in region option.
If can be found under Action - General - If Then Else.
Unit type == can be found under Condition - Comparison - (function) Unit Type of Unit.
When done, it should look something like this:
@Berrala: Go
I think that's exactly what I said...
@ThaurMaps: Go
"If-Then-Else" is an action, so you have to put it in an action spot. To find it, just click the "functions" radio button, and then type "If Then" into the search bar.
Once you have that, you go to conditions in the If-Then-Else, and since "unit type ==" is a boolean comparison, you need to put it as a condition under the If-Then-Else...
Between that and mine and Berrala's script (which is exactly as I described) I'm not sure where you're getting lost. You might wanna look under tutorials for something on conditions, or If-Then-Else statements (maybe under "logic" too).
@Anthius: Go
He asked how to find the things since he couldn't find it. So I pasted exactly how it wold look. Your text was an approximate of how it would look. Good enough for some, but since he asked again after, I elaborated.
Hopefully one of our detailed explanations will work for him now. :-)
Delete postthis is pretty easy stuff guys
If your doing it where only 1 player can control a region at a time suggest you look at the "region array tutorial" in my signature
Personally I'd separate this into 2 triggers.
using a Global array of size 12
The first based of Unit uses ability (Build)
Actions
If Unit = X
Set var Global Array [Owner of (Triggering Unit) = X (number that you decide represent that unit)
---Then on your Every 30 second Script
Every 30 seconds
For every intA from 1 to 12 increasing by 1 do
if Global Array[intA] == X
Then
Create unit at X region.
This will ensure if you have a lot of checks it doesn't cause the game to freeze up.