• 💀 Happy Halloween! 💀 It's time to vote for the best terrain! Check out the entries to Hive's HD Terrain Contest #2 - Vampire Folklore.❗️Poll closes on November 14, 2023. 🔗Click here to cast your vote!
  • 🏆 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!
  • 🏆 HD Level Design Contest #1 is OPEN! Contestants must create a maze with at least one entry point, and at least one exit point. The map should be made in HD mode, and should not be openable in SD. Only custom models from Hive's HD model and texture sections are allowed. The only exceptions are DNC models and omnilights. This is mainly a visual and design oriented contest, not technical. The UI and video walkthrough rules are there to give everyone an equal shot at victory by standardizing how viewers see the terrain. 🔗Click here to enter!

Efficiceny in SFX

Status
Not open for further replies.
Level 2
Joined
Jul 30, 2009
Messages
12
I'm making a spell and I'd like to know how to get a a dummy unit ( a spell ) to move in a straight line as efficient as possible

using a loop isn't efficient because if you were to use the triggersleepaction() it's inefficient already but it makes it all jumpy and such.

For example Shockwave the tauren cheiftan spell how would i reproduce that spell WITHOUT using specialeffects - so i mean the orb is a dummy unit

JASS not vJass please

-Thanks
 
Level 7
Joined
Dec 31, 2005
Messages
712
You'll need a timer, which is able to execute a function every 0.03 second, for example.

I really don't know how to do it with JASS without using Game Cache, which will be broken with 1.24, but you can create a timer and attach the unit, the angle and the speed to it.

Then use it to execute a function that moves the unit according to these parameters, moving it with either SetUnitPosition(u,x,y) or SetUnitX/SetUnitY(u,x/y).

Polar functions will also help:
newX = x + distance * Cos(angle in radians)
newY = y + distance * Sin(angle in radians)

CScache can be found in some other sites such as wc3c :p
 
Level 2
Joined
Jul 30, 2009
Messages
12
Cool, thank you very much for you response - I've seen on other people's maps Cache's and stuff like that although I don't really understand it. I'll check that out on the forums.

Could you go into a bit more detail about attaching the Timers? I've also tried that except I'm not sure which function/s to use and how to attach it properly.

Thanks~

*EDIT*

I see commands such as GetHandleUnit() I'm using NewGen and the command doesn't appear in my command list, neither does it appear in JassCraft, I'm a little confused on how it works although after looking through other people's maps I think I'm safe the say thats the function linking the Timer and the Unit/Speed etc How does it work tho??
 
Last edited:
Level 7
Joined
Dec 31, 2005
Messages
712
You'll need a big set of functions called CSCache (Vexorian) or Local Handle Variables (Kattana, if memory serves me well) and paste it in your map's header.

Those two have similar structures: they have an attachment system wich allows you to "attach" objects or any type of variable (except code) to another object like timers.

For example, Local Handle Vars work like this:
JASS:
call SetHandleObject( Timer, "movingUnit", Unit )
// Another function (in fact, the one called by the timer)
set MovingUnit = GetHandleUnit( GetExpiredTimer(), "movingUnit")

JassCraft probably has CScache added to it. The functions used above are called "AttachObject" and "GetAttachedUnit", respectively.
Other functions have the same structure: "AttachReal", "AttachInteger", "GetAttachedReal" etc...

Using this you can do something like:

JASS:
function FuncTimer takes nothing returns nothing
    set T = GetExpiredTimer()
    set u = GetAttachedUnit( T, "MovingUnit" ) // Use the same string
    // Now 'T' is the timer and 'u' is the unit attached to this timer
    set T = null
    set u = null
endfunction

function Start takes nothing returns nothing
 local timer T = CreateTimer()
    // Remember the string used here
    // It's the name of the "field" where the unit will be stored
    call AttachObject( T, "MovingUnit", GetTriggerUnit() )
    call TimerStart( T, 0.03, true, function FuncTimer )
 set T = null
endfunction

However, if you're using NewGen, you'd better learn how to use structs. Then it will be compatible with 1.24 and probably faster than using game cache.
 
Level 2
Joined
Jul 30, 2009
Messages
12
Thank you so much, I understand this so much more now and I've already updated the Kattana. When you say learn Structs you mean by using Kattana ...? or is that something completely new again in vJass as stated below.

Oh and to answer your question Mooglefrooglian I asked for no vJass because I can't understand it. I don't even know what it is for that matter.

I'm still a newb at JASS. :)

Thanks alot for your responses!

*EDIT*
well.. scratch what I just said, I searched vJASS and it seems like to me I can program vJASS in NewGen also, I shall look into this. :)
 
Status
Not open for further replies.
Top