Ok, i have recently gotten into jass upon learning it could use functions that the conventional triggering method could not. (Trackable mapping ^,^)
But i have a few questions (Sorry if they've been awnsered):
In every blizzard game, blizzard at the very least destroys all variables instantly after use. But my question is, would nullifying the variable be more efficient?
Blizzard likes jass, thats not to unusual seeing as they programmed the language. But im wondering if jass triggers reduce lag (Does the trigger editor normal convert to Trigger > Jass > ASCII? or just Trigger > ASCII?).
Functions. Functions take XXX and return XXX. I have a two part question: Do i need to generate a local for the "take XXX" part? Or are the locals generated by the call function? And how do i find what was returned?
Additional functions: The only function i know that is not possible with conventional triggers is trackable grid mapping. Are there any others?
In every blizzard game, blizzard at the very least destroys all variables instantly after use. But my question is, would nullifying the variable be more efficient?
I believe Blizzard are reference counting the handles, so that a handle's id is free for recycling once it is no longer referenced by any variables. But Blizzard did not decrease the reference counter when local handles are eliminiated at the end of a function. If all of that went your over your head, just think of it as a bug that we are working around by settings locals to null.
But im wondering if jass triggers reduce lag
Converting your GUI trigger to custom text will NOT reduce lag, because GUI triggers are always converted to custom text internally and used by the game. However, you CAN reduce lag enormously using Jass, but converting it to Jass alone is not enough.
Do i need to generate a local for the "take XXX" part? Or are the locals generated by the call function? And how do i find what was returned?
The locals are generated automatically. If you declare a local with the same name as a parameter, the parameter gets hidden behind the local, so don't do that. To fetch the return value of a function, just treat the function call as a value. For example:
local integer a = MyFunction(45)
// The return value of MyFunction is stored in a
The only function i know that is not possible with conventional triggers is trackable grid mapping. Are there any others?
Well, Jass has local variables, where GUI does not. Jass can work with the GetLocalPlayer function, so for example: You can make special effects visible for only one player. A World Editor "Region" is actually called "rect" in Jass. In Jass there is a variable type caleld "region" which are like rects, except they can cover any type of shape on the map. They are rarely used though. In Jass we can use the "Handle Vars" - which are a result of the gamecache and the return bug combined.
I hope that helped you out.
Edit: In reply to your second post, try changing this line:
Unit CreatNUnitAtLoc( 1, 'h000', GetOwningPlayer(GetSpellAbilityUnit()), Chainer)
// Try this instead:
call CreateNUnitsAtLoc( 1, 'h000', GetOwningPlayer(GetSpellAbilityUnit()), Chainer)