HomeUser Control Panel (unavailable in archive)ForumsTutorialsArt GalleryResourcesMaps

Restoring Learned Abilities With Gamecache

04-23-2006, 09:57 PM#1
Arkidas
As you can see below the trigger is only half the way completed.
I am coding an ability there, It's an ability which I use to speciate the Turtle King ( Gargantuan Sea Turtle ) to a Dragon Turtle. The unit is exactly the same expect for the model and icon is changed, It has the same abilities and eveyrthing. What I am trying to do it make all learned abilities and their levels to load up when the unit is replaced, It's kinda messy if the player has to choose all the abilities again plus that the player would have to learn the ability which runs the trigger again = endless loop.
I do have the CS gamecache engine implemented in my map but I don't have a good knowledge of JASS so I don't know how to use it.
Can someone help me to do this whether it's with GUI or JASS?

Thank you in advance!


GUI:
Trigger:
Speciate
Collapse Events
Unit - A unit Learns a skill
Collapse Conditions
(Learned Hero Skill) Equal to Speciate
Collapse Actions
Collapse If (All Conditions are True) then do (Then Actions) else do (Else Actions)
Collapse If - Conditions
(Real((Level of Speciate for (Learning Hero)))) Equal to 1.00
Collapse Then - Actions
Special Effect - Create a special effect attached to the origin of (Learning Hero) using Abilities\Spells\Other\ImmolationRed\ImmolationREDTarget.mdl
Special Effect - Destroy (Last created special effect)
Unit - Replace (Learning Hero) with a Turtle King Rank I - Dragon Turtle Form using The old unit's relative life and mana
Selection - Select (Learning Hero) for (Owner of (Learning Hero))
Else - Actions


JASS:
Collapse JASS:
function Trig_Speciate_Conditions takes nothing returns boolean
    if ( not ( GetLearnedSkillBJ() == 'A000' ) ) then
        return false
    endif
    return true
endfunction

function Trig_Speciate_Func002C takes nothing returns boolean
    if ( not ( I2R(GetUnitAbilityLevelSwapped('A000', GetLearningUnit())) == 1.00 ) ) then
        return false
    endif
    return true
endfunction

function Trig_Speciate_Actions takes nothing returns nothing
    if ( Trig_Speciate_Func002C() ) then
        call AddSpecialEffectTargetUnitBJ( "origin", GetLearningUnit(), "Abilities\\Spells\\Other\\ImmolationRed\\ImmolationREDTarget.mdl" )
        call DestroyEffectBJ( GetLastCreatedEffectBJ() )
        call ReplaceUnitBJ( GetLearningUnit(), 'H001', bj_UNIT_STATE_METHOD_RELATIVE )
        call SelectUnitForPlayerSingle( GetLearningUnit(), GetOwningPlayer(GetLearningUnit()) )
    else
    endif
endfunction

//===========================================================================
function InitTrig_Speciate takes nothing returns nothing
    set gg_trg_Speciate = CreateTrigger(  )
    call TriggerRegisterAnyUnitEventBJ( gg_trg_Speciate, EVENT_PLAYER_HERO_SKILL )
    call TriggerAddCondition( gg_trg_Speciate, Condition( function Trig_Speciate_Conditions ) )
    call TriggerAddAction( gg_trg_Speciate, function Trig_Speciate_Actions )
endfunction

04-23-2006, 10:19 PM#2
Anitarf
Just use a chaos-based ability to morph your turtle, and it will keep it's skills.
04-23-2006, 10:20 PM#3
vile
Okay this is what you do
Before you create the unit, check each ability's level, and store it in a variable. You dont have to use game cache for this.
After checking each ability's level just do
Collapse JASS:
    call SelectHeroSkill( unit, AbilityRawCode )
this causes the unit to select the skill
of course if ability level == 0 then dont use that.

Then just use IncUnitAbilityLevel for each level of the skill.
04-23-2006, 10:25 PM#4
Arkidas
It's better to use local variables for this right?
04-23-2006, 10:29 PM#5
Anitarf
Or, just use the Chaos morphing ability.
04-23-2006, 10:39 PM#6
Arkidas
Quote:
Originally Posted by Anitarf
Or, just use the Chaos morphing ability.
Sorry but your refeering to what?
04-23-2006, 10:45 PM#7
Anitarf
The ability used to morph orcs to chaos orcs in the orc campaign. You just add the ability (it's a passive ability that doesn't show an icon) to a unit and it morphs to it's alternate form. Heroes keep their stats and skills when morphing this way. More info can be found in the Warcraft Ability Guide.
04-23-2006, 11:02 PM#8
Arkidas
Well this doesn't seem to work just as it should. When I change it to a hero ability and give it 2 levels it just doesn't function right.
It seems to have like 20 levels but it always says level 1 wen the hero is learning it and it enhances the hero's damage each time it's chosen. It also removes one ability from the hero. Is there a bug with this?
04-23-2006, 11:16 PM#9
Earth-Fury
Quote:
Originally Posted by Arkidas
Well this doesn't seem to work just as it should. When I change it to a hero ability and give it 2 levels it just doesn't function right.
It seems to have like 20 levels but it always says level 1 wen the hero is learning it and it enhances the hero's damage each time it's chosen. It also removes one ability from the hero. Is there a bug with this?

did you add a '0' after the 2?

and, did you edit the tooltips? (tooltips must be edited for EVERY level of a spell)
04-23-2006, 11:19 PM#10
Arkidas
Well yeah everything was right but I founda way around this. Thanks.