 |   |  |  |
JASS Functions Approved JASS functions will be located here.
Remember to submit your own resources to the submission forum. |
 |
|
07-20-2007, 10:16 PM
|
#16 (permalink)
|
User
Join Date: Dec 2004
Posts: 61
|
You have a bunch of functions that start with alot of typing and then a _ and then a sub name for the function. Why not just set these into scopes and then make them public? it does the same thing but if you use the function inside the scope you don't have to type or read all of that.
|
|
|
07-21-2007, 09:10 AM
|
#17 (permalink)
|
BBoy Silv
Join Date: Nov 2006
Posts: 866
|
Well now I already done it, typed and read all of it. So it won't make any difference when I change it, though I'm not sure what you mean.
__________________
PurgeandFire111: Then you can delete the sound and whala... You have the label,filepath, and other parameters.
Silvenon: It's voila, not whala, you... stupidhead :)
PurgeandFire111: Yeah, I was in a rush. =( *cry*
Herman: Voila is an instrument that I quit playing in 6th grade, whala works just fine if not better
PurgeandFire111: No, viola is an instrument. Stupidhead... =D
|
|
|
07-26-2007, 04:59 PM
|
#18 (permalink)
|
Shifting voidwalker!
Join Date: Nov 2004
Posts: 396
|
A way to make it more efficient would be getting rid of the Cos() and Sin() in the Excecute function.
local real x=GetUnitX(SomeUnitWhoKnocks) local real y=GetUnitY(SomeUnitWhoKnocks) local real x2=GetUnitX(SomeKnockedUnit) local real y2=GetUnitY(SomeKnockedUnit) local real angle=Atan2(y2-y, x2-x) local real xspeed local real yspeed local real speed= 22 //How long the unit is knocked every 0.035 second or whatever the interval is set xspeed=speed*Cos(angle) set yspeed=speed*Sin(angle) How to use then in a periodical trigger.
call SetUnitX(u, GetUnitX(u)+xspeed) call SetUnitY(u, GetUnitY(u)+yspeed) instead of calling Cos() and Sin() every time the unit is moved you can just add x/yspeed onto it's current position.
|
|
|
07-30-2007, 03:00 PM
|
#19 (permalink)
|
BBoy Silv
Join Date: Nov 2006
Posts: 866
|
But the speed lowers with each execution, shouldn't I just put Cos(angle) and Sin(angle) in a variable? Then it won't be calling Cos and Sin in every execution. I will update this function when I get back from the holidays, that would be in 2 weeks. You probably noticed that it's missing an important update: prevent going outside the playable map area. :)
__________________
PurgeandFire111: Then you can delete the sound and whala... You have the label,filepath, and other parameters.
Silvenon: It's voila, not whala, you... stupidhead :)
PurgeandFire111: Yeah, I was in a rush. =( *cry*
Herman: Voila is an instrument that I quit playing in 6th grade, whala works just fine if not better
PurgeandFire111: No, viola is an instrument. Stupidhead... =D
|
|
|
07-30-2007, 10:16 PM
|
#20 (permalink)
|
Shifting voidwalker!
Join Date: Nov 2004
Posts: 396
|
Doesn't it keep having the same speed untill it has reached the distance?
Well, if it doesn't, then yes, storing Cos/Sin would be more efficient than calling it each time the timer expires.
|
|
|
07-31-2007, 04:56 PM
|
#21 (permalink)
|
BBoy Silv
Join Date: Nov 2006
Posts: 866
|
No it doesn't, then that would be a simple knockback code that everybody can write (not that this is complicated, but it looks nicer that way). This is the line that lowers the distance:
set kd.d1 = kd.d1 - kd.d2
Ok, then I will do that.....later though. One question: I think this knocback code isn't gonna break a channeling spell, because after it's unpaused, it continues channeling right? So should I put a SetUnitPosition(u, GetUnitX(u), GetUnitY(u)) in the beginning? (Because SetUnitPosition, unlike SetUnitX/Y, breaks channeling spells, among other things)
EDIT: Fixes:
- the knockbacked unit stops if it reaches an unpathable point (that includes the outside of playable map area)
- a small performance improvement, thanks to Diablo-dk
- now the knocback breaks channeling spells
Also, if using this function, you need to credit Vexorian because of his CheckPathability function
I didn't test this function after these fixes, so let me know if I made a mistake somewhere
__________________
PurgeandFire111: Then you can delete the sound and whala... You have the label,filepath, and other parameters.
Silvenon: It's voila, not whala, you... stupidhead :)
PurgeandFire111: Yeah, I was in a rush. =( *cry*
Herman: Voila is an instrument that I quit playing in 6th grade, whala works just fine if not better
PurgeandFire111: No, viola is an instrument. Stupidhead... =D
Last edited by Silvenon; 08-12-2007 at 09:23 PM..
|
|
|
08-16-2007, 03:46 AM
|
#22 (permalink)
|
Totally Nuts
Join Date: Jun 2007
Posts: 306
|
just out of interest, would there be any possible way, no matter how hard, to make nearly this in gui or not?
__________________
You do not have sufficient reputation to view this person's signature.
|
|
|
08-16-2007, 06:44 AM
|
#23 (permalink)
|
iRawr
Join Date: Dec 2005
Posts: 8,349
|
Quote:
|
just out of interest, would there be any possible way, no matter how hard, to make nearly this in gui or not?
|
You could make a lame, horribly inefficient, non-MUI version. But why would you want to? You can still use this in GUI.
|
|
|
08-16-2007, 08:06 AM
|
#24 (permalink)
|
BBoy Silv
Join Date: Nov 2006
Posts: 866
|
Yeah, it's really easy, we can explain you how if you want
__________________
PurgeandFire111: Then you can delete the sound and whala... You have the label,filepath, and other parameters.
Silvenon: It's voila, not whala, you... stupidhead :)
PurgeandFire111: Yeah, I was in a rush. =( *cry*
Herman: Voila is an instrument that I quit playing in 6th grade, whala works just fine if not better
PurgeandFire111: No, viola is an instrument. Stupidhead... =D
|
|
|
08-17-2007, 05:10 AM
|
#25 (permalink)
|
User
Join Date: Aug 2007
Posts: 40
|
I would like to know how to, I dont know jass
__________________
HTML Code:
__ __
/ \__/ \
/ /\__/\ \ oodest
/_/ \_\ oo
|
|
|
08-17-2007, 09:12 AM
|
#26 (permalink)
|
Banned
Join Date: Nov 2006
Posts: 6,459
|
could you upload script as .txt? I can't CnP this :P
|
|
|
08-17-2007, 01:14 PM
|
#27 (permalink)
|
BBoy Silv
Join Date: Nov 2006
Posts: 866
|
Why don't you just CnP line by line??? Hehe :)
Why didn't anybody ask me this before? I forgot that you can't CnP normally with those tags.
__________________
PurgeandFire111: Then you can delete the sound and whala... You have the label,filepath, and other parameters.
Silvenon: It's voila, not whala, you... stupidhead :)
PurgeandFire111: Yeah, I was in a rush. =( *cry*
Herman: Voila is an instrument that I quit playing in 6th grade, whala works just fine if not better
PurgeandFire111: No, viola is an instrument. Stupidhead... =D
|
|
|
08-18-2007, 12:00 AM
|
#28 (permalink)
|
iRawr
Join Date: Dec 2005
Posts: 8,349
|
Quote it and CnP it from that -- that's what I do.
Anyhow, MoodestMoo, basically...
First, you need to be running on the NewGenWE from JassNewGenPack, found in the Tools section over at www.wc3campaigns.net
Next, copy the script into any blank trigger of your choice, by "Converting the trigger to custom text". Delete anything else that was in the trigger before you paste this script in.
Next, just call the function via a Custom Script action.
Syntax:
Custom script: call UnitKnockback( unit (unit), dist (real), angle (real), dur (real), sfxpath (string) )
So, let's say you had a unit var called MyUnit. The first parameter would be udg_MyUnit, giving us
Custom script: call UnitKnockback( udg_MyUnit, dist (real), angle (real), dur (real), sfxpath (string) )
Next, let's say we wanted it to knockback 500. Well, add that to the second field.
Custom script: call UnitKnockback( udg_MyUnit, 500, angle (real), dur (real), sfxpath (string) )
Next, add the angle (IN RADIANS, 0-2pi) to the third field. If you don't know how to use radians, instead add the angle in Degrees and then add *bj_DEGTORAD at the end.
Eg:
Custom script: call UnitKnockback( udg_MyUnit, 500, GetUnitFacing(udg_MyUnit)*bj_DEGTORAD, dur (real), sfxpath (string) )
Next, add how long it should take, eg 5 seconds
Custom script: call UnitKnockback( udg_MyUnit, 500, GetUnitFacing(udg_MyUnit)*bj_DEGTORAD, 5, sfxpath (string) )
Finally, add the effect's string path. You can find this by:
First, pick your effect in the object editor. In the "Custom" field, you should see a path that looks something like
Abilities\Spells\Human\HolyBolt\HolyBoltSpecialArt.mdl
(that one's the holy light path, if I recall correctly)
So, enclose that in quotes, then double all the slashes. Put that into the last field:
Custom script: call UnitKnockback( udg_MyUnit, 500, GetUnitFacing(udg_MyUnit)*bj_DEGTORAD, 5, "Abilities\\Spells\\Human\\HolyBolt\\HolyBoltSpecialArt.mdl" )
|
|
|
08-18-2007, 09:54 AM
|
#29 (permalink)
|
BBoy Silv
Join Date: Nov 2006
Posts: 866
|
Is it ok now? The problem is that quote tags doesn't indent.
__________________
PurgeandFire111: Then you can delete the sound and whala... You have the label,filepath, and other parameters.
Silvenon: It's voila, not whala, you... stupidhead :)
PurgeandFire111: Yeah, I was in a rush. =( *cry*
Herman: Voila is an instrument that I quit playing in 6th grade, whala works just fine if not better
PurgeandFire111: No, viola is an instrument. Stupidhead... =D
|
|
|
08-18-2007, 05:23 PM
|
#30 (permalink)
|
iRawr
Join Date: Dec 2005
Posts: 8,349
|
No, sorry, what I meant is that if you quote the post and CnP the required text, it CnPs properly with the linebreaks :p
(fixed your post)
|
|
|
| Thread Tools |
|
|
| Display Modes |
Linear Mode
|
Posting Rules
|
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
HTML code is Off
|
|
|
Similar Threads
|
| Thread |
Thread Starter |
Forum |
Replies |
Last Post |
|
Knockback Help
|
ReGnerA |
Triggers & Scripts |
27 |
04-05-2008 08:28 PM |
|
[Trigger] Knockback spell
|
funyuns9999 |
Triggers & Scripts |
1 |
03-02-2008 11:05 AM |
|
[JASS] Knockback!
|
Japut3h |
Triggers & Scripts |
29 |
02-16-2008 10:53 PM |
|
[JASS] How to do knockback
|
Dracula |
Triggers & Scripts |
8 |
01-19-2008 12:18 AM |
|
knockback spell help
|
BlazeLancer |
Triggers & Scripts |
3 |
01-07-2007 10:34 AM |
|  |  |  |  |   |  |
|