[skip all navigation]

Unit to Mouse Explosion

Creator: Morphling
Time: May 14 2010, 11:30 pm

Post #1     Morphling May 14 2010, 11:30 pm

[Avatar]
offlinecontact
Rank: Regular
It was relativly easy, but I have yet to see someone make it.

Code

Unit To Mouse
   Events
       UI - Player Any Player clicks Left mouse button Down.
   Local Variables
       Start = (Position of Marine [129.69, 133.54]) <Point> // The unit chosen should be your hero
       Current Position = No Point <Point>
       Distance = 0.5 <Real>
   Conditions
   Actions
       General - While (Conditions) are true, do (Actions)
           Conditions
               Distance < (Abs((Distance between (Point((Mouse X position clicked in the world), (Mouse Y position clicked in the world))) and Start)))
           Actions
               General - Wait 0.05 Game Time seconds // This is optional as it controls how long to wait before creating each explosion
               Variable - Set Current Position = (Start offset by Distance towards (Angle from Start to (Point((Mouse X position clicked in the world), (Mouse Y position clicked in the world)))) degrees)
               Environment - Create a Large Terran explosion at Current Position
               Variable - Modify Distance: + 0.5
       General - If (Conditions) then do (Actions) else do (Actions)
           If
               Distance >= (Abs((Distance between (Point((Mouse X position clicked in the world), (Mouse Y position clicked in the world))) and Start)))
           Then
               Variable - Set Current Position = (Point(0.0, 0.0))
               Variable - Set Distance = 0.5
           Else

If you need anything clearified please ask.
Attachments:
sc2map file
Unit to Mouse Explosion.SC2Map (170.34 kb)
7 hits.
This post was edited 1 time, last edit by Morphling: May 14 2010, 11:55 pm.

Top

Post #2     UnholyUrine May 16 2010, 1:20 am

[Avatar]
;)
offlinecontact
Rank: Regular
What and where do "point" and "distance" specify?

Other than that... nice.

BEWARE!
I'm watching you.. (signature image) .. as you Pee
source for avatar
Top

Post #3     Morphling May 16 2010, 2:24 am

[Avatar]
offlinecontact
Rank: Regular
Which point are you talking about? The distance variable tells us how far to move the explosion after each loop. In my example I used .5. This means the explosions would occur every one half tile.

Edit: I'll just explain the whole thing.

Variables:
Start - Start coordinate of the explosion
Current Position - Th current coordinate of the explosion
Distance - Specifies how far apart the explosions are

Actions:
As long as variable Distance is less than the absolut value of the mouse coordinates minus the variable Start then the actions will run
Wait slows the explosions so it's not instant
Change variable Current Position to variable Start plus Distance towards the point of the mouse
Create an explosion
Add .5 to variable Distance so when the actions run again the new value of variable Current Position will be one half tile close to the mouse position
If variable Distance is greater than or equal to the absolut value of the mouse coordinates minus the variable Start then the variable Start and variable Distance resets.
This post was edited 1 time, last edit by Morphling: May 16 2010, 2:39 am.

Top

Post #4     UnholyUrine May 16 2010, 2:34 am

[Avatar]
;)
offlinecontact
Rank: Regular
Like the phrase:

Quote
(Angle from Start to (Point((Mouse X position clicked in the world), (Mouse Y position clicked in the world)))) degrees)

BEWARE!
I'm watching you.. (signature image) .. as you Pee
source for avatar
Top

Post #5     Jack[RCDF May 16 2010, 2:38 am

[Avatar]
Skin to bone, steel to rust, ash to ashes, dust to dust.
offlinecontact
Rank: Regular
That's the mouse x y location.

Red classic.

I have mostly left SEN except for the Temple Siege 2 forum (hidden to most of you). I am available via PM still, and Skype as JackRCDF.

If it is important to you, you will find a way. Otherwise, you will find an excuse. -Unknown
Magnificent!
Perhaps you shouldn't be on SEN as much, too...
Better than the iPad!
Top

Post #6     Morphling May 16 2010, 2:42 am

[Avatar]
offlinecontact
Rank: Regular
Quote from O)UnholyUrine;)
Like the phrase:

Quote
(Angle from Start to (Point((Mouse X position clicked in the world), (Mouse Y position clicked in the world)))) degrees)
That is not a variable. It is GE showing that the following text is a point. That point is is the mouse position.
Edit: If you look at my map you can see that I used point with polar offset.
This post was edited 1 time, last edit by Morphling: May 16 2010, 2:51 am.

Top
0 members in this topic (italic members are currently writing a reply): None
+ guest(s)


[04:05 am]
RIVE -- There's a lot of not crazy Boredoms, but those tracks are even longer.
[04:02 am]
O)FaRTy1billion -- I should listen to pandora more. I've found a few good albums because of it
[04:01 am]
O)FaRTy1billion -- I was just skipping around randomly because it's 9 minutes
[04:00 am]
O)FaRTy1billion -- I guess not entirely, I didn't listen to the whole thing
[04:00 am]
RIVE -- Yes it is.
[04:00 am]
Vrael -- if there's no singing it cant be bad
[04:00 am]
O)FaRTy1billion -- It's just kind of weird noises
Please log in to shout.