Perfect hero cloning?

Rllulium

New Member
Reaction score
10
Tonight I sat around trying to create a spell that would create a perfect clone of any target hero, for a set duration of time. After a long time of banging my head against the wall, I've come up with the conclusion that the best I can do is cloning the unit with Game Cache, but that includes the problem that the clone is spawned with it's skill points undistributed. Since my map contains 10+ something heroes already (a rapidly growing number) I find it a bit too complex to do a huge number of If functions to check what hero is being targeted, add the correct skills and level them properly.

Is there no better way to perform a perfect cloning? Or a better way to transfer the Ability levels?
 

Joccaren

You can change this now in User CP.
Reaction score
54
Set the levels of the spells in integer variables then set the level of the spells for the new unit to those variables?
 

Flamesword

New Member
Reaction score
0
What I'm doing for my map (although, I havn't actually gotten to the point of testing this particular feature) is to create a hero of the type you want and add each aspect with a different action in the same trigger.
Modify strength/agility/inteligence of (last created unit), set to (triggering unit).
Set (last created unit) experience to (experience of (triggering unit))
Create (item carried by (triggering unit) in slot 1/2/3/4/5/6) and give it to (last created unit).
And so on and so forth. Even with abilities.
 

jomik

New Member
Reaction score
17
@Flamesword; How are you going to get what abilities the targeted unit has? :O
 

Rllulium

New Member
Reaction score
10
Set the levels of the spells in integer variables then set the level of the spells for the new unit to those variables?
I don't think you understand. I already do this.
@Flamesword; How are you going to get what abilities the targeted unit has? :O

Exactly my issue. Setting ability levels isn't hard, getting the abilites is where the problem is at.
 

jomik

New Member
Reaction score
17
I think you'd have to do the if statements for all your abilities :O Could be pretty easy in JASS if the abilities's ID was like A000, A001, A002, .... A00N. Cuz you could just check if the unit had A000 + i where i is the current loop number, and then exit loop when i > than the max number of abilities.
But would require JASS :O And would require you to make sure all abilities are custom, so they can have a value like A00N, and make them in NewGen so you can decide the ID, I'm not sure if they're set like that by default in the normal editor.
 

Joccaren

You can change this now in User CP.
Reaction score
54
Or set it in integer called 'Spell 1' ect. Instead of 'Death Coil level'. That would reduce the amount of variables you use by at least 40-100 (Depending on how many heroes you have)
 

Rllulium

New Member
Reaction score
10
I think you'd have to do the if statements for all your abilities :O Could be pretty easy in JASS if the abilities's ID was like A000, A001, A002, .... A00N. Cuz you could just check if the unit had A000 + i where i is the current loop number, and then exit loop when i > than the max number of abilities.
But would require JASS :O And would require you to make sure all abilities are custom, so they can have a value like A00N, and make them in NewGen so you can decide the ID, I'm not sure if they're set like that by default in the normal editor.

I see what you mean. It is however only an easier way of writing the code, the work I'd have to put into naming abilities, just to make this one spell for one hero, is overwhelming.
Or set it in integer called 'Spell 1' ect. Instead of 'Death Coil level'. That would reduce the amount of variables you use by at least 40-100 (Depending on how many heroes you have)
I did not use one variable for every ability in the test function I did. I used:
Trigger:
  • Then - Actions
    • Unit - Add Ability to Clone
    • Unit - Set level of Ability for Clone to (Level of Ability for TargetHero)

repeated for all the abilities. With "Ability" replaced with the proper name of the Ability of course.
 

Duwenbasden

Ver 6 CREATE energy AS SELECT * FROM u.energy
Reaction score
165
Game cache works for me son:

Trigger:
  • Untitled Trigger 001
    • Events
      • Unit - A unit Begins casting an ability
    • Conditions
      • ((Target unit of ability being cast) is A Hero) Equal to True
      • (Ability being cast) Equal to Banish
    • Actions
      • Set test = (Target unit of ability being cast)
      • Game Cache - Create a game cache from MapName.w3v
      • Game Cache - Store (Target unit of ability being cast) as test of Category in (Last created game cache)
      • Game Cache - Store (Casting unit) as test2 of Category in (Last created game cache)
      • Unit - Remove (Casting unit) from the game
      • Game Cache - Restore test of Category from (Last created game cache) for Player 1 (Red) at (Position of (Casting unit)) facing 0.00
      • Wait 7.00 seconds
      • Unit - Remove (Last restored unit) from the game
      • Game Cache - Restore test2 of Category from (Last created game cache) for Player 1 (Red) at (Position of (Last restored unit)) facing 0.00


test = the target
test2 = the original hero

The abilities are being mapped correctly, and Player 1 is casting on enemy units.
The problem is the health and mana -- always full when transformed.
 

Rllulium

New Member
Reaction score
10
Game cache works for me son:

TRIGGER

test = the target
test2 = the original hero

The abilities are being mapped correctly, and Player 1 is casting on enemy units.
The problem is the health and mana -- always full when transformed.

This trigger is for "transforming" into enemy heros?
In any case, you are saying that your abilities are always properly mapped when the unit is restored? Because health/mana is very manageable since my ability is about creating a clone, not pseudotransformation.

EDIT: I'll be damned. I just changed my trigger to a very simple iteration of the original spell.
Trigger:
  • Trigger Name
    • Events
      • Unit - A unit Starts the effect of an ability
    • Conditions
      • (Ability being cast) Equal to Clone
    • Actions
      • Game Cache - Store (Target unit of ability being cast) as CloneTarget of Clone in GameCache
      • Game Cache - Restore CloneTarget of Clone from GameCache for Player 1 (Red) at (Position of (Casting unit)) facing Default building facing
      • Game Cache - Clear all labels of Clone in GameCache

And now the abilities are properly distributed.
Problem solved, but what is causing them not to be?

Thanks for the input Duwenbasden!

EDIT2: I just rewrote my original trigger, step by step, to almost exact same state as the old trigger. The only difference is that I now use a fixed point variable instead of a polar offset. It still properly transfers abilities. I frankly doubt that it would make such a diffference. Sigh... :banghead: I shouldn't trigger at night. Thanks for your time folks.
 

Joccaren

You can change this now in User CP.
Reaction score
54
When saving a hero in a game cache, it stores everything except for HP and mana. It stores Items, spells, experience, levels, just no hp or mana. To save hp or mana, you will need to save real variables set to the HP or mana.
 

Rllulium

New Member
Reaction score
10
When saving a hero in a game cache, it stores everything except for HP and mana. It stores Items, spells, experience, levels, just no hp or mana. To save hp or mana, you will need to save real variables set to the HP or mana.

Yeah, I figured. It doesn't store debuffs either AFAIK.
 
General chit-chat
Help Users
  • No one is chatting at the moment.

      The Helper Discord

      Staff online

      Members online

      Affiliates

      Hive Workshop NUON Dome World Editor Tutorials

      Network Sponsors

      Apex Steel Pipe - Buys and sells Steel Pipe.
      Top