HomeUser Control Panel (unavailable in archive)ForumsTutorialsArt GalleryResourcesMaps

How do i use this Jass code?

02-23-2007, 09:45 AM#1
Callahan
Collapse JASS:
native SetUnitAbilityLevel (unit whichUnit, integer abilcode, integer level) returns integer

Someone gave me that jass code but i don't know how to use it in a map.
I know litteraly nothing about Jass.
I have to put it in a custom script?
And replace colored word by a vraiable right?
for instance i replace
Collapse JASS:
unit whichUnit
by
Collapse JASS:
Footman 001 <gen> whichUnit
right?
I know i have to replace integrer by a number
And abilcode are stuff like A011,A00Z,A010,A00Y,S000... if it's that i know how to get them (auto fill levels of Data-Spell list of a spell book abilitie)

Collapse JASS:
integer level
For this one i want to set the abilitie level to the level of another abilitie.Follow the GUI trigg
er:
Trigger:
Collapse Events
Unit - A unit Finishes casting an ability
Collapse Conditions
(Ability being cast) Equal to Summon pet
Collapse Actions
Unit - Remove Tamed_pet_unit from the game
Unit - Create 1 Tamed_pet_unit_type for (Owner of (Casting unit)) at ((Position of (Casting unit)) offset by 100.00 towards (Facing of (Casting unit)) degrees) facing Default building facing (270.0) degrees
Set Tamed_pet_unit = (Last created unit)
Special Effect - Create a special effect attached to the origin of Tamed_pet_unit using Abilities\Spells\NightElf\Blink\BlinkTarget.mdl
Special Effect - Destroy (Last created special effect)
Unit - Set Tamed_pet_unit movement speed to 320.00
Unit - Add Pet - armor to Tamed_pet_unit
Unit - Set level of Pet - armor for Tamed_pet_unit to (Level of Summon pet for Hero[1])
Unit - Add Pet - attackspeed to Tamed_pet_unit
Unit - Set level of Pet - attackspeed for Tamed_pet_unit to (Level of Summon pet for Hero[1])
Unit - Add Pet - damage to Tamed_pet_unit
Unit - Set level of Pet - damage for Tamed_pet_unit to (Level of Summon pet for Hero[1])
Unit - Add Pet - hp to Tamed_pet_unit
Unit - Set level of Pet - hp for Tamed_pet_unit to (Level of Summon pet for Hero[1])
Unit - Add Pet - regen to Tamed_pet_unit
Unit - Set level of Pet - regen for Tamed_pet_unit to (Level of Summon pet for Hero[1])
So according to Summon pet abilitie level the pet has better bonus attribute.
The sumoning unit is of course
Trigger:
Hero[1]
The problem is that it doesn't work for the abilitie Pet - hp(made from bonus hitpoint abilitie) and Pet - regen(made from life regen bonus abilitie)
I wonder if it can be solve with JASS code
02-23-2007, 10:02 AM#2
Pyrogasm
You got it backwards, actually.

When implementing a JASS scrtipt, whatever is blue you omit (leave out) and you replace the whichunit etc. with your unit/integer/whatever.

The ability code is, yes, a hex-code like you wrote. But it must be between apostrophies (these things: ' ). So it would look like this: 'A00H'.

If you wanted to get the level of a unit's ability in jass, you would use GetUnitAbilityLevel( whichunit, abilcode ). For "whichunit", you'd use GetTriggerUnit() in your case. "Abilcode" is, again, just the rawcode of the ability you want to get the level for.

You may also use variables for integers and whichunits, but remember that when you use a variable you've made in the variable editor, you must add the prefix "udg_" to it in the script.

Pretty simple, and a demonstration line is:
Collapse JASS:
call SetUnitAbilityLevel( udg_Tamed_pet_unit, 'A000', GetUnitAbilityLevel(GetTriggerUnit(), 'A00H') )
Just remember that JASS is case sensitive, so "A" is not the same as "a".

As for the setting the health ability thing, it's actually a bug, and is discussed by Blade.dk here.

Oh, and use "A unit starts the effect of an ability" instead of "A unit finishes casting an abilty", unless it's a channeling spell
02-23-2007, 02:43 PM#3
The)TideHunter(
Oh, btw when you said "Footman 001 <gen> whichUnit"

You cannot use that, it is not a variable, but a name. Footman 001 <gen> is a label the WE gives to each preplaced unit (if it says <gen> its preplaced).

To get a units real "name" if you like, you should use GUI and do something like "Unit - Kill Unit, and put your unit that you want to find out's real name there, convert to Jass, and you should see it something like "gg_unit_pala_001" or something, that was a random guess btw.

But Footman 001 <gen> will not work.