• 🏆 Texturing Contest #33 is OPEN! Contestants must re-texture a SD unit model found in-game (Warcraft 3 Classic), recreating the unit into a peaceful NPC version. 🔗Click here to enter!
  • It's time for the first HD Modeling Contest of 2024. Join the theme discussion for Hive's HD Modeling Contest #6! Click here to post your idea!

[Trigger] Quickshot

Status
Not open for further replies.
Level 8
Joined
Jul 8, 2014
Messages
433
So when I have seen a Member's thread in idea factory asking for variations of his Banshee hero, I wanted to make Mortal Kombat X in Warcraft but instead I got this idea of a hero arena where characters that are not heroes have 3 variations and fight in teams of 2. Game is similiar to MK X, it requires good reflexes, timing and skills to win.

I had the idea to make this rifleman unit and I already have an idea of an ability. But the problem is - of course - I can't do it. Basically rifleman casts ensare-based ability called Quickshot on an enemy and after casting it he stops for 0.30 seconds and a text saying ''Quickshot'' above him appears. After that, if the target is still in range of the ability then rifleman swiftly shoots the target six times, each time dealing small damage and stunning for 0.50 seconds. I did the ability and it worked but when I tried to add the ''After that, if the target is still in range of the ability'' part it didn't work. Any help here?
 
Level 8
Joined
Jul 8, 2014
Messages
433
[TRIGGER=Dis Fing]Quickshot
Events
Unit - A unit Starts the effect of an ability
Conditions
(((Unit-type of (Triggering unit)) Equal to Rifleman - Swift) or (((Unit-type of (Triggering unit)) Equal to Rifleman - Hunter) or ((Unit-type of (Triggering unit)) Equal to Rifleman - Adventurer))) and ((Ability being cast) Equal to Quickshot )
Actions
Set rifleman = (Triggering unit)
Unit - Order rifleman to Stop
Set quickshotTarget = (Target unit of ability being cast)
Special Effect - Create a special effect attached to the overhead of rifleman using Abilities\Spells\Other\TalkToMe\TalkToMe.mdl
Floating Text - Create floating text that reads Quickshot above rifleman with Z offset 0.00, using font size 10.00, color (100.00%, 0.00%, 0.00%), and 0.00% transparency
Set riflemanEffect = (Last created special effect)
Wait 0.30 seconds
Floating Text - Destroy (Last created floating text)
Special Effect - Destroy riflemanEffect
Unit Group - Pick every unit in (Units within 200.00 of (Target point of issued order)) and do (Actions)
Loop - Actions
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
(quickshotTarget is in (Units within 200.00 of (Target point of ability being cast))) Equal to True
Then - Actions
Trigger - Turn on Quickshot Rest <gen>
Else - Actions
[/TRIGGER]

[TRIGGER=And another Dis Fing]Quickshot Rest
Events
Conditions
Actions
Unit - Add Quickshot AS to rifleman
Unit - Add Quickshot Stun to rifleman
Unit - Order rifleman to Attack quickshotTarget
Wait 0.20 seconds
Unit - Order rifleman to Attack quickshotTarget
Wait 0.20 seconds
Unit - Order rifleman to Attack quickshotTarget
Wait 0.20 seconds
Unit - Order rifleman to Attack quickshotTarget
Wait 0.20 seconds
Unit - Order rifleman to Attack quickshotTarget
Wait 0.20 seconds
Unit - Order rifleman to Attack quickshotTarget
Wait 0.20 seconds
Unit - Remove Quickshot AS from rifleman
Unit - Remove Quickshot Stun from rifleman
Unit - Order rifleman to Stop
Trigger - Turn off (This trigger)
[/TRIGGER]

Fart.
 
Level 9
Joined
Apr 23, 2011
Messages
527
this action
  • Trigger - Turn on Quickshot Rest <gen>
is wrong. instead, you should use:
  • Trigger - Run Quickshot Rest <gen> (ignoring conditions)
you also don't need to turn off the firing trigger.

using a loop for the firing is FAR better, though.
 
Level 9
Joined
Apr 23, 2011
Messages
527
1. Doesn't seem to work.
2. How can I do a loop. There is no loop action.

1. o.o it should work. did you replace the turn on trigger with that?
2.
  • For each (Integer A) from 1 to 10, do (Actions)
  • For each (Integer B) from 1 to 10, do (Actions)
  • For each (Integer Variable) from 1 to 10, do (Actions)
these are all the actions for loops. i suggest you use variable loops for more efficiency.
 
Level 24
Joined
Aug 1, 2013
Messages
4,657
Damn my eyes hurt!

I will walk through this trigger piece by piece:
Conditions:
  • (((Unit-type of (Triggering unit)) Equal to Rifleman - Swift) or (((Unit-type of (Triggering unit)) Equal to Rifleman - Hunter) or ((Unit-type of (Triggering unit)) Equal to Rifleman - Adventurer))) and ((Ability being cast) Equal to Quickshot )
Could you please explain why you dont use the "Or - Multiple conditions"?
1. It reads 100% better.
2. It is 100% easier modifyable.
3. It is 100% copy'n'paste compatible.

  • Floating Text - Create floating text that reads Quickshot above rifleman with Z offset 0.00, using font size 10.00, color (100.00%, 0.00%, 0.00%), and 0.00% transparency
  • Floating Text - Destroy (Last created floating text)
Floating texts can be given a duration and they will be removed when that duration ends.
This is called the lifespan.
You have to disable permanence of that floating text though.

  • Special Effect - Create a special effect attached to the overhead of rifleman using Abilities\Spells\Other\TalkToMe\TalkToMe.mdl
  • Special Effect - Destroy riflemanEffect
I am not quite sure what kind of special effect model that is but when you destroy a special effect immediately after it is created, it will still show the death animation before it is removed.

  • Wait 0.30 seconds
Ok... let me be clear: Never use this method again until you know what it does!
Just use a custom script of PolledWait.
Place this code in the header file and use this custom script to wait an amount of seconds.
JASS:
function Wait takes real duration returns nothing
    local timer t
    local real  timeRemaining

    if duration > 0 then
        set t = CreateTimer()
        call TimerStart(t, duration, false, null)
        loop
            set timeRemaining = TimerGetRemaining(t)
            exitwhen timeRemaining <= 0
            
            if (timeRemaining > bj_POLLED_WAIT_SKIP_THRESHOLD) then
                call TriggerSleepAction(0.1 * timeRemaining)
            else
                call TriggerSleepAction(bj_POLLED_WAIT_INTERVAL)
            endif
        endloop
        call DestroyTimer(t)
        set t = null
    endif
endfunction
  • Custom script: call Wait( 1 )
  • Unit Group - Pick every unit in (Units within 200.00 of (Target point of issued order)) and do (Actions)
Here you create 2 leaks: A location and a group.
Handles (locations, units, groups, players, special effects, etc) are a set of data inside the game.

When you create a new handle, you reserve data of your computer.
When you do not want to use that handle any more, you have to remove the handle to clean up the data in your computer.
Otherwise, your computer would be filled with an enourmous amount of data in a very short time.

When using stuff like "Target point of issued order", "Target point of ability being cast", "Position of <unit>", "Center of <region>", etc. You create a NEW location (handle) and therefor create NEW data.
That data has to be removed in some way.
You have to store the location inside a variable. In this case, we can simply use a global variable which we will use over and over again.
So you set "TempLocation" (global variable) to the "Target point of ability being cast" and NOT "Target point of issued order" because we use an ability event rather than an order event.
When we do not have to use the location any more, we remove it by calling a custom script:
  • Custom script: call RemoveLocation( udg_TempLocation )
Now the group can be helped in two ways.
You can simply do the same as for the location with one difference that you do "DestroyGroup()" instead of "RemoveLocation()".
The other way is to create a custom script just before you use a group.
  • Custom script: set bj_wantDestroyGroup = true
This will destroy a group that will be used in the next "Pick every units in group" iteration.
  • Actions
    • Custom script: set bj_wantDestroyGroup = true
    • Unit Group - Pick every unit in (Units in (Playable map area)) and do (Actions)
      • Loop - Actions
This will not leak.

However... you do not want to use a group at all.
What you want is to know if the distance between the target point of ability being cast and the position of the target is lower or equal than 200.
So you use a real comparison and use the "Distance between points" action to find out the accurate distance.
You still have to store 2 locations in different variables and remove both handles.

  • Trigger - Turn on Quickshot Rest <gen>
As mentioned by Light... use the call instead of turn on.

About the other trigger... please just let someone else who has experience with those things create it for you.
Someone who knows how to
- add/remove control of the rifleman
- create accurate intervals
- control simulated attacks
 

Dr Super Good

Spell Reviewer
Level 64
Joined
Jan 18, 2005
Messages
27,198
TriggerSleepAction is too inaccurate for this. In single player it has at best a 0.1 second accuracy. In multiplayer it is usually closer to 0.4 seconds. Yes the actual minimum amount of time waited by TriggerSleepAction varies from session to session and is always longer in multiplayer than singleplayer.
 
Level 8
Joined
Jul 8, 2014
Messages
433
Damn my eyes hurt!

You waitin' a good trigger from me lad? Then your life was a lie.

I will walk through this trigger piece by piece:
  • (((Unit-type of (Triggering unit)) Equal to Rifleman - Swift) or (((Unit-type of (Triggering unit)) Equal to Rifleman - Hunter) or ((Unit-type of (Triggering unit)) Equal to Rifleman - Adventurer))) and ((Ability being cast) Equal to Quickshot )
Could you please explain why you dont use the "Or - Multiple conditions"?
1. It reads 100% better.
2. It is 100% easier modifyable.
3. It is 100% copy'n'paste compatible.

4. It is something that this guy would never use until somebody tells him since he doesn't know what it is.

  • Floating Text - Create floating text that reads Quickshot above rifleman with Z offset 0.00, using font size 10.00, color (100.00%, 0.00%, 0.00%), and 0.00% transparency
  • Floating Text - Destroy (Last created floating text)
Floating texts can be given a duration and they will be removed when that duration ends.
This is called the lifespan.
You have to disable permanence of that floating text though.

I tried using it but I didn't knew I must disable its permenance so it didn't work.

  • Special Effect - Create a special effect attached to the overhead of rifleman using Abilities\Spells\Other\TalkToMe\TalkToMe.mdl
  • Special Effect - Destroy riflemanEffect
I am not quite sure what kind of special effect model that is but when you destroy a special effect immediately after it is created, it will still show the death animation before it is removed.

It is an yellow exclamation mark and I want it to have a death animation.

  • Wait 0.30 seconds
Ok... let me be clear: Never use this method again until you know what it does!
Just use a custom script of PolledWait.
Place this code in the header file and use this custom script to wait an amount of seconds.

I don't know how to do those stuff.

  • Unit Group - Pick every unit in (Units within 200.00 of (Target point of issued order)) and do (Actions)
Here you create 2 leaks: A location and a group.
Handles (locations, units, groups, players, special effects, etc) are a set of data inside the game.

When you create a new handle, you reserve data of your computer.
When you do not want to use that handle any more, you have to remove the handle to clean up the data in your computer.
Otherwise, your computer would be filled with an enourmous amount of data in a very short time.

When using stuff like "Target point of issued order", "Target point of ability being cast", "Position of <unit>", "Center of <region>", etc. You create a NEW location (handle) and therefor create NEW data.
That data has to be removed in some way.
You have to store the location inside a variable. In this case, we can simply use a global variable which we will use over and over again.
So you set "TempLocation" (global variable) to the "Target point of ability being cast" and NOT "Target point of issued order" because we use an ability event rather than an order event.
When we do not have to use the location any more, we remove it by calling a custom script: blah blah blah... (lol)

Mind blown so can't work on it anymore. Sorry.

TriggerSleepAction is too inaccurate for this. In single player it has at best a 0.1 second accuracy. In multiplayer it is usually closer to 0.4 seconds. Yes the actual minimum amount of time waited by TriggerSleepAction varies from session to session and is always longer in multiplayer than singleplayer.

I didn't use TriggerSleepAction if you're talking to me bro. (Bro?)

I assume that you can use a GUI timer as this spell already is very much non-MUI

MUI?

Also, it has something to do with animation, increase animation speed by like let's see >300% and see for results.

I already did abilities for those stuff.
 
Level 24
Joined
Aug 1, 2013
Messages
4,657
You waitin' a good trigger from me lad? Then your life was a lie.
I didnt expect a good trigger but a little bit better to start with could help at least.

4. It is something that this guy would never use until somebody tells him since he doesn't know what it is.
You create an If/Then/Else inside a group iteration.
Then you can use an OR or AND so you can have multiple conditions which you can read and modify way better than put everything in one.

I tried using it but I didn't knew I must disable its permenance so it didn't work.
You could always try to google it.
It is very rewarding.

It is an yellow exclamation mark and I want it to have a death animation.
I assume that it would be fine then.

I don't know how to do those stuff.
I completely explained how you can use it.

Mind blown so can't work on it anymore. Sorry.
You ask, you get answer.

I didn't use TriggerSleepAction if you're talking to me bro. (Bro?)
Yes you did, but DSG forgot to mention that the GUI action "Wait" is TriggerSleepAction().

Multi Unit Instanceable.
It means that it works for all units together.

I already did abilities for those stuff.
But you still have to increase anmation speed.
 
Status
Not open for further replies.
Top