HomeUser Control Panel (unavailable in archive)ForumsTutorialsArt GalleryResourcesMaps

Right Click Attack Ground Trigger?

12-05-2004, 05:25 AM#1
UndercoverIdiot
Im not sure if tis will require jass or not. Could someone help me write it if it does cause I have no idea how.

I am making a map and want to make it so that when ever a specific player right clicks on a location a specific unit will use attack ground on the clicked area. Could someone help? Actually... I'd prefer to have a trigger that makes it so when you right click you shoot in the direction of the mouse and when the bullet hits something it explodes.

-Thanks
12-05-2004, 12:18 PM#2
AFB-DieHard
You could use a spell(I have no idea what this could be, something like stampede but only a single shot) and have a trigger with event: a unit is issued an order, smart(I think that's what right-click is) and action: use ability on target of issued order.
12-05-2004, 12:21 PM#3
iNfraNe
Does your unit require movement? I think if it doesnt have movement it will automaticly do attack ground when you right click.

But anyway, thats quite irrelivent cause you really want it to shoot in a direction forever going on. Try this:

Code:
Fire
    Events
        Unit - A unit Is issued an order targeting a point
    Conditions
        (Issued order) Equal to (Order(smart))
    Actions
        Set tempPoint = (Position of (Ordered unit))
        Set tempPoint3 = (Target point of issued order)
        Set tempPoint2 = (tempPoint offset by 50.00 towards (Angle from tempPoint2 to tempPoint3) degrees)
        Unit - Create 1 Missile for (Owner of (Ordered unit)) at (Center of (Playable map area)) facing Default building facing degrees
        Custom script:   call RemoveLocation(udg_tempPoint2)
        Set tempPoint2 = (tempPoint offset by 1000000.00 towards (Angle from tempPoint2 to tempPoint3) degrees)
        Unit - Order (Last created unit) to Move To tempPoint2
        Custom script:   call RemoveLocation(udg_tempPoint2)
        Custom script:   call RemoveLocation(udg_tempPoint3)
        Custom script:   call RemoveLocation(udg_tempPoint)
        Trigger - Add to Hit <gen> the event (Unit - A unit comes within 50.00 of (Last created unit))
This will "fire" the missile. Make sure the missile has the ability "locust" so it is not clickable.
Code:
Hit
    Events
    Conditions
    Actions
        Set tempPoint = (Position of (Triggering unit))
        Set tempGroup = (Units of type Missile)
        Unit Group - Pick every unit in tempGroup and do (Actions)
            Loop - Actions
                Set tempPoint2 = (Position of (Picked unit))
                If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                    If - Conditions
                        (Distance between tempPoint and tempPoint2) Less than or equal to 51.00
                        (Triggering unit) Not equal to (Picked unit)
                    Then - Actions
                        Unit - Kill (Picked unit)
                        -------- Do Actions for the unit which is hit (triggering unit) --------
                    Else - Actions
                Custom script:   call RemoveLocation(udg_tempPoint2)
        Custom script:   call DestroyGroup(udg_tempGroup)
        Custom script:   call RemoveLocation(udg_tempPoint)
This will check when a unit is hit by the missile (the event is automaticly add by the first trigger) and kill the missile.
Code:
Removing Missile
    Events
        Unit - A unit Dies
    Conditions
        (Unit-type of (Dying unit)) Equal to Missile
    Actions
        Wait 2.00 game-time seconds
        Unit - Remove (Dying unit) from the game
this is to remove the missile from the game.

As you can see I used tempPoints and tempGroups. This is to prevent memory leak and make your map run as smoothly as possible (tho not really needed I try to be as correct as possible).

I hope you understand what I did and why, if not, feel free to ask.
12-05-2004, 03:21 PM#4
UndercoverIdiot
Quote:
Originally Posted by toot
Code:
Fire
    Events
        Unit - A unit Is issued an order targeting a point
    Conditions
        (Issued order) Equal to (Order(smart))
    Actions
        Set tempPoint = (Position of (Ordered unit))
        Set tempPoint3 = (Target point of issued order)
        Set tempPoint2 = (tempPoint offset by 50.00 towards (Angle from tempPoint2 to tempPoint3) degrees)
        Unit - Create 1 Missile for (Owner of (Ordered unit)) at (Center of (Playable map area)) facing Default building facing degrees
        Custom script:   call RemoveLocation(udg_tempPoint2)
        Set tempPoint2 = (tempPoint offset by 1000000.00 towards (Angle from tempPoint2 to tempPoint3) degrees)
        Unit - Order (Last created unit) to Move To tempPoint2
        Custom script:   call RemoveLocation(udg_tempPoint2)
        Custom script:   call RemoveLocation(udg_tempPoint3)
        Custom script:   call RemoveLocation(udg_tempPoint)
        Trigger - Add to Hit <gen> the event (Unit - A unit comes within 50.00 of (Last created unit))
If I wanted the unit that was shooting then what would I change and how?
Also, How do I copy thyis into it exactly? I convert a trigger to custom text right? Then do i just copy?
Hmmm... I need to learn jass...
Thanks again.
12-05-2004, 06:21 PM#5
iNfraNe
Quote:
Originally Posted by SiR-BuMaLoT
If I wanted the unit that was shooting then what would I change and how?
I dont really understand what u mean.

and this is not jass, it is just copied gui triggers as text. Since I closed WE after I cant give you the trigger data so u could import and u have 2 create each action yourself ^^
12-05-2004, 08:06 PM#6
UndercoverIdiot
Quote:
Originally Posted by toot
I dont really understand what u mean.

and this is not jass...

Ya I kinda butchered the question and was kind of confused when I saw that and began to think it was a jass script(I was tired and not paying much attention). I figured out the answer to my question though. But, a new question came to mind. What are the temppoints? Variables? If so what kind?

Also do you know if it is possible to make it so that you don't stop shooting until the button is released?

-Thanks
12-05-2004, 09:04 PM#7
iNfraNe
Quote:
Originally Posted by SiR-BuMaLoT
Ya I kinda butchered the question and was kind of confused when I saw that and began to think it was a jass script(I was tired and not paying much attention). I figured out the answer to my question though. But, a new question came to mind. What are the temppoints? Variables? If so what kind?

Also do you know if it is possible to make it so that you don't stop shooting until the button is released?

-Thanks
till button is released: no

tempPoints are variables of type "point (location)" ;). I used tempPoints cause of memory leak, if you wanna know what memory leak is, try searching the forum.
12-10-2004, 01:40 AM#8
UndercoverIdiot
Recent problems such as the maximum movement speed have ruined my work... I have to change to actually attacking ground... But I tried to give a unit attack ground and could not find out how... I feel stupid... Could someone help?

-Thanks