• Listen to a special audio message from Bill Roper to the Hive Workshop community (Bill is a former Vice President of Blizzard Entertainment, Producer, Designer, Musician, Voice Actor) 🔗Click here to hear his message!
  • Read Evilhog's interview with Gregory Alper, the original composer of the music for WarCraft: Orcs & Humans 🔗Click here to read the full interview.

Clone Unit Item

Status
Not open for further replies.
I want help with a charge item, when I use it, I will get a target, and use it on a Hero. When I had, he will look like his target, but his stats and hp remains. If it is to hard, so change it to your target to 100%. After, maybe 5 minutes, the effects wears out, and he will have the stats and hp he get before.

I would be very greatful for helping!
 
Level 5
Joined
Jul 24, 2007
Messages
199
I believe he means that the caster starts looking like the target. Such conspiration. I think we need to replace one unit with another triggerly (there's a BJ function for this, but it sucks a bit, maybe we need to rewrite it). And, huh, keeping hp and stats is the easiest thing to do.
 
Level 5
Joined
Jul 24, 2007
Messages
199
This needs knowledge of your map and what you use in other triggers. If you have a variable pointing to that Hero, you need to re-direct it after replacement. I can write it in JASS (only simple JASS, I don't use NewGen, if you know what is it ;) ). Let udg_Heroes be an array of Heroes on the map (in editor you type 'Heroes' as var name, udg stands for user-defined globals), and one of them uses such artifact, and global integer udg_NumberOfHeroes (also simply NumberOfHeroes) displays the maximal possible quantity of Heroes in the array (can be larger than really used). If you don't use such variables, just create unit array Heroes and integer var NumberOfHeroes with start value 0. Here's what you need.

View attachment 35561
View attachment 35562

Text1.txt should be copied to the pre-script (in trigger editor, click the uppest line in the left window, it must contain the name of the map, and then, in the lower-right window, you have place for the pre-script. Insert this here.) Text2.txt is the text of the trigger named ItemConspirationActivated (you have to create such trigger, convert it to text through the Edit menu and replace all its text with my code in text2.txt).

But, that's not all. Create a dummy item type which would never be used, and replace 'I000' in text1.txt with its ID (lines 50 and 56, or just Ctrl+H in Notepad). It would be really 'I000' if this dummy item is the first non-standard item on the map. In text2.txt, instead of 'AIil' (line 2) use the ID of ability which creates illusions (in object editor, press Ctrl+D to see IDs instead of names). Replace 'will' (line 8) with item ID of the item that gives the ability (damn the instant cast, wc3 hasn't enough time to spend a charge of the item). And, also in text2.txt, where it is TriggerSleepAction(5.00), replace 5.00 with the time the spell works (in seconds).

Huh. Must work. But, if your Hero has additional abilities added through triggers, you need to add them again when it is cast.

P. S. Must work even if you cast the ability next time while being affected with previous cast. Rep me please if it works.

P. P. S. If you need anything else to be jassed, ask me.
 
Last edited:
Status
Not open for further replies.
Top