HomeUser Control Panel (unavailable in archive)ForumsTutorialsArt GalleryResourcesMaps

shape shifting (keep skills)

07-10-2004, 09:17 AM#1
dragnstitch
Ok what i did was make 2 Thieves
one with Range one with melee

So when the player wants he cna switch to bow or dagger and he gets differnt skills depending what weapon is currently in use.. i have it so it switches perfectly using berserk as dummy spell.. but here is my problem.. the player has to reselect his skills each time they switch.. and that is going to get annoying.. anyone able to help?
07-10-2004, 09:21 AM#2
Anitarf
Whenever a player learns a skill, store the level of that skill into a variable. Then, when the player morphs, check the variables to see which skills he has already learned in the other mode, and learn them for him by the trigger.
07-10-2004, 09:26 AM#3
dragnstitch
yea but i have 5 chars so it would be 10 variables.. hmm wouldnt that cause a lag?
07-10-2004, 09:33 AM#4
Anitarf
You mean you have 5 players? If each thief has 4 abilities in each form, then you need 8 variables: for each ability, you have an integer array that stores the level of that ability for each player.

Don't worry, 8 variables is nothing. Games start to lag when there are hundreds of units marching around, that sort of stuff, not when you need some bytes of memory to store 40 (8 abilities * 5 players) integers.
07-10-2004, 08:56 PM#5
dragnstitch
ahh ok just checking.. thanks
07-10-2004, 09:01 PM#6
Vexorian
Use Chaos the ability to replace the types, and make the two unit types have the same hero abilities
07-10-2004, 09:07 PM#7
dragnstitch
Chaos ability automaticly uses it though.. what will i do put it as a trigger?
07-10-2004, 09:11 PM#8
Vexorian
hmnn it is easier than that then, just use a skill like the Druid of the claw 's bear form to replace the types, and name that spell use bow, and turn off should be use sword
07-10-2004, 09:18 PM#9
dragnstitch
what its doing when i use that is keeping the same skills.. when thief using dagger and thief using sword are 2 differnt skill chars.. and also it keeps the damage and all the same =/
07-10-2004, 09:26 PM#10
Vexorian
Ahh you want them to have different skills ? ouch then forget about that, the only solution would be to hide unit a , make unit b appear, then when it is off unhide unit a but give same hero level as unit b, then hide unit b
07-10-2004, 09:28 PM#11
dragnstitch
hmmm... so far i just did this

Code:
Use Bow
    Events
        Unit - A unit Finishes casting an ability
    Conditions
        (Unit-type of (Casting unit)) Equal to Thief (Dagger)
        (Ability being cast) Equal to Use Bow 
    Actions
        Unit - Replace (Casting unit) with a Thief using The old unit's life and mana
        Hero - Set (Last replaced unit) experience to (Hero experience of (Casting unit)), Hide level-up graphics
        Selection - Select (Last replaced unit) for (Owner of (Last replaced unit))

im going to try that variable thing.. i dont wanna hide the units unless i really need to =P
07-10-2004, 09:33 PM#12
Vexorian
don't use replace, it removes the unit then creates a new one, just hide the first unit and save it in a variable to unhide it later,
07-10-2004, 09:41 PM#13
dragnstitch
as im getting it i would have to make differnt trigger per player wouldnt i?
07-11-2004, 01:29 PM#14
Anitarf
Nope, just use arrays. Here's an example:

Code:
A unit starts the effect of an ability

Ability being cast equal to (use bow)
or
Ability being cast equal to (use dagger)

set tempPointVariable = position of unit (casting unit)
hide (casting unit)
move(instantly) (casting unit) to random point in region (Ye edge of the Mappe - gen)
move(instantly) hiddenUnitVariableArray(player number of(owner of unit (casting unit))) to tempPointVariable
unhide hiddenUnitVariableArray(player number of(owner of unit (casting unit)))
set experience of hiddenUnitVariableArray(player number of(owner of unit (casting unit))) to (experience of (casting unit)) (this is optional, you can keep the old experience, so a thief can become level 5 with a dagger but still be unskilled with a bow)
set life of hiddenUnitVariableArray(player number of(owner of unit (casting unit))) to percentage (percentage life of (casting unit))
set mana of hiddenUnitVariableArray(player number of(owner of unit (casting unit))) to percentage (percentage mana of (casting unit))
set hiddenUnitVariableArray(player number of(owner of unit (casting unit))) = (casting unit)
This way, you don't even need seperate triggers for the two modes. No matter which of the two spells is cast, the trigger will automatically replace the whatever thief is casting it with it's alternate version, and after the replacement, set the replaced unit as the alternate version so the next time the player wishes to swap the heroes, it will swap back to this hero.

The alternate versions are kept in a region at the edge of the map, altrough I'm not sure that is really necessary, because they are hidden anyway, but i'm not sure if hidden units may still have some unwanted effects on pathing or experience sharing, so I move them there just in case.

Oh, and if you want to avoid the memory leaks from point objects, put this at the end of the trigger:
Code:
custom script:  call RemoveLocation ( udg_tempPointvariable)
And also, instead of referencing a random point in region (when you move the casting unit to the edge of the map), set that point to a variable at map initialization and use that variable instead of (random point in region).

Note that this way, you can only have one thief per player at a time (you probably didn't mean to have more anyway)
07-14-2004, 03:25 PM#15
dragnstitch
yea i know i havent been around.. internet crapped out.. i pretty much did whaty ou typed anitar but i decided i wanted it another way.. Differnt skills, Differnt Levels.. so that if you train in Bow your not a master in Dagger.. only problem im having now is the HP.. it takes the switches hp down like 40 %..

Code:
Use Bow
    Events
        Unit - A unit Finishes casting an ability
    Conditions
        (Unit-type of (Casting unit)) Equal to Thief (Dagger)
        (Ability being cast) Equal to Use Bow 
    Actions
        Hero - Disable experience gain for ThiefDR
        Hero - Enable experience gain for ThiefBR
        Unit - Set life of ThiefBR to (Life of ThiefDR)
        Unit - Set life of ThiefBR to (Mana of ThiefDR)
        Unit - Hide (Casting unit)
        Unit - Unhide ThiefBR
        Unit - Move ThiefBR instantly to (Position of (Casting unit))
        Unit - Move ThiefDR instantly to (Center of Thief standing <gen>)
        Trigger - Run ItemB1 <gen> (ignoring conditions)
        Selection - Select ThiefBR for (Owner of ThiefBR)

and this is the trigger for items
Code:
ItemB1
    Events
    Conditions
    Actions
        Hero - Give (Item carried by ThiefDR in slot 1) to ThiefBR
        Hero - Give (Item carried by ThiefDR in slot 2) to ThiefBR
        Hero - Give (Item carried by ThiefDR in slot 3) to ThiefBR
        Hero - Give (Item carried by ThiefDR in slot 4) to ThiefBR
        Hero - Give (Item carried by ThiefDR in slot 5) to ThiefBR
        Hero - Give (Item carried by ThiefDR in slot 6) to ThiefBR