wc3campaigns
WC3C Homepage - www.wc3c.netUser Control Panel (Requires Log-In)Engage in discussions with other users and join contests in the WC3C forums!Read one of our many tutorials, ranging in difficulty from beginner to advanced!Show off your artistic talents in the WC3C Gallery!Download quality models, textures, spells (vJASS/JASS), systems, and scripts!Download maps that have passed through our rigorous approval process!

Go Back   Wc3C.net > Resources > Code Resources > Systems
User Name
Password
Register Rules Get Hosted! Chat Pastebin FAQ and Rules Members List Calendar



Reply
 
Thread Tools Search this Thread
Old 03-31-2008, 12:06 AM   #1
Rising_Dusk
Obscurity, the Art


Projects Director
Project Leader: OD
 
Join Date: Feb 2006
Posts: 9,727

Submissions (27)

Rising_Dusk has a reputation beyond repute (1192)Rising_Dusk has a reputation beyond repute (1192)Rising_Dusk has a reputation beyond repute (1192)Rising_Dusk has a reputation beyond repute (1192)Rising_Dusk has a reputation beyond repute (1192)Rising_Dusk has a reputation beyond repute (1192)Rising_Dusk has a reputation beyond repute (1192)Rising_Dusk has a reputation beyond repute (1192)Rising_Dusk has a reputation beyond repute (1192)

Hero Contest #3 - 1st PlaceApproved Map: Desert of ExileApproved Map: Advent of the ZenithHero Contest #2 - 1st PlaceHero Contest - Third place>

Send a message via AIM to Rising_Dusk Send a message via MSN to Rising_Dusk
Default Knockback System

Zoom (requires log in)
Knockback System
v1.07

Background:
I made this system awhile ago and have had it lying around for awhile now. Someone posted something about needing one in the trigger forum, and then someone linked them to the one in the database. Well, I was going through that old system and noticed that it is so terrible! It needed cache, ran each unit on an individual timer, and so forth. So I decided in my infinite generosity (Haha, yeah right) to clean this thing up and submit it.

Requirements:Warnings:
  • Be careful when using extremely large initial speed values, you could potentially jump your units over what otherwise would be an obstacle.
  • Be careful with terrain pathing, as you can potentially path between objects depending on the current speed of the knockback.
System Specs:
  • Requires vJass.
  • Everything for every knockback ever used in the map runs out of one timer.
  • Totally configurable special effect fields for different effects on land or shallow water.
  • Includes two special effects of my own making for users who can't find their own for land/water based knockbacks.
  • Includes two test spells of my own making in the map to showcase the system.
  • Allows you to destroy destructables or not with a boolean argument.
  • Requires no outside storage systems.
  • Easy to use and implement.
  • Clean and efficient.
Change Log

v1.01: System submitted for critique.
v1.01: Cleaned up even further, lots of optimizations made.
v1.02: Style updates and MUI to the test spells.
v1.03: Allows units to knockback struck units according to a boolexpr and a new boolean argument as well as allowing it to chain adjacent knockbacks together, which can be cool but might lag with large unit numbers.
v1.04: Fixed a critical mathematical error. Cleaned up the code by requiring GroupUtils and TerrainPathability and by just updating it to match current day standards. Fixed assorted efficiency errors in the system.
v1.05: Removed O(n) searches in the system and optimized the additional functions available to the users. Now requires UnitIndexingUtils.
v1.06: Added some code to reissue a unit's last order when knockbacks end. Now requires LastOrder.
v1.07: Updated to comply with patch 1.24 and also add a check for flying units to not display the dust/water effects.


System Code:
Expand System Code:

Special Thanks:
All credits to anything used in the spell are in the testmap, but I'll do it again here. Thanks to Vex for vJass, thanks to xombie for reporting a critical bug in the system, thanks to wc3c for being awesome, and thanks to whoever actually takes the time to read through this!
Attached Images
File Type: jpg KnockBackSystem.jpg (109.0 KB, 3394 views)
Attached Files
File Type: w3x Knockback_v1.07.w3x (72.7 KB, 664 views)
__________________

Last edited by Rising_Dusk : 08-13-2009 at 04:15 PM. Reason: Updated
Rising_Dusk is offline   Reply With Quote
Sponsored Links - Login to hide this ad!
Old 03-31-2008, 12:16 AM   #2
Strilanc
User
 
Strilanc's Avatar
 
Join Date: Jun 2007
Posts: 917

Submissions (4)

Strilanc has a spectacular aura about (131)

2008 Spell olympics - Fire - Gold

Default

I think it's faster to store cartesian velocity (vx,vy) than polar (speed, angle). You don't need to use trig functions at all when using cartesian.

Collapse JASS:
//given vx, vy, subtract F from speed
c = 1 - F/SquareRoot(vx*vx + vy*vy)
vx *= c
vy *= c
__________________
Don't pay attention to this signature, it's self-contradictory.

Last edited by Strilanc : 03-31-2008 at 12:21 AM.
Strilanc is offline   Reply With Quote
Old 03-31-2008, 12:20 AM   #3
Rising_Dusk
Obscurity, the Art


Projects Director
Project Leader: OD
 
Join Date: Feb 2006
Posts: 9,727

Submissions (27)

Rising_Dusk has a reputation beyond repute (1192)Rising_Dusk has a reputation beyond repute (1192)Rising_Dusk has a reputation beyond repute (1192)Rising_Dusk has a reputation beyond repute (1192)Rising_Dusk has a reputation beyond repute (1192)Rising_Dusk has a reputation beyond repute (1192)Rising_Dusk has a reputation beyond repute (1192)Rising_Dusk has a reputation beyond repute (1192)Rising_Dusk has a reputation beyond repute (1192)

Hero Contest #3 - 1st PlaceApproved Map: Desert of ExileApproved Map: Advent of the ZenithHero Contest #2 - 1st PlaceHero Contest - Third place>

Send a message via AIM to Rising_Dusk Send a message via MSN to Rising_Dusk
Default

It could be, but squareroot is a really slow function for computation and I managed to avoid it entirely doing it this way. I'll see what some other people think before doing anything.

EDIT: I just noticed I forgot to do something, damned! Stupid additional functions!
__________________
Rising_Dusk is offline   Reply With Quote
Old 03-31-2008, 12:46 AM   #4
Toadcop
BuranX
 
Toadcop's Avatar
 
Join Date: Jul 2006
Posts: 1,887

Submissions (4)

Toadcop is just really nice (295)Toadcop is just really nice (295)

Approved Map: TcXSpell Making Session 10 Winner

Send a message via ICQ to Toadcop
Default

Quote:
set xf = xi + (n.Speed) * Cos(n.Angle*0.01745328)
set yf = yi + (n.Speed) * Sin(n.Angle*0.01745328)
TT + a bit too weak for a system... (ah yes i mean use vectors instead of Sin\Cos)
__________________
Toadcop is offline   Reply With Quote
Old 03-31-2008, 12:53 AM   #5
Fulla
Evil Overlord
 
Fulla's Avatar
 
Join Date: Jan 2006
Posts: 1,416

Submissions (3)

Fulla has a spectacular aura about (79)Fulla has a spectacular aura about (79)Fulla has a spectacular aura about (79)

Default

Neat system, works smoothly, easy to implement & use.
__________________

Last edited by Fulla : 03-31-2008 at 12:53 AM.
Fulla is offline   Reply With Quote
Old 03-31-2008, 01:02 AM   #6
Pyrogasm
Lackadaisically Absent.
 
Pyrogasm's Avatar


Respected User
 
Join Date: Sep 2006
Posts: 4,514

Submissions (9)

Pyrogasm is a splendid one to behold (638)Pyrogasm is a splendid one to behold (638)Pyrogasm is a splendid one to behold (638)Pyrogasm is a splendid one to behold (638)Pyrogasm is a splendid one to behold (638)Pyrogasm is a splendid one to behold (638)Pyrogasm is a splendid one to behold (638)

Hero Contest - Fourth place

Send a message via ICQ to Pyrogasm Send a message via AIM to Pyrogasm Send a message via MSN to Pyrogasm Send a message via Yahoo to Pyrogasm
Default

Most of your globals should be constant globals so they get inlined, like so (you should also move the TimerInterval constant to the top so that it can more easily be seen an changed):
Collapse JASS:
globals
    //*********************************************************
    //* These are the configuration constants for the system
    //*
    //* EffectLocation:     Where on the unit the effect attaches
    //* EffectPath_Water:   What special effect to attach over water
    //* EffectPath_Ground:  What special effect to attach over ground
    //* DestDestroy_Radius: Radius around which destructs die
    //*
    private constant string EffectLocation         = "origin"
    private constant string EffectPath_Water       = "MDX\\KnockbackWater.mdx"
    private constant string EffectPath_Ground      = "MDX\\KnockbackDust.mdx"
    private constant real DestDestroy_Radius       = 180.
    private constant real TimerInterval            = 0.05
endglobals

This line (and the other 5 lines in the script like it): set n.KBEffect = AddSpecialEffectTarget(EffectPath_Ground, n.Target, "origin") Should be changed to: set n.KBEffect = AddSpecialEffectTarget(EffectPath_Ground, n.Target, EffectLocation)
You forgot a "debug" here (both places you wrote this):
Collapse JASS:
        debug else
            debug call BJDebugMsg("System Error: Unknown Terrain Type")

In fact, where you check this in the Update function can be re-written in a more optimized form:
Collapse JASS:
if (n.FXMode == 1) and (mode == 2) then
    call DestroyEffect(n.KBEffect)
    set n.KBEffect = AddSpecialEffectTarget(EffectPath_Ground, n.Target, "origin")
elseif n.FXMode == 2) and (mode == 1) then
    call DestroyEffect(n.KBEffect)
    set n.KBEffect = AddSpecialEffectTarget(EffectPath_Water, n.Target, "origin")
    debug elseif n.FXMode == 0 then
        debug call BJDebugMsg("System Error: Unknown Terrain Type")
endif

You can remove the InitTrig function, as they are no longer forced by the editor.

Any time you have local knocker n = 0, you don't need to initialize "n" at all. Another thing: why are you typecasting to integers in the global array? It would make more sense as a knocker array: private knocker array Knockers
The order in which you used SetUnitPosition is wrong; since it takes into account pathing and sorts of things like that, it is conceivable that the unit does not end up where you think it will and it might be on a different type of terrain than the effect you are using. It should be in this order:
Collapse JASS:
set xf = xi + (n.Speed) * Cos(n.Angle*0.01745328)
set yf = yi + (n.Speed) * Sin(n.Angle*0.01745328)
call SetUnitPosition(n.Target, xf, yf)
set n.FXMode = n.checkterrain(n)

You don't need a local variable to reference n.Target; your usage of "u" is unnecessary.

Instead of using a local rect, r, and creating a new handle every iteration of the loop, you should use a global rect and use SetRect on it:
Collapse JASS:
globals
    //...
    private rect R
endglobals

    //...
    call SetRect(R, xf-DestDestroy_Radius, yf-DestDestroy_Radius, xf+DestDestroy_Radius, yf+DestDestroy_Radius)
    //...

    private function KnockbackSystemInit takes nothing returns nothing
        set Boolexpr = Condition(function KillDests_Check)
        set R = CreateRect()
    endfunction

Why even bother to deal with degrees at all? Radians are more standard anyway, and you should just tell people that the functions take radians in the ReadMe. This will save you from some calculations

Finally (on the subject of angles and cartesian velocity and all that crap), the way you've done it (as opposed to what Strilanc said) makes more sense because you're changing the velocity constantly. That being said, you should store the Cosine and Sine of the angle instead of just the angle in the struct:
Collapse JASS:
private struct knocker
    unit Target
    effect KBEffect
    integer FXMode
    boolean KillDest
    real Decrement
    real Speed
    real ASin
    real ACos
    
    method checkterrain takes knocker n returns integer
        local real x = GetUnitX(n.Target)
        local real y = GetUnitY(n.Target)
        if IsTerrainPathable(x, y, PATHING_TYPE_FLOATABILITY) then
            return 1
        elseif not IsTerrainPathable(x, y, PATHING_TYPE_WALKABILITY) then
            return 2
        endif
        return 0
    endmethod
    static method create takes unit targ, real angle, real startspeed, real decrement, boolean killDestructables returns knocker
        local knocker n = knocker.allocate()
        set n.Target = targ
        set n.FXMode = n.checkterrain(n)
        if n.FXMode == 1 then
            set n.KBEffect = AddSpecialEffectTarget(EffectPath_Ground, n.Target, EffectLocation)
        elseif n.FXMode == 2 then
            set n.KBEffect = AddSpecialEffectTarget(EffectPath_Water, n.Target, EffectLocation)
        debug else
            debug call BJDebugMsg("System Error: Unknown Terrain Type")
        endif
        set n.KillDest = killDestructables
        set n.Decrement = decrement
        set n.Speed = startspeed
        set n.ASin = Sin(angle)
        set n.ACos = Cos(angle)
        return n
    endmethod
    private method onDestroy takes nothing returns nothing
        call DestroyEffect(this.KBEffect)
    endmethod
endstruct

//...
    set xf = xi + (n.Speed) * n.ACos
    set yf = yi + (n.Speed) * n.ASin

Aside from that...
__________________
Quote:
Originally posted by Rising_Dusk
Your spells are mostly ignored because they are not very cool so we aren't very excited to review/approve them, but you are incredibly persistent and won't give us an excuse to graveyard it. That is generally what results in a resource being ignored for a long time.

The Spell Request Thread Done for, unless someone else wants to revive it...
It lasted a damn long time.

Please; Ask for Help Appropriately














Quote:
Originally posted by Kyrbi0
Huh. Almost makes me wish I had a girlfriend, to take advantage of today (wait, no, that's not what I meant... I mean, take advantage of the fact that it is international women's day... gah, never mind).
Quote:
Originally posted by Pyrogasm
Rome may not have been built in a day, but the Romans sure as hell didn't say "look at this great city we built guys!" when they had nothing more than a bit of stone and some cottages.
Pyrogasm is offline   Reply With Quote
Old 03-31-2008, 01:14 AM   #7
Rising_Dusk
Obscurity, the Art


Projects Director
Project Leader: OD
 
Join Date: Feb 2006
Posts: 9,727

Submissions (27)

Rising_Dusk has a reputation beyond repute (1192)Rising_Dusk has a reputation beyond repute (1192)Rising_Dusk has a reputation beyond repute (1192)Rising_Dusk has a reputation beyond repute (1192)Rising_Dusk has a reputation beyond repute (1192)Rising_Dusk has a reputation beyond repute (1192)Rising_Dusk has a reputation beyond repute (1192)Rising_Dusk has a reputation beyond repute (1192)Rising_Dusk has a reputation beyond repute (1192)

Hero Contest #3 - 1st PlaceApproved Map: Desert of ExileApproved Map: Advent of the ZenithHero Contest #2 - 1st PlaceHero Contest - Third place>

Send a message via AIM to Rising_Dusk Send a message via MSN to Rising_Dusk
Default

Now, that's impressive. Consider it all done. (Some things I disagree with, but the majority is good stuff)

Quote:
Originally Posted by Pyrogasm
Any time you have local knocker n = 0, you don't need to initialize "n" at all. Another thing: why are you typecasting to integers in the global array?
Because a struct is nothing other than an integer, it doesn't matter what you store them as. It's more intuitive for me to consider them as integers unless its required to be otherwise.

Quote:
Originally Posted by Pyrogasm
This line (and the other 5 lines in the script like it): set n.KBEffect = AddSpecialEffectTarget(EffectPath_Ground, n.Target, "origin") Should be changed to: set n.KBEffect = AddSpecialEffectTarget(EffectPath_Ground, n.Target, EffectLocation)
Good call, I must've mistyped that.

Quote:
Originally Posted by Pyrogasm
In fact, where you check this in the Update function can be re-written in a more optimized form:
Truth, I must've missed it while cleaning it up. (Although if you'd look at your 'optimized' version it wouldn't even compile) I know what you meant, though. :p

Quote:
Originally Posted by Pyrogasm
Why even bother to deal with degrees at all? Radians are more standard anyway, and you should just tell people that the functions take radians in the ReadMe. This will save you from some calculations
As a system, I find it simpler for the public to understand degrees. It's also easier and more intuitive to type 45 than it is to type 0.78539. Out of virtue of simplicity, I'll just convert the value to rads after the user inputs them in degrees.

Quote:
Originally Posted by Pyrogasm
The order in which you used SetUnitPosition is wrong; since it takes into account pathing and sorts of things like that, it is conceivable that the unit does not end up where you think it will and it might be on a different type of terrain than the effect you are using. It should be in this order:
Minor point, but a valid one. It shall be done.

Quote:
Originally Posted by Pyrogasm
That being said, you should store the Cosine and Sine of the angle instead of just the angle in the struct:
Good call, if I had thought of it at the time I probably would have done just that.

Quote:
Originally Posted by Pyrogasm
(you should also move the TimerInterval constant to the top so that it can more easily be seen an changed)
I disagree entirely. It's a constant that users shouldn't be playing with (Imagine if they typed in 1 or something). In order to protect users from themselves, I put it down below. If people know what it does, it's still very easily accessible so that it can be changed.

EDIT:
And you don't have to give me all of the examples. You should've saved yourself all of that time, I can figure stuff out strictly by words alone. :p
__________________
Rising_Dusk is offline   Reply With Quote
Old 03-31-2008, 01:19 AM   #8
darkwulfv
Alpha Male of Wc3c
 
darkwulfv's Avatar


Official Map Reviewer
 
Join Date: Mar 2006
Posts: 3,646

Submissions (6)

darkwulfv is just really nice (270)darkwulfv is just really nice (270)

Send a message via AIM to darkwulfv
Default

Yay, a decent knockback system. I would use it if I weren't forcing myself to code my own (using a tutorial) so I can both have a systm AND learn vJass.
__________________
The Spell Request Thread
Quote:
Originally Posted by Joe-Black-5
a dota like map but with unique stuff
(There was no map attached, and that was all the thread said.)
Spells I've Made

Darkwulfv's Lightning Grapple || Tritanis' Lazy Bolt

darkwulfv is offline   Reply With Quote
Old 03-31-2008, 01:40 AM   #9
Pyrogasm
Lackadaisically Absent.
 
Pyrogasm's Avatar


Respected User
 
Join Date: Sep 2006
Posts: 4,514

Submissions (9)

Pyrogasm is a splendid one to behold (638)Pyrogasm is a splendid one to behold (638)Pyrogasm is a splendid one to behold (638)Pyrogasm is a splendid one to behold (638)Pyrogasm is a splendid one to behold (638)Pyrogasm is a splendid one to behold (638)Pyrogasm is a splendid one to behold (638)

Hero Contest - Fourth place

Send a message via ICQ to Pyrogasm Send a message via AIM to Pyrogasm Send a message via MSN to Pyrogasm Send a message via Yahoo to Pyrogasm
Default

Yeah, well I like examples :)
Quote:
Originally Posted by Rising_Dusk
As a system, I find it simpler for the public to understand degrees. It's also easier and more intuitive to type 45 than it is to type 0.78539. Out of virtue of simplicity, I'll just convert the value to rads after the user inputs them in degrees.
Ah, but how often will someone call the function with a static angle argument? Wouldn't it more likely be used as the angle between two points (say maybe a caster and the target?)
Collapse JASS:
function Actions takes nothing returns nothing
    local unit U = GetTriggerUnit()
    local unit Target = GetSpellTargetUnit()

    call KnockbackUnit(Target, Atan2(GetUnitY(Target)-GetUnitY(U), GetUnitX(Target)-GetUnitX(U)), 500.00, 15.00, true)

    set U = null
    set Target = null
endfunction
Also, you might want to mention in the readme that there is no internal pausing of the unit in the system and that users ought to make sure to do it themselves.


Out of curiosity, what happens when you initiate a knockback on a unit that is already being knocked back? Does the system bug out at all (I think KnockbackStop would)?
__________________
Quote:
Originally posted by Rising_Dusk
Your spells are mostly ignored because they are not very cool so we aren't very excited to review/approve them, but you are incredibly persistent and won't give us an excuse to graveyard it. That is generally what results in a resource being ignored for a long time.

The Spell Request Thread Done for, unless someone else wants to revive it...
It lasted a damn long time.

Please; Ask for Help Appropriately














Quote:
Originally posted by Kyrbi0
Huh. Almost makes me wish I had a girlfriend, to take advantage of today (wait, no, that's not what I meant... I mean, take advantage of the fact that it is international women's day... gah, never mind).
Quote:
Originally posted by Pyrogasm
Rome may not have been built in a day, but the Romans sure as hell didn't say "look at this great city we built guys!" when they had nothing more than a bit of stone and some cottages.
Pyrogasm is offline   Reply With Quote
Old 03-31-2008, 01:53 AM   #10
Rising_Dusk
Obscurity, the Art


Projects Director
Project Leader: OD
 
Join Date: Feb 2006
Posts: 9,727

Submissions (27)

Rising_Dusk has a reputation beyond repute (1192)Rising_Dusk has a reputation beyond repute (1192)Rising_Dusk has a reputation beyond repute (1192)Rising_Dusk has a reputation beyond repute (1192)Rising_Dusk has a reputation beyond repute (1192)Rising_Dusk has a reputation beyond repute (1192)Rising_Dusk has a reputation beyond repute (1192)Rising_Dusk has a reputation beyond repute (1192)Rising_Dusk has a reputation beyond repute (1192)

Hero Contest #3 - 1st PlaceApproved Map: Desert of ExileApproved Map: Advent of the ZenithHero Contest #2 - 1st PlaceHero Contest - Third place>

Send a message via AIM to Rising_Dusk Send a message via MSN to Rising_Dusk
Default

Quote:
Originally Posted by Pyrogasm
Out of curiosity, what happens when you initiate a knockback on a unit that is already being knocked back? Does the system bug out at all (I think KnockbackStop would)?
Nope, it doesn't. It functions the same way as vector addition of two velocity vectors. One is pointed in the direction of the first KB call, the next in the direction of the second one. Each has individual magnitudes, cleans up accordingly, and works perfectly. Even the Stop works, since it clears all instances where the unit exists as a target. (That means it stops multiple vector knockbacks if they exist)

Quote:
Originally Posted by Pyrogasm
Ah, but how often will someone call the function with a static angle argument? Wouldn't it more likely be used as the angle between two points (say maybe a caster and the target?)
It's tough to say that for all users, though. I know a few people myself who use wrappers to put things into degrees so they can then be used in conjunction with SetUnitFacing (Which takes degrees as an argument).

Quote:
Originally Posted by Pyrogasm
Also, you might want to mention in the readme that there is no internal pausing of the unit in the system and that users ought to make sure to do it themselves.
No need, SetUnitPosition functionally blocks all external commands. It works like a pause without removing the unit's command card, which is a big plus.

Updated, by the way.
__________________
Rising_Dusk is offline   Reply With Quote
Old 03-31-2008, 04:00 AM   #11
moyack
Evil Emoticon
 
moyack's Avatar


Respected User
Project Leader: PoC
 
Join Date: Jan 2006
Posts: 3,271

Submissions (17)

moyack is a splendid one to behold (661)moyack is a splendid one to behold (661)moyack is a splendid one to behold (661)moyack is a splendid one to behold (661)

AI Tournament #2 - 2nd PlaceHero Contest - Second place

Send a message via MSN to moyack
Default

ahHAAA!!! using my technique of calling random creeps to attack your hero!!! How dare you :P

One question: why you stop the timer when there's no units to move? to improve performance??? that's not necessary, and you save code. Even better, you can replace (optionally) the timer with a periodic trigger.

But, in general, I see no other issue.
moyack is offline   Reply With Quote
Old 03-31-2008, 04:45 AM   #12
Pyrogasm
Lackadaisically Absent.
 
Pyrogasm's Avatar


Respected User
 
Join Date: Sep 2006
Posts: 4,514

Submissions (9)

Pyrogasm is a splendid one to behold (638)Pyrogasm is a splendid one to behold (638)Pyrogasm is a splendid one to behold (638)Pyrogasm is a splendid one to behold (638)Pyrogasm is a splendid one to behold (638)Pyrogasm is a splendid one to behold (638)Pyrogasm is a splendid one to behold (638)

Hero Contest - Fourth place

Send a message via ICQ to Pyrogasm Send a message via AIM to Pyrogasm Send a message via MSN to Pyrogasm Send a message via Yahoo to Pyrogasm
Default

Quote:
Originally Posted by Rising_Dusk
No need, SetUnitPosition functionally blocks all external commands. It works like a pause without removing the unit's command card, which is a big plus.
That's what I get for not actually testing the map, eh?
Quote:
Originally Posted by Rising_Dusk
It's tough to say that for all users, though. I know a few people myself who use wrappers to put things into degrees so they can then be used in conjunction with SetUnitFacing (Which takes degrees as an argument).
Meh; it's a moot point anyway.
Quote:
Originally Posted by Rising_Dusk
Nope, it doesn't. It functions the same way as vector addition of two velocity vectors. One is pointed in the direction of the first KB call, the next in the direction of the second one. Each has individual magnitudes, cleans up accordingly, and works perfectly. Even the Stop works, since it clears all instances where the unit exists as a target. (That means it stops multiple vector knockbacks if they exist)
I understand how they would add... I just really didn't think about it. If you really wanted to make this system perfect I would say to consolidate all knockbacks on any one unit at any time to a single knockback, so that way the system does less work. Not exactly a requirement, though.
Quote:
Originally Posted by Moyack
One question: why you stop the timer when there's no units to move? to improve performance??? that's not necessary, and you save code. Even better, you can replace (optionally) the timer with a periodic trigger.
No, it's good that he does it the way he does. You don't want a fast timer like that running when you don't need it.

On that note, I shall approve this! One question though: how did you update your post without the "last edited by" message? Special Admin edits?
__________________
Quote:
Originally posted by Rising_Dusk
Your spells are mostly ignored because they are not very cool so we aren't very excited to review/approve them, but you are incredibly persistent and won't give us an excuse to graveyard it. That is generally what results in a resource being ignored for a long time.

The Spell Request Thread Done for, unless someone else wants to revive it...
It lasted a damn long time.

Please; Ask for Help Appropriately














Quote:
Originally posted by Kyrbi0
Huh. Almost makes me wish I had a girlfriend, to take advantage of today (wait, no, that's not what I meant... I mean, take advantage of the fact that it is international women's day... gah, never mind).
Quote:
Originally posted by Pyrogasm
Rome may not have been built in a day, but the Romans sure as hell didn't say "look at this great city we built guys!" when they had nothing more than a bit of stone and some cottages.
Pyrogasm is offline   Reply With Quote
Old 03-31-2008, 05:02 AM   #13
Rising_Dusk
Obscurity, the Art


Projects Director
Project Leader: OD
 
Join Date: Feb 2006
Posts: 9,727

Submissions (27)

Rising_Dusk has a reputation beyond repute (1192)Rising_Dusk has a reputation beyond repute (1192)Rising_Dusk has a reputation beyond repute (1192)Rising_Dusk has a reputation beyond repute (1192)Rising_Dusk has a reputation beyond repute (1192)Rising_Dusk has a reputation beyond repute (1192)Rising_Dusk has a reputation beyond repute (1192)Rising_Dusk has a reputation beyond repute (1192)Rising_Dusk has a reputation beyond repute (1192)

Hero Contest #3 - 1st PlaceApproved Map: Desert of ExileApproved Map: Advent of the ZenithHero Contest #2 - 1st PlaceHero Contest - Third place>

Send a message via AIM to Rising_Dusk Send a message via MSN to Rising_Dusk
Default

Quote:
Originally Posted by Pyrogasm
One question though: how did you update your post without the "last edited by" message? Special Admin edits?
I don't know. I seem to be the only admin that happens with, but I have no idea why it works like that, I probably broke something. >_<

Quote:
Originally Posted by moyack
One question: why you stop the timer when there's no units to move? to improve performance??? that's not necessary, and you save code. Even better, you can replace (optionally) the timer with a periodic trigger.
Periodic triggers use timers internally, so it's always more efficient to directly use a timer. Also, I stop the timer because there's no sense having it run when it isn't needed.

Quote:
Originally Posted by Pyrogasm
On that note, I shall approve this!
Yay!
__________________
Rising_Dusk is offline   Reply With Quote
Old 03-31-2008, 09:43 AM   #14
Fulla
Evil Overlord
 
Fulla's Avatar
 
Join Date: Jan 2006
Posts: 1,416

Submissions (3)

Fulla has a spectacular aura about (79)Fulla has a spectacular aura about (79)Fulla has a spectacular aura about (79)

Default

Would be neat if you added a little collision causes knockback, i.e. when a unit is sliding back and knocks into another unit, it causes it to get knockbacked aswell.
__________________

Last edited by Fulla : 03-31-2008 at 09:44 AM.
Fulla is offline   Reply With Quote
Old 03-31-2008, 07:17 PM   #15
Deaod
User
 
Join Date: Jan 2007
Posts: 541

Submissions (11)

Deaod is a jewel in the rough (192)Deaod is a jewel in the rough (192)Deaod is a jewel in the rough (192)

Send a message via ICQ to Deaod Send a message via MSN to Deaod
Default

hmm, i wonder what happens when units are pushed over the edge of a pathing type (eg: from floatability to walkability). The Effect shouldnt change, afaics. nvm, just noticed the if statement in the uptdate function.

Besides, from reading i would say, that units will move far too fast, youll have to replace (n.Speed) with (n.Speed*TimerInterval) to make it userfriendly, or you put into the readme, that users have to pass (desiredspeed * TimerInterval). Same applies to decrement.

Last edited by Deaod : 03-31-2008 at 08:00 PM.
Deaod is offline   Reply With Quote
Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off


All times are GMT. The time now is 09:16 AM.


Donate

Affiliates
The Hubb http://bylur.com - Warcraft, StarCraft, Diablo and DotA Blog & Forums The JASS Vault Clan WEnW Campaign Creations Clan CBS GamesModding Flixreel Videos

Powered by vBulletin (Copyright ©2000 - 2014, Jelsoft Enterprises Ltd).
Hosted by www.OICcam.com
IT Support and Services provided by Executive IT Services