- Joined
- Feb 18, 2005
- Messages
- 263
Hi
i wrote a little jass script, that should simply manage some harmless way to learn skills when getting an item. Include some requirements and stuff, but without gamecache.
But once i finished the scripting, compiled it (without any errors) and tested it, i saw that no trigger i had added did anything at all.
I tested adding some simple new ones, or to copy 'n' paste my jass into a new map. but neither way was successfull.
Could anyone please help me fixing thos script?
i wrote a little jass script, that should simply manage some harmless way to learn skills when getting an item. Include some requirements and stuff, but without gamecache.
But once i finished the scripting, compiled it (without any errors) and tested it, i saw that no trigger i had added did anything at all.
I tested adding some simple new ones, or to copy 'n' paste my jass into a new map. but neither way was successfull.
Could anyone please help me fixing thos script?
Code:
function foo takes nothing returns nothing
local integer tmp_item
//for each item that teaches a skill do
//summon Bear
set tmp_item = 'I001'
set udg_item_req_str[tmp_item] = 0
set udg_item_req_agi[tmp_item] = 0
set udg_item_req_int[tmp_item] = 100 //average IQ
set udg_item_req_lvl[tmp_item] = 0
set udg_item_spellbook_ability[tmp_item] = 'A00A' //the summon bear spellbook
set udg_item_ability[tmp_item] = 'A006' //the summon bear spell
set udg_item_max_lvl[tmp_item] = 1
set udg_item_rarity[tmp_item] = 1 //the higher the number the higher the chance for this item to be picked
set udg_item_color[tmp_item] = 1 //0=all, 1=elf, 2=human, 3=undead -> maybe later 5 colors + artifacts as in MtG
//summon Falcon
set tmp_item = 'I000'
set udg_item_req_str[tmp_item] = 0
set udg_item_req_agi[tmp_item] = 0
set udg_item_req_int[tmp_item] = 90 //easy spell
set udg_item_req_lvl[tmp_item] = 0
set udg_item_spellbook_ability[tmp_item] = 'A00C' //the summon falcon spellbook
set udg_item_ability[tmp_item] = 'A007' //the summon falcon spell
set udg_item_max_lvl[tmp_item] = 1
set udg_item_rarity[tmp_item] = 1 //the higher the number the higher the chance for this item to be picked
set udg_item_color[tmp_item] = 1 //0=all, 1=elf, 2=human, 3=undead -> maybe later 5 colors + artifacts as in MtG
//summon Quillbeast
set tmp_item = 'I002'
set udg_item_req_str[tmp_item] = 0
set udg_item_req_agi[tmp_item] = 0
set udg_item_req_int[tmp_item] = 0
set udg_item_req_lvl[tmp_item] = 0
set udg_item_spellbook_ability[tmp_item] = 'A00D' //the summon quillbeast spellbook
set udg_item_ability[tmp_item] = 'A005' //the summon quillbeast spell
set udg_item_max_lvl[tmp_item] = 1
set udg_item_rarity[tmp_item] = 1 //the higher the number the higher the chance for this item to be picked
set udg_item_color[tmp_item] = 1 //0=all, 1=elf, 2=human, 3=undead -> maybe later 5 colors + artifacts as in MtG
//endfor
endfunction
function error takes string message returns nothing
call DisplayTextToForce( GetPlayersAll(), message )
endfunction
function learnSkillFromItem takes unit hero, integer myitem returns boolean
local integer is_str = GetHeroStatBJ(bj_HEROSTAT_STR, hero, false)
local integer is_agi = GetHeroStatBJ(bj_HEROSTAT_AGI, hero, false)
local integer is_int = GetHeroStatBJ(bj_HEROSTAT_INT, hero, false)
local integer is_lvl = GetHeroLevel(hero)
local integer req_str = udg_item_req_str[myitem]
local integer req_agi = udg_item_req_agi[myitem]
local integer req_int = udg_item_req_int[myitem]
local integer req_lvl = udg_item_req_lvl[myitem]
local integer item_ability = udg_item_spellbook_ability[myitem]
local integer item_abi_mlvl = udg_item_max_lvl[myitem]
if ( req_str > is_str ) then
call error("you are not strong enough")
return false
endif
if ( req_agi > is_agi ) then
call error("you are not fast enough")
return false
endif
if ( req_int > is_int ) then
call error("you are not smart enough")
return false
endif
if ( req_lvl > is_lvl ) then
call error("you do not have the required level")
return false
endif
if ( GetUnitAbilityLevelSwapped(item_ability, hero) == item_abi_mlvl ) then
call error("you have already maxed this skill")
return false
endif
if ( GetUnitAbilityLevelSwapped(item_ability, hero) == 0 ) then
//call add_ability_to_unit(hero, item_ability)
return true
endif
if ( GetUnitAbilityLevelSwapped(item_ability, hero) > 0 ) then
//call increase_ability(hero, item_ability)
return true
endif
call error("unknown error")
return false
endfunction