Staredit Network > Forums > SC2 Assistance > Topic: Creating an X+Y variable, having trouble...
Creating an X+Y variable, having trouble...
Mar 5 2011, 12:34 am
By: reapur  

Mar 5 2011, 12:34 am reapur Post #1



Hi Guys,
Ultimately here's what I want to do:
If player x has > 5 tanks then do something. Problem is tanks come in siege and tank mode. I want to the TOTAL tank and siege count.

Here's what I've got to work:
(Get the number of units of type Merc - Siege Breaker (Siege Mode) (Merc Siege Tank) owned by player 7 that have been seen by the specified player 7) > 13
This check works. After it's > 13, I do a disable on this type tank.
But the problem is if you pop it into tank mode, the count goes out of whack.

So I'm thinking that I need to do this check
(Get the number of units of type Merc - Siege Breaker (Siege Mode) (Merc Siege Tank) owned by player 7 that have been seen by the specified player 7)
and ADD the resulting number to this:
(Get the number of units of type Merc - Siege Breaker (Tank Mode) (Merc Siege Tank) owned by player 7 that have been seen by the specified player 7)
and compare the output to > 13.

The problem is I can't figure out how to assign a variable:
x= (Get the number of units of type Merc - Siege Breaker (Siege Mode) (Merc Siege Tank) owned by player 7 that have been seen by the specified player 7))
y= (Get the number of units of type Merc - Siege Breaker (Siege Mode) (Merc Siege Tank) owned by player 7 that have been seen by the specified player 7)
then I can do
If x+y > 13 then ...

any idea on how to make a variable x= to make this happen?
or any other ideas?

cheers



None.

Mar 5 2011, 12:58 am Ahli Post #2

I do stuff and thingies... Try widening and reducing the number of small nooks and crannies to correct the problem.

You go to your trigger, click on "variables" and press ctrl+W. Then a new variable is created that you can give a new name.

You can modify variables with the actions within the "Variables" trigger action category.

You can calculate with numbers with "Math" -> "Arithmetic ( Integer)".




Mar 5 2011, 6:44 am reapur Post #3



Thanks Ahli,
I have a general idea of what you recommended. I've played with variables and also manipulated them with thru actions.
But I don't understand how you mean I should go about doing this.
Do you see a way in your mind that I can assign something like this, get its value and put it in a variable?
(Get the number of units of type Merc - Siege Breaker (Siege Mode) (Merc Siege Tank) owned by player 7 that have been seen by the specified player 7))

I can't find in variables how to use a function to get a value to assign to a variable.

:)



None.

Mar 5 2011, 8:59 pm Roy Post #4

An artist's depiction of an Extended Unit Death

You want something like this?

Untitled Trigger 001
    Events
        Timer - Every 0.05 seconds of Game Time
    Local Variables
        x = (Siege Tank (Tank Mode) count for player 7, counting Queued Or Better) <Integer>
        y = (Siege Tank (Siege Mode) count for player 7, counting Queued Or Better) <Integer>
        total = (x + y) <Integer>
    Conditions
        total > 13
    Actions
        ------- Actions


You can set the initial value of variables and click the function tab to assign it like above.




Mar 6 2011, 4:37 pm Riney Post #5

Thigh high affectionado

Wouldnt it be completed or better? :hurr:



.riney on Discord.
Riney on Steam (Steam)
@RineyCat on Twitter

Sure I didn't pop off on SCBW like I wanted to, but I won VRChat. Map maker for life.

Mar 6 2011, 6:56 pm Roy Post #6

An artist's depiction of an Extended Unit Death

Quote from Riney
Wouldnt it be completed or better? :hurr:
It's up to the implementer. If he wants as one of the effects the inability to build tanks, for instance, then queued or better would be the way to go. However, if his map doesn't revolve around constructing tanks in any way, then there would be no difference between using the 'queued' or 'completed' keywords.




Mar 6 2011, 9:16 pm Riney Post #7

Thigh high affectionado

The way he put it, the tanks have to exist.



.riney on Discord.
Riney on Steam (Steam)
@RineyCat on Twitter

Sure I didn't pop off on SCBW like I wanted to, but I won VRChat. Map maker for life.

Mar 11 2011, 12:29 am reapur Post #8



thanks guys.
a tremendous amount of help :)



None.

Options
  Back to forum
Please log in to reply to this topic or to report it.
Members in this topic: None.
[03:35 pm]
Symmetry -- though mine's probably worse
[03:35 pm]
Symmetry -- That certainly sounds similar to what I've made
[06:28 am]
Ultraviolet -- sounds like Bound & Defend
[07:43 pm]
Symmetry -- If you take the reins you damn well be ready to ride
[2026-5-23. : 2:46 pm]
NudeRaider -- you wish
[2026-5-23. : 12:43 am]
IskatuMesk -- Ah, so Reindeer Breeding 3: BDSM edition.
[2026-5-22. : 12:45 am]
Moose -- tbh
[2026-5-20. : 8:27 pm]
Symmetry -- It's a bound map where you cross obstacles to earn units to defend your base
[2026-5-20. : 8:16 pm]
Symmetry -- No, the world isn't ready for that
[2026-5-20. : 5:11 pm]
Zoan -- Reindeer Breeding 3?
Please log in to shout.


Members Online: RIVE, IskatuMesk, O)FaRTy1billion[MM], Symmetry