(Possibly) tricky ability question

Corleone

New Member
Reaction score
44
Hey,
I've been working on a map for some time and I want my units ( tanks ) to have an ability to fire one bullet. I tried basing it off Carrion Swarm, but then the bullet can move through walls, and doesnt disappear when it hits an enemy. So, since I hardly have any experience with abilities, I ask for your help.
The ability should:
- Not be visible, nor deal any damage after it collides with a wall
- Disappear when it hits an enemy
Optional
- If two bullets collide, they both explode // destroy eachother.

What should I base it on, and how should I trigger it ( if necessary )?
 

Some1Sneakin

New Member
Reaction score
5
Sorry but it i dont think if all that is possible atleast not with that it destroys when it hit a wall and it explodes when hit another.

Maybe something of that is possible but im not sure i will see if it can get it to work
 

Corleone

New Member
Reaction score
44
I just got an idea, actually. Could it be possible to determine the angle between the casting unit and the target of the ability being cast? Then I could create a unit and order it to move towards that direction, and give it a constantly turned on immolation with 9999 dps. That would also make it possible to kill it when it exits the "arena" and when it collides with another bullet; because I could give it 1 hp. Anyway, anyone got an idea on how to figure out what the firing angle is and how to make the unit move towards that point? :p
 

hi_im_bob

......and you are?
Reaction score
44
Maybe this?

Unit - Create 1 Footman for Player 1 (Red) at (Center of (Playable map area)) facing (Facing of (Triggering unit)) degrees
 

Corleone

New Member
Reaction score
44
Well, i know how to make the bullet, but the hard part is to make it move in a specific direction. The only way I can think of to do this is to make 360 region ( one for each facing-angle degree ) but making that would just suck..
 

AceHart

Your Friendly Neighborhood Admin
Reaction score
1,497
> Could it be possible to determine the angle between the casting unit and the target of the ability being cast?

Set myRealVariable = Angle between points.
 

Corleone

New Member
Reaction score
44
Well, I tried using this trigger, but the bullet wouldn't actually move ( so setting the new target didn't really work ). How can I fix this? Should I just make it 2 If//Then//Else statements, or edit something else? I probably made it way more complicated than it should be :p

Code:
Triggered Fire
    Events
        Unit - A unit Begins casting an ability
    Conditions
        (Ability being cast) Equal to Fire! 
    Actions
        Set FireTarget = (Target point of ability being cast)
        If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            If - Conditions
                (Y of FireTarget) Less than (Y of (Position of (Triggering unit)))
            Then - Actions
                Set BulletTargetY = (Point(0.00, ((Distance between (Point(0.00, (Y of FireTarget))) and (Point(0.00, (Y of (Position of (Triggering unit)))))) / 5.00)))
            Else - Actions
                Do nothing
        If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            If - Conditions
                (Y of FireTarget) Greater than (Y of (Position of (Triggering unit)))
            Then - Actions
                Set BulletTargetY = (Point(0.00, ((Distance between (Point(0.00, (Y of FireTarget))) and (Point(0.00, (Y of (Position of (Triggering unit)))))) x 5.00)))
            Else - Actions
                Do nothing
        If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            If - Conditions
                (X of FireTarget) Less than (X of (Position of (Triggering unit)))
            Then - Actions
                Set BulletTargetX = (Point(((Distance between (Point((X of FireTarget), 0.00)) and (Point((X of (Position of (Triggering unit))), 0.00))) / 5.00), 0.00))
            Else - Actions
                Do nothing
        If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            If - Conditions
                (X of FireTarget) Greater than (X of (Position of (Triggering unit)))
            Then - Actions
                Set BulletTargetX = (Point(((Distance between (Point((X of FireTarget), 0.00)) and (Point((X of (Position of (Triggering unit))), 0.00))) x 5.00), 0.00))
            Else - Actions
                Do nothing
        Set BulletTarget = (Point((X of BulletTargetX), (Y of BulletTargetY)))
        Unit - Create 1 Bullet for Player 12 (Brown) at (Position of (Triggering unit)) facing BulletTarget
        Set Bullet = (Last created unit)
        Unit - Order Bullet to Move To BulletTarget
        Wait until ((Distance between (Position of (Triggering unit)) and (Position of Bullet)) Greater than or equal to 40.00), checking every 0.10 seconds
        Unit - Order Bullet to Night Elf Demon Hunter - Activate Immolation
        Custom script:   call RemoveLocation ( udg_BulletTarget )
        Custom script:   call RemoveLocation ( udg_BulletTargetX )
        Custom script:   call RemoveLocation ( udg_BulletTargetY )
 

AceHart

Your Friendly Neighborhood Admin
Reaction score
1,497
"Point with polar offset" is your friend.

Set myPoint = Position of (Casting unit) offset by 800 towards (Angle from (Position of (Casting unit) to Position of (Target point of ability being cast))
Unit - Order Bullet to move to myPoint


Don't use "begins casting" in triggered spells. Go with "starts the effect of".
 

Corleone

New Member
Reaction score
44
Well, for some reason, the bullet travels a random distance now. Sometimes it goes through the entire map ( as intended ) and sometimes it just stops for no reason.
Trigger :

Code:
Fire Target
    Events
        Unit - A unit Starts the effect of an ability
    Conditions
        (Ability being cast) Equal to Fire! 
    Actions
        Set FireTarget = (Target point of ability being cast)
        Set FireAngle = (Angle from (Position of (Triggering unit)) to FireTarget)
        Set BulletTarget = ((Position of (Triggering unit)) offset by 1000.00 towards FireAngle degrees)
        Unit - Create 1 Bullet for Neutral Hostile at (Position of (Triggering unit)) facing BulletTarget
        Set Bullet = (Last created unit)
        Unit - Order Bullet to Move To BulletTarget
        Wait 1.00 seconds
        Unit - Order Bullet to Night Elf Demon Hunter - Activate Immolation
        Custom script:   call RemoveLocation ( udg_BulletTarget )
        Custom script:   call RemoveLocation ( udg_FireTarget )
 

AceHart

Your Friendly Neighborhood Admin
Reaction score
1,497
There's always a reason :p

Like, the point is outside the playable map.
Or it's in the middle of a doodad.
It's in deep water.
...


You could try to test for the pathability of that point.

Alternatively, remember the direction it needs to go, and use a periodic trigger or timer to move it in smaller steps.

I would also activate immolation right after creation, then order the move, to remove that "wait".
 

Corleone

New Member
Reaction score
44
There's always a reason :p

Like, the point is outside the playable map.
Or it's in the middle of a doodad.
It's in deep water.
...


You could try to test for the pathability of that point.

Alternatively, remember the direction it needs to go, and use a periodic trigger or timer to move it in smaller steps.

I would also activate immolation right after creation, then order the move, to remove that "wait".

Well, it could be outside the playable map area, so I think Ill go for the periodic trigger system. It cant be in the middle of a doodad or in deep water, because the map has no doodads or water ( just a very, very simple arena ). Also, I didn't activate immolation right after creation, in case the unit that fires the bullet is still too close to the bullet, and kills himself. Ah well, time to remake the trigger :)
 
General chit-chat
Help Users
  • No one is chatting at the moment.

      The Helper Discord

      Members online

      No members online now.

      Affiliates

      Hive Workshop NUON Dome World Editor Tutorials

      Network Sponsors

      Apex Steel Pipe - Buys and sells Steel Pipe.
      Top