Staredit Network > Forums > SC2 Assistance > Topic: [Solved] Dodge time
[Solved] Dodge time
This topic is locked. You can no longer write replies here.
Sep 21 2010, 4:41 am
By: payne  

Sep 21 2010, 4:41 am payne Post #1

:payne:

I'm trying to increase the "Dodge time" score of individual players.
This score is based on the time they spend inside a certain region.
I'd use Unit Groups, but the way the players can die within this region is actually based on a Kill behavior units trigger when they touch the players, I thus cannot remove their units from the Unit Group.

Any solutions? :/



None.

Sep 21 2010, 10:01 am Ahli Post #2

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

If a unit dies, won't they always trigger the death event?
So I don't understand why you cannot remove the unit from the unit group.




Sep 21 2010, 5:43 pm Temp Post #3



Not to mention I am pretty sure there is a function to retrieve all dead/alive units from a unit group.



None.

Sep 22 2010, 1:51 am payne Post #4

:payne:

Lol, funny I didn't think of it. Thanks! :><:
But now, I can't get to figure out the other step: which event triggers "as long as" a unit is in a region? "Enters region" is only triggered once. And I believe getting killed isn't considered as leaving a region. :O

EDIT: I could use "Enters region", set a variable, use "Any unit dies", check if variable is set. If set, unset it.
Then have a "Periodic 1 real time second" trigger verify the variable and add 1 to score, but... I'd need to make a trigger for all the 12 players, which sucks.
Is there any simpler solutions? :awesome:



None.

Sep 22 2010, 1:56 am Temp Post #5



Might want to test that assumption it might trigger leaving region, if it does then it should be easy.


Unit Enters Region -> Run Trigger A
Unit Leaves Region -> Stop Trigger B


If not then you can do this

Unit Enters Region -> Add Unit to unit group (Unit Is In Region), Run Trigger A
Unit Leaves Region -> Remove Unit from unit group, Stop trigger A
Unit Dies -> Condition: Unit is in unit group (Unit is in region) -> Remove unit from unit group, Stop trigger A



None.

Sep 22 2010, 2:24 am payne Post #6

:payne:

Test map result: killing unit through trigger doesn't trigger the "Unit leaves region" event.
Your solution looks like it'd still require me to create at least 1 trigger for each player... there's no way I can get around that? :><:



None.

Sep 22 2010, 2:50 am Temp Post #7



I don't see why it would, you can use a function instead and pass information to it.



None.

Sep 22 2010, 3:17 am payne Post #8

:payne:

Quote from Temp
I don't see why it would, you can use a function instead and pass information to it.
Functions == mindfuck. :hurr:



None.

Sep 22 2010, 3:25 am Sand Wraith Post #9

she/her

Every X seconds, check unit group( the number of living units in region ). If number of units in unit group > 0, add 1 score.

Why can't you just do that?




Sep 22 2010, 3:27 am payne Post #10

:payne:

Quote from Sand Wraith
Every X seconds, check unit group( the number of living units in region ). If number of units in unit group > 0, add 1 score.

Why can't you just do that?
Because I need individual score. ;)
So unless I can do "Add 1 to Score[Convert Player to Integer - 1]", this won't work.



None.

Sep 22 2010, 3:47 am Temp Post #11



Functions was actually a bad suggestion here since triggers don't give you a way to just call a function. You can use a trigger and global variables to pass information to it. You would need to do it so that as soon as the trigger your running starts it copies the global variable to a local variable to use it.



None.

Sep 22 2010, 3:55 am payne Post #12

:payne:

Quote from Temp
Functions was actually a bad suggestion here since triggers don't give you a way to just call a function. You can use a trigger and global variables to pass information to it. You would need to do it so that as soon as the trigger your running starts it copies the global variable to a local variable to use it.
Is this related to the "Add 1 to Score[Convert Player to Integer - 1]" ?
... because I don't even understand what you mean and how to do. :><:



None.

Sep 22 2010, 5:46 am payne Post #13

:payne:

This first trigger is just to introduce you to the variables I am using.

Collapse Box


The 4 following triggers are what I have in mind as a solution to my problem at the moment.

Collapse Box


I believe they make a lot of sense... But it doesn't look like it'll update my leaderboard. >_>
The only source of error I see is in the last trigger... I pick integers from 0 to 11, and try to generate a number at row(Picked Integer), thus Row(0) is in there.
Though I tried to do it with a separate Pick Integer 1 to 12, and it still didn't work...
In fact, what I'd really need is a way to set "(Picked integer) - 1" as an input...

I hope those triggers helped you guys with my problem. :/

EDIT: If you are interested in helping out and want to test shit, here's the map: http://www.mediafire.com/download.php?i50kydklttjg4w2



None.

Sep 22 2010, 4:19 pm Ahli Post #14

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

Quote from Temp
Functions was actually a bad suggestion here since triggers don't give you a way to just call a function.
You can just call a function ("action definition" to be exact; would be "function" in 'real' programming) to avoid having the same lines of code in multiple triggers.
The return type has to be none or nothing or null or whatever how it is called.

Anyway, back to payne's problem:

I've opened the map and added some text messages to get a feedback what's working and what's not working. You should do that by default, if something does NOT work or to test, if something works properly.

Mistakes:
-Player 1 is the first player. But you are using the range [0, 11] for that integer loop in update trigger. You will get a problem if player12 is a player, too. I cannot see how many players you intended to play. So I suggest you are using p#-1 or you enable player# to be human or you raise the array size and ignore the first entry. That's what you said you need. it's "Math - Arithmetic - Integer". That's the math function you need [value1 +-*/ value2].
This is leading to the wrong entry for each player, too. You would change player2's value because of the wrong array index. I've fixed it with raising the "label score" array size to 13 and saving in [1] to [12]. Now your update function would change the correct value. (I've corrected the reading index for the initial displayed score value, too [raised by 1].)

Hint:
-You can use loops & counter variables, if you do the same stuff just with different players (e.g. leaderboard creation).

So, now I see why nothing is updating for you.
You are putting labels above the leaderboard You don't even have a Leaderboard, why are you using a leaderboard action? You have created a dialog. and you are modifying the (non existent) leaderboard entry below it.

And now I stop here because that failing localization system throws param\value\blaaaaaaa123 into my face everywhere...

So you see nothing because you are changing something else... something that doesn't even exist.

Metaphoric Explanation, if you do not understand the problem:
I've a computer screen and an opened empty text editor. I'm sticking papers all over the screen and draw a cool looking text editor image on it. Then I'm writing a 0 on it with a pen. Later I'm writing something on the keyboard and ask myself why I can't see a difference on the screen. Maybe because I've put paper all over the screen and didn't write on the paper?

edit:
If you want a working (for p1) version of the map in which I may corrupted (param\value\hell) the whole strings, ask!




Sep 22 2010, 8:36 pm shmeeps Post #15



Quote from Temp
Functions was actually a bad suggestion here since triggers don't give you a way to just call a function. You can use a trigger and global variables to pass information to it. You would need to do it so that as soon as the trigger your running starts it copies the global variable to a local variable to use it.
There's actually two separate functions, one is a function which you would use like "Last Created Unit" or "Position of Unit Facing x", etc, which would essentially be the parameter of an action. There is also one called an "Action Definition", or something similar, which will show up in the action list and can be used like a regular action in a trigger. I have a map or two that use these.



None.

Sep 23 2010, 2:17 am payne Post #16

:payne:

Wow Ahli, thank you very much!
I indeed am stupid to have used a Leaderboard action! :><:
And it was a good idea to increase the array size.

All problems solved.
Tag as solved.
Close topic?



None.

Options
  Back to forum
Please log in to reply to this topic or to report it.
Members in this topic: None.
[06:48 pm]
Ultraviolet -- :wob:
[2024-4-21. : 1:32 pm]
Oh_Man -- I will
[2024-4-20. : 11:29 pm]
Zoan -- Oh_Man
Oh_Man shouted: yeah i'm tryin to go through all the greatest hits and get the runs up on youtube so my senile ass can appreciate them more readily
You should do my Delirus map too; it's a little cocky to say but I still think it's actually just a good game lol
[2024-4-20. : 8:20 pm]
Ultraviolet -- Goons were functioning like stalkers, I think a valk was made into a banshee, all sorts of cool shit
[2024-4-20. : 8:20 pm]
Ultraviolet -- Oh wait, no I saw something else. It was more melee style, and guys were doing warpgate shit and morphing lings into banelings (Infested terran graphics)
[2024-4-20. : 8:18 pm]
Ultraviolet -- Oh_Man
Oh_Man shouted: lol SC2 in SC1: https://youtu.be/pChWu_eRQZI
oh ya I saw that when Armo posted it on Discord, pretty crazy
[2024-4-20. : 8:09 pm]
Vrael -- thats less than half of what I thought I'd need, better figure out how to open SCMDraft on windows 11
[2024-4-20. : 8:09 pm]
Vrael -- woo baby talk about a time crunch
[2024-4-20. : 8:08 pm]
Vrael -- Oh_Man
Oh_Man shouted: yeah i'm tryin to go through all the greatest hits and get the runs up on youtube so my senile ass can appreciate them more readily
so that gives me approximately 27 more years to finish tenebrous before you get to it?
[2024-4-20. : 7:56 pm]
Oh_Man -- lol SC2 in SC1: https://youtu.be/pChWu_eRQZI
Please log in to shout.


Members Online: Roy