Ah...i didn't explained carefully. The speed bonus WAS a item ability, then i set 'Stats - Item Ability' equal to 'False'. I i wanted to say is that the spell WAS for an item, but now, it's for a unit.
Btw - i tried the 'control + D' thingy and then - a sorcery happen! :O I saw the codes of the spells.
))
And... i don't have JNGP. Can you give me a link to download it?
JNGP stands for JassNewgenPackage. Here's a complete guide on how to install and set it up:
http://www.hiveworkshop.com/forums/...456/how-download-install-confige-jngp-160547/
It also adds a lot of usefull extra functionality to the standard world editor.
Once you've installed it, it is a lot easyer to learn how Jass works with the function list...
Also, if you want to learn how to execute a specific function in Jass simply create it in GUI, then convert that GUI to custom text and you can see which function is being used.
Be aware that a lot of functions that are being called through GUI are so called BJ natives. Here is an example:
Lets say I want to add an ability to a unit whenever it enters playable map area. In GUI it will look something like this:
-
add ability
-
Events
-
Unit - A unit enters (Playable map area)
-
Conditions
-
Actions
-
Unit - Add Acid Bomb to (Triggering unit)
If I convert this to custom text with Edit -> Convert to Custom Text (You can reverse this by selecting the trigger and pressing Control + Z)
It will look something like this:
JASS:
function Trig_add_ability_Actions takes nothing returns nothing
call UnitAddAbilityBJ( 'ANab', GetTriggerUnit() )
endfunction
//===========================================================================
function InitTrig_add_ability takes nothing returns nothing
set gg_trg_add_ability = CreateTrigger( )
call TriggerRegisterEnterRectSimple( gg_trg_add_ability, GetPlayableMapRect() )
call TriggerAddAction( gg_trg_add_ability, function Trig_add_ability_Actions )
endfunction
If you search for UnitAddAbilityBJ in the function list it'll show this:
JASS:
function UnitAddAbilityBJ takes integer abilityId, unit whichUnit returns boolean
return UnitAddAbility(whichUnit, abilityId)
endfunction
So as you can see, the BJ simply calls UnitAddAbility. This is pretty useless and takes up time. In order to optimize it we simply call UnitAddAbility ourselves...
So now the script looks something like this:
JASS:
function Trig_add_ability_Actions takes nothing returns nothing
call UnitAddAbility( GetTriggerUnit(), 'ANab' )
endfunction
//===========================================================================
function InitTrig_add_ability takes nothing returns nothing
set gg_trg_add_ability = CreateTrigger( )
call TriggerRegisterEnterRectSimple( gg_trg_add_ability, GetPlayableMapRect() )
call TriggerAddAction( gg_trg_add_ability, function Trig_add_ability_Actions )
endfunction
Now I'll explain how the event and actions work:
This part basically is what creates, initializes and puts together the GUI trigger:
JASS:
function InitTrig_add_ability takes nothing returns nothing
set gg_trg_add_ability = CreateTrigger( )
call TriggerRegisterEnterRectSimple( gg_trg_add_ability, GetPlayableMapRect() )
call TriggerAddAction( gg_trg_add_ability, function Trig_add_ability_Actions )
endfunction
function InitTrig basically means that whenever add_ability exists it will execute that function. So function InitTrig_add_ability will be executed if add_ability exists.
Now what it does is set a variable called gg_trg_add_ability to be a trigger.
gg_trg_add_ability now is the actual trigger. And you can use this to add events and actions to that trigger.
TriggerRegisterEnterRectSimple adds the event a unit enters a region. As you can see this function is also in red because it also calls other functions. In the function list it shows this:
JASS:
function TriggerRegisterEnterRectSimple takes trigger trig, rect r returns event
local region rectRegion = CreateRegion()
call RegionAddRect(rectRegion, r)
return TriggerRegisterEnterRegion(trig, rectRegion, null)
endfunction
as you can see a local region is created and then used inside the function TriggerRegisterEnterRegion. We're just going to use that function instead to optimize it. So to optimize it we'll use:
JASS:
TriggerRegisterEnterRegion(gg_trg_add_ability, GetPlayableMapRect, null)
As you might have noticed GetPlayableMapRect is also unnessecary. Check the function list and it shows:
JASS:
function GetPlayableMapRect takes nothing returns rect
return bj_mapInitialPlayableArea
endfunction
Now let's use that instead:
JASS:
TriggerRegisterEnterRegion(gg_trg_add_ability, bj_mapInitialPlayableArea, null)
Now the entire function should look something like this:
JASS:
function Trig_add_ability_Actions takes nothing returns nothing
call UnitAddAbility( GetTriggerUnit(), 'ANab' )
endfunction
//===========================================================================
function InitTrig_add_ability takes nothing returns nothing
set gg_trg_add_ability = CreateTrigger( )
call TriggerRegisterEnterRegion(gg_trg_add_ability, bj_mapInitialPlayableArea, null)
call TriggerAddAction( gg_trg_add_ability, function Trig_add_ability_Actions )
endfunction
call TriggerAddAction simply adds the actions to the trigger that need to be executed when the event starts. So function Trig_add_ability_Actions will be added to gg_trg_add_ability and will be called when the event is started.
As you can see Jass is actually quite simple. And it allows you to create triggers which can be way faster then GUI since GUI uses a lot of function calls which are unnessecary.
(This was just a simple explenation how triggers work in Jass and how to optimize them)
I hope you start learning Jass, it's way more efficient and gives you more power then GUI ^.^