- Joined
- Oct 24, 2012
- Messages
- 6,545
Very nice tut for GUI-er
But you should consider removing your signature on the second post.
thanks and thanks lol i thought i did remove it lol
Very nice tut for GUI-er
But you should consider removing your signature on the second post.
Congrats on the approval Mate!!
Oh yeah, about do nothing, note that Do Nothing is for filler in this trigger :
Since if you use that trigger u need to fill the other empty one. Anyway, nice tutorial, useful for me making a minor system
Action
If Condition then do Action else do Action
+2 Rep From Daffa the Mage
No it doesn't: you can do it with the standard World Editor as well.And one question, does the chapter 22 reqires JNGP?
If not, i can't make it :/
This might be because the way the triggers are organized.Weird, i copied and pasted the same things of ch 22, and when i call the function, it causes errors :/
His indexing is dynamic.So, what is the difference between your indexing and dynamic indexing which was made by a respected user.
His indexing is dynamic.
Maker explained this quite nicely in this thread (it isn't the main point of the thread, but his explanation is very clear).
Neither deathismyfriend's nor Hanky's indexing are anything 'special'.
I actually think they're the same, except that Hanky's combined Hashtables with it (I don't think that's worth it, though).
You got something wrong there. The dynamic indexing part of my template is without hashtables. The unit indexing part is with hashtables since I dislike saving the index with the custom value function for units.
You have to understand that the template I made got more than just one indexing method.
i never saw ur template b4 so i cant comment on it. if u would tho could u give me link to ur template as i believe everyone should have a choice of what they like the indexed array format i use or the way u do it.
they are both efficient since u dont use hashtables and i would gladly put any links to tutorials that are covered under anything i cover in my tutorial.
I do disagree, you don't NEED those. You can code, anything with normal GUI therefor you don't NEED it. If you like GUI you want GUI not jass
There are tons of factual problems with this huge tutorial.
I tried to list them all and correct them but I got overwhelmed ~.~
Couple of things:
- A handle does not need to be destroyed, the JASS Pseudo-VM cleans a lot of shit for you, and yes, that means most temporaries. There are special cases where you have heap-allocated objects that are not cleaned up like locations, groups or special effects.
- Using the word "object" to describe a widget is not good enough. They are interactable. Widgets also have life and position. (GetWidgetLife, GetWidgetX, GetWidgetY)
- A handle is not a pointer to an internal data structure, a handle is an internal chunk of data and in JASS, when you actually use them, you are using a pointer to a handle.
They're not errors per se, just nitpicks.
You don't have to worry about them, just attend to this tutorial every 1-2 months and read over a bit to see if you can make things clearer and more correct.![]()
Very usefull tutorial for GUI-User![]()
Yeah it will.In the part you destroy the trigger it will leak since you don't remove actions of the trigger or am I wrong ?
Preload abilities
Events
Time - Elapsed game time is 0.00 seconds
Conditions
Actions
-------- Here we set the variables. --------
Set abilities[1] = Acid Bomb
Set abilities[2] = Animate Dead
Set abilities[3] = Attribute Bonus
Set abilities[4] = Avatar
Set abilities[5] = Avatar (Neutral)
-------- Now we will do the actions to preload --------
Set tempPoint = (Center of (Playable map area))
Unit - Create 1 Footman for Player 1 (Red) at tempPoint facing Default building facing degrees
Set tempUnit = (Last created unit)
For each (Integer tempInt) from 1 to 5, do (Actions)
Loop - Actions
Unit - Add abilities[tempInt] to tempUnit
Unit - Remove abilities[tempInt] from tempUnit
Unit - Remove tempUnit from the game
Custom script: call RemoveLocation( udg_tempPoint)
Custom script: set udg_tempPoint = null
Custom script: set udg_tempUnit = null
-------- Here is were we destroy the trigger since it isn't needed anymore. --------
Custom script: call DestroyTrigger( GetTriggeringTrigger())
loop
exitwhen i == 1000
//
//bla bla bla leaks leaks leaks
//
set i = i + 1
endloop
//
// where we call this code each 0.03 seconds using timer
//
function Trig_Melee_Initialization_Actions takes nothing returns nothing
set udg_p = Location(0, 0)
// over
set udg_p = GetRectCenter(GetPlayableMapRect())
// when
call CreateNUnitsAtLoc( 1, 'hfoo', Player(0), udg_p, bj_UNIT_FACING )
endfunction
//===========================================================================
function InitTrig_Melee_Initialization takes nothing returns nothing
set gg_trg_Melee_Initialization = CreateTrigger( )
call TriggerAddAction( gg_trg_Melee_Initialization, function Trig_Melee_Initialization_Actions )
endfunction
//-----------------------------------------------------
//-------------- Here how they look like --------------
//-----------------------------------------------------
function GetPlayableMapRect takes nothing returns rect
return bj_mapInitialPlayableArea
endfunction
function GetRectCenter takes rect whichRect returns location
return Location(GetRectCenterX(whichRect), GetRectCenterY(whichRect))
endfunction
//-----------------------------------------------------
Also you don't need to null global variables.
Yeah, I see problem for GUI users...
As if their code don't look ugly enough without all that memory shit related problems.
It leaks if you don't null globals before changing the value.
Maker told it on a thread on the spell Gui Rupture
And well, it is still a really minor memory leak and sometimes you just can't avoid it. (even in vJass)Not allowing a handle id to be recycled immediately after destruction causes a memory leak.
Dying unit is as MUI as triggering unit.event:
Unit dies
actions:
Wait 10 seconds
revive dying unit
_____________________________
this is not mui. This isn't mui because dying unit is not a local event response, so it will be overwritten the next time a unit dies.
Adding a wait to map initialization pushes the actions to when the game started, because waits are not evaluated before the game starts (probably for the sake of sync and faster loading)
Still it means that you can do stuff as map init as the event.