| 06-21-2003, 10:32 PM | #1 |
I'm having a bit of a problem. When a character of mine morphs (into a werewolf), it doesn't receive its passive Critical Strike skill. I don't understand why it isn't working, and I was wondering if there was a way to change something in an .slk or text so that the spell would work properly. Thanks. |
| 06-21-2003, 11:19 PM | #2 |
go in the editor... and give the morphed wolf the spell ( i know its from dota :P ) if it doesnt work... its mainly because the meta only is meant for dh spells overall.. u can edit files maybe. |
| 06-22-2003, 01:06 AM | #3 |
It seems morphed heros suffer from the same glitch as upgraded buildings (and units in general). SLK & Profile editing won't help it i am afraid. Like them, they suffer from a faulty spell transfer and other similar issues. The fix for your Dragon Knight's dragon form that i made via triggers works perfectly. It is basically just an enhanced trigger that replaces the old unit (hero) with the same unit (meaning stats have to be traced if not accessible). As well as this fixed worked, i would recommend the same kind of fix for your werewolf hero. I know it is't as clean as an edited spell, but at least it works like a charm. Regards |
| 06-22-2003, 04:16 AM | #4 |
i have the same problem as eul to because when my millitia guy learns his level 8 magic and it transforms it doesnt have its other aura ChrydGod can u explain how to get rid of this problem again in more easier words to understand? i'm not as smart as eul |
| 06-23-2003, 04:38 PM | #5 |
All you need to do is detect when the spell is cast. Its quite easy as these kind of spells don't have a target. Use the event : A unit owned by player X is issued an order with no target And then the condition : issued Order = *order string for your spell* (look in txt files for the order string) The action is just replacing the issued unit with a unit of same unit type with the old one's relative life and mana (then reduce mana by the spell cost). Then if the unit is a hero, you can store the selected learnt spells in an array containing their levels. ex : Spell (Integer Array) At map init : Set Spell[1] = 0 (1st spell) Set Spell[2] = 0 (2nd spell) Set Spell[3] = 0 (3rd spell) Set Spell[4] = 0 (4th spell) everytime the hero learns a skill, compare the learnt spell with your hero's and increase the corresponding Spell[*spell number*] by one (level). Then to restore the spells, when the hero is replaced, just make him learn the spells according to their respective levels. And in the end, you might also restore the selection, but you will require custom text to call SyncSelections in order to avoid desync if the map is meant to be played on bnet. If you can't get it to work, here is how the triggers could look like (thats the fix for the Dragon Knight's Dragon Form in DOTA) : I didn't use an array in that one but rather 3 integers, Spell1, Spell2, Spell3 (to declare with other global variables) (sorry for custom text, but i am not very used to GUI) 1rst Triger (MAKE IT RUN AT MAP INIT): (Name : Init_Spells) Code:
function Trig_Init_Spells_Actions takes nothing returns nothing
set udg_Spell1 = 0
set udg_Spell2 = 0
set udg_Spell3 = 0
endfunction
//===========================================================================
function InitTrig_Init_Spells takes nothing returns nothing
set gg_trg_Init_Spells = CreateTrigger( )
call TriggerAddAction( gg_trg_Init_Spells, function Trig_Init_Spells_Actions )
endfunction2nd Triger : (Name : Function_Restore_Skills) Code:
function Trig_Function_Restore_Skills_Actions takes nothing returns nothing
local integer i = 1
if ( udg_Spell1 > 0 ) then
loop
exitwhen i > udg_Spell1
call SelectHeroSkill( udg_Dragon, 'AUdm' )
set i = i + 1
endloop
endif
set i = 1
if ( udg_Spell2 > 0 ) then
loop
exitwhen i > udg_Spell2
call SelectHeroSkill( udg_Dragon, 'AUdh' )
set i = i + 1
endloop
endif
set i = 1
if ( udg_Spell3 > 0 ) then
loop
exitwhen i > udg_Spell3
call SelectHeroSkill( udg_Dragon, 'AUdb' )
set i = i + 1
endloop
endif
set i = 1
call SelectHeroSkill( udg_Dragon, 'AEme' )
call SelectHeroSkill( udg_Dragon, 'DKdc' )
if ( GetLocalPlayer() == udg_DragonOwner ) then
call SelectUnit( udg_Dragon, true)
endif
call SyncSelections()
endfunction
//===========================================================================
function InitTrig_Function_Restore_Skills takes nothing returns nothing
set gg_trg_Function_Restore_Skills = CreateTrigger( )
call TriggerAddAction( gg_trg_Function_Restore_Skills, function Trig_Function_Restore_Skills_Actions )
endfunction3rd Triger : (Name : Store_Spells) Code:
function Trig_Store_Spells_Conditions takes nothing returns boolean
if ( ( GetUnitTypeId(GetLearningUnit()) == 'HC46') or ( GetUnitTypeId(GetLearningUnit()) == 'Ekee' ) ) then
return true
endif
return false
endfunction
function Trig_Store_Spells_Actions takes nothing returns nothing
if ( GetLearnedSkillBJ() == 'AUdm' ) then
set udg_Spell1 = ( udg_Spell1 + 1 )
endif
if ( GetLearnedSkillBJ() == 'AUdh' ) then
set udg_Spell2 = ( udg_Spell2 + 1 )
endif
if ( GetLearnedSkillBJ() == 'AUdb' ) then
set udg_Spell3 = ( udg_Spell3 + 1 )
endif
endfunction
//===========================================================================
function InitTrig_Store_Spells takes nothing returns nothing
local integer i = 1
set gg_trg_Store_Spells = CreateTrigger( )
loop
exitwhen i > 5
call TriggerRegisterPlayerUnitEventSimple( gg_trg_Store_Spells, Player(i), EVENT_PLAYER_HERO_SKILL )
set i = i + 1
endloop
call TriggerAddCondition( gg_trg_Store_Spells, Condition( function Trig_Store_Spells_Conditions ) )
call TriggerAddAction( gg_trg_Store_Spells, function Trig_Store_Spells_Actions )
endfunction4th Trigger : (Name : Change_to_Dragon_Form) Code:
function Trig_Change_to_Dragon_Form_Conditions takes nothing returns boolean
if ( not ( GetIssuedOrderIdBJ() == String2OrderIdBJ("metamorphosis") ) ) then
return false
endif
return true
endfunction
function Trig_Change_to_Dragon_Form_Actions takes nothing returns nothing
set udg_DragonOwner = GetTriggerPlayer()
call SetUnitManaBJ( GetOrderedUnit(), ( GetUnitStateSwap(UNIT_STATE_MANA, GetOrderedUnit()) - 150.00 ) )
call ReplaceUnitBJ( GetOrderedUnit(), 'Ekee', bj_UNIT_STATE_METHOD_RELATIVE )
call SetUnitFlyHeightBJ( GetLastReplacedUnitBJ(), 325.00, 325.00 )
set udg_Dragon = GetLastReplacedUnitBJ()
call DisableTrigger( gg_trg_Store_Spells )
call TriggerExecute( gg_trg_Function_Restore_Skills )
call EnableTrigger( gg_trg_Store_Spells )
call SetPlayerAbilityAvailableBJ( false, 'AEme', udg_DragonOwner )
call StartTimerBJ( udg_DC, false, 30.00 )
endfunction
//===========================================================================
function InitTrig_Change_to_Dragon_Form takes nothing returns nothing
set gg_trg_Change_to_Dragon_Form = CreateTrigger( )
call TriggerRegisterPlayerUnitEventSimple( gg_trg_Change_to_Dragon_Form, Player(1), EVENT_PLAYER_UNIT_ISSUED_ORDER )
call TriggerRegisterPlayerUnitEventSimple( gg_trg_Change_to_Dragon_Form, Player(2), EVENT_PLAYER_UNIT_ISSUED_ORDER )
call TriggerRegisterPlayerUnitEventSimple( gg_trg_Change_to_Dragon_Form, Player(3), EVENT_PLAYER_UNIT_ISSUED_ORDER )
call TriggerRegisterPlayerUnitEventSimple( gg_trg_Change_to_Dragon_Form, Player(4), EVENT_PLAYER_UNIT_ISSUED_ORDER )
call TriggerRegisterPlayerUnitEventSimple( gg_trg_Change_to_Dragon_Form, Player(5), EVENT_PLAYER_UNIT_ISSUED_ORDER )
call TriggerAddCondition( gg_trg_Change_to_Dragon_Form, Condition( function Trig_Change_to_Dragon_Form_Conditions ) )
call TriggerAddAction( gg_trg_Change_to_Dragon_Form, function Trig_Change_to_Dragon_Form_Actions )
endfunction5th Trigger : (Name : End_Flying) Code:
function Trig_End_Flying_Actions takes nothing returns nothing
call ReplaceUnitBJ( udg_Dragon, 'HC46', bj_UNIT_STATE_METHOD_RELATIVE )
set udg_Dragon = GetLastReplacedUnitBJ()
call DisableTrigger( gg_trg_Store_Spells )
call SetPlayerAbilityAvailableBJ( true, 'AEme', udg_DragonOwner )
call TriggerExecute( gg_trg_Function_Restore_Skills )
call EnableTrigger( gg_trg_Store_Spells )
endfunction
//===========================================================================
function InitTrig_End_Flying takes nothing returns nothing
set gg_trg_End_Flying = CreateTrigger( )
call TriggerRegisterTimerExpireEventBJ( gg_trg_End_Flying, udg_DC )
call TriggerAddAction( gg_trg_End_Flying, function Trig_End_Flying_Actions )
endfunctionYou can test it. I hope you can read custom text, if not you can ask me for more explainations. This said i have a kind of feeling this post is becoming off-topic ^^ Regards |
