HomeUser Control Panel (unavailable in archive)ForumsTutorialsArt GalleryResourcesMaps

Need JASS script; credit offered!

10-15-2003, 09:29 PM#1
Bhav_88
Working on a new AOS type game. It will be better than (insert name of select AOS game here). It will also be better than sliced bread. I need a spell that will do the following:


Unit casts spell based on Warstomp or Thunderclap.

Surrounding units slide backwards at a reasonable angle.


I can get the units to appear back in the proper spot, but I can't make them slide. We are reanimating all of the basic units for the mod so that we can make them play the animation:

fall

During the spell. Any help? Please?

-Tobar
10-16-2003, 01:08 AM#2
havy
*edit* --- Ack --- I guess I should start reading the post before answering lol ... just delete plz.

While I do not have the time to write the whole trigger for you,
I suggest you use a variation of the teleport spell. This won't get
you any special effects tho.

As for the coordinates, I think the engine provides you with polar
coordinates so you don't even need to mess with any calculations.

The whole thing shouldn't be too hard to write i guess.
10-16-2003, 02:12 AM#3
Bhav_88
It isn't the coordinates I cannot get. It's the sliding. I can make them instantly appear in their final position, but I need some JASS artist to add the sliding. During the slide, they'll play an animation tag 'fall'.
10-16-2003, 07:06 AM#4
KaTTaNa
I made this function some time ago while I was testing the Jass Editor for bugs. I havn't tested it though, but it should be more or less functional.
Code:
function KnockUnitDirection takes unit u, real dist, real angle returns nothing
    local real speed = dist / 4
    local location source = GetUnitLoc( u )
    
    loop
        exitwhen (dist <= 0) or (u == null)
        
        call SetUnitPositionLoc( u, PolarProjectionBJ( source, speed, angle ) )
        
        set speed = speed - speed / 5
        set dist = dist - speed
        call PolledWait( 0.1 )
    endloop    
endfunction
You can call it like:
Custom Script: call KnockUnitDirection( unit, distance, angle )
10-16-2003, 09:54 PM#5
Bhav_88
Thanks... Now, assuming I know nothing of JASS at all, how might I implement this? I'm trying to learn JASS but I'm not doing too well, so I don't know what you mean by Calling it.

Do you mean make a trigger so that when a unit casts my custom spell, it runs that trigger?

Also, what might I add to make units play the 'fall' animation during the execution?

Sorry for all the questions, but as I said, I seem to be unable to understand JASS at all...
10-17-2003, 03:53 AM#6
Klownkiller
this is how to implement the code.

copy and paste them into the top of the .j file (in the trigger editor click the filename of your map -- it's at the very top of the categories -- to see where to do this). the screen should be blank if you have done no Jass scripting.

And yes you create a trigger that runs the function for you

like:

Event
Unit - A unit Begins casting an ability

Condition
((Ability being cast) Equal to (choose your spell here)

Action
Custom Script: call KnockUnitDirection( unit, distance, angle )
10-17-2003, 03:59 AM#7
Bhav_88
What goes in Unit, Distance, Angle?


I want the unit to be all units within, say, 350 of casting unit.

Distance can be anything, like 200-400

Angle is the angle between the picked unit and the casting unit.

Tried some converting GUI triggers to custom text and pasting various things in there, but I haven't a clue how to refer to the aformentioned objects.
10-21-2003, 03:23 AM#8
Bhav_88
Does anyone know how to refer to those things? I'd really like to get this working... doesn't anyone know? (Or, more accurately, Isn't anyone willing to help?)
10-21-2003, 01:48 PM#9
Tommi
Try this: Create a variable that is type of unit, let's say 'whichUnit', and two real variables, let's say 'dist' and 'angle'.

Now use Set Variable function to put the unit and two real values you want into them. Then refer to them in the custom script text with 'udg_' prefix. That is:

udg_whichUnit
udg_dist
udg_angle

Custom script code should look like this:

Code:
call KnockUnitDirection( udg_whichUnit, udg_dist, udg_angle )
You can use these variables over and over again in every function, as they are global.

Let me know if it works.
10-21-2003, 02:52 PM#10
TheEpigoni
Kattana...is the PolledWait function one of your own custom functions? Because I've never seen it in the .j's and well if it isn't I doubt Bhav will have much luck with it. =)
10-21-2003, 03:01 PM#11
Tommi
If that's the case, try replacing call PolledWait( 0.1 ) with
Code:
call TriggerSleepAction( 0.1 )
It might do the same but I haven't tested it.

Cheers,

Tommi
10-21-2003, 06:54 PM#12
Bhav_88
Will this work for multiple units at the same time? The basic point of this spell is that it hurls all units surrounding him back. Obviously, for "unit", I need a way to say, basically, "unit affected by spell". I can then set the distance and angles using the "unit affected by spell" thing.
10-21-2003, 07:03 PM#13
Tommi
Quote:
Originally posted by Bhav_88
Will this work for multiple units at the same time? The basic point of this spell is that it hurls all units surrounding him back. Obviously, for "unit", I need a way to say, basically, "unit affected by spell". I can then set the distance and angles using the "unit affected by spell" thing.
Most likely. Just set the variables anew before each calling of the function. You can use, for example, 'Pick each unit in a Group and do multiple actions' loop and at the beginning of the loop set whichUnit = (Picked unit) and then define the values of reals.
10-21-2003, 07:34 PM#14
Bhav_88
Thanks guys, for the help, but I don't need JASS. I have written an UBERLY complex GUI trigger that moves them back by a small increment insanely fast, playing animations and such.

Thanks anyway, though!
10-21-2003, 07:39 PM#15
KaTTaNa
PolledWait() is a function defined by blizzard. In the GUI it's called Wait (Game-time seconds).
The problem is, as the name suggests, that it's a polled wait and therefore isn't very accurate when it comes to small wait times.
TriggerSleepAction is famous for it's "wait bugs", which are that it behaves unexpected in multiplayer games, but I never got to the bottom of the whole thing so it might work in this case.

Btw, I don't suggest that you use the function I posted. I meant it as an example so you could see how to do it. It pauses the trigger from which it is called, so if you run it from a "pick every unit in group" it will make the units get pushed back one by one. :bgrun: