• 🏆 Texturing Contest #33 is OPEN! Contestants must re-texture a SD unit model found in-game (Warcraft 3 Classic), recreating the unit into a peaceful NPC version. 🔗Click here to enter!

[Solved] Metamorphosis problem

Status
Not open for further replies.
Level 6
Joined
Jun 1, 2014
Messages
165
A'ight guys, in the map i am making, i ran into a problem, which made me nervous so imma just ask fo' how to solve it. Which is:
A Hero - the Demon Hunter hits Level 55, receives an additional ability through trigger. BUT, once he transforms into his Demon Form, the ability is gone. He goes back to his normal form, the ability is there. And from the other side, IF the Demon Hunter is in Demon Form WHILE he levels up, reaches Level 55, he gets the ability in his Demon Form, but once he goes back to normal, he doesn't has it in his normal form.

Suggestions? Make the ability permanent somehow? And how? Via custorm script code (JASS)? If so, mind showing me the WHOLE code, so i can... you know... just copy-paste it :D
 
Level 15
Joined
Mar 25, 2016
Messages
1,327
I know there is a JASS function and I think it does exactly what you want, but I don't know for sure, because I never used it.
call UnitMakeAbilityPermanent(<WhichUnit>, true, <WhichAbility>)
<WhichUnit> is the unit. Something like udg_DemonHunter, if the variable is DemonHunter
You can also use GetTriggerUnit(), if you want the triggering unit.
<WhichAbility> is the ability. You can use raw codes. For example 'A000' or 'Adef'

Then you can copy this line into custom script.
 
Level 6
Joined
Jun 1, 2014
Messages
165
Damn, i am so tired, i can't fathom what i am reading.
'' call UnitMakeAbilityPermanent(<WhichUnit>, true, <WhichAbility>) ''
Just where do i put that? In WhichUnit goes the variable? I have a variable, for the unit the Demon Hunter transforms into - Demon Form.
'A000' goes for, and 'Adef' goes for? Does it matters which one?
''Then you can copy this line into custom script.'' - Ya mean, once i have the line done, just copy it all into the custom script, right?

Edited: Think i fathomed it...
 
Level 15
Joined
Mar 25, 2016
Messages
1,327
First you need to know which unit you want to add the ability and which ability you want to add.
If you want a specific ability from the object editor, you can use its raw code. Defend has raw code 'Adef' for example.
Press Ctrl + D to view raw codes of objects in the object editor.

If you have a unit variable, you can use this.
Let's say you have DemonHunter as unit variable and want to add Defend, then your code looks like this:
call UnitMakeAbilityPermanent(udg_DemonHunter, true, 'Adef')
You put it in a custom script directly below the action "Unit add ability".
 
Level 6
Joined
Jun 1, 2014
Messages
165
Like this?

But, in that ' DemonHunter ' that is my variable, where the Demon Hunter's Demon Form is stored - his Metamorphosis form. Should i change something here?

Edit: Drank some water, and started to THINK! Now, the original form of the Demon Hunter, has a raw code of 'Edem'.
And the form he transforms into - 'E00M'
So which one i put into the variable/custom script code?
 

Attachments

  • 20883993_1551685201556059_1962022739_o.png
    20883993_1551685201556059_1962022739_o.png
    9.1 KB · Views: 23
Last edited:
Level 15
Joined
Mar 25, 2016
Messages
1,327
The Demon Hunter variable you have here is a different one. If you have a variable in the variable editor with the name DemonHunter, you can use udg_DemonHunter to refer to it in JASS or custom script. Your variable is the variable of a preplaced unit, which means that you would have to use something like gg_unit_Edem_0019 to refer to it.
It's easier, if you use:
  • Actions
    • Set DemonHunter = Demon Hunter 0000 <gen>
    • Custom script: ....
Then you can use udg_DemonHunter in the custom script, so you need a unit variable in the variable editor.

For the ability raw code:
If you want to add sleep, 'ACsl' is correct. If you made a custom ability based on that sleep, you would need something like 'A000' (the 4 characters before the ACsl).

Please do not double post, it's against the site rules. Use the edit button instead.
 
Level 6
Joined
Jun 1, 2014
Messages
165
I renamed my variable, now it's called DemonForm, there is stored the Demon Form of the Demon Hunter - the unit he becomes once he transforms. But i mean, the type of the unit - unit-type. It's a unit-type variable.
That what you just showed me, in the pic, its impossible to be done with my WE i guess? Because i cannot store any existing (already placed on the map) unit, in tha variable. And by that, do you mean Demon Form = Demon Hunter (normal form) ?
The Mental Prison ability, looks like custom, but it is not, it is a modified sleep ability, so i did not MADE a new custom one.
 
Level 15
Joined
Mar 25, 2016
Messages
1,327
You need a unit variable not unit type.
Create a unit variable in the variable editor. In my case it is DemonHunterUnit.
  • Set DemonHunterUnit = Demon Hunter 0019 <gen>
  • Unit - Add Sleep (Neutral Hostile) to DemonHunterUnit
  • Custom script: call UnitMakeAbilityPermanent(udg_DemonHunterUnit, true, 'ACls')
You don't need the unit type varaible, because you don't add the ability to a unit type, but to a specific unit, namely Demon Hunter 0019 <gen>.
To make the custom script easier, you set DemonHunterUnit to Demon Hunter 0019 <gen>, because it's easier to use DemonHunterUnit in custom scripts.
 
Level 6
Joined
Jun 1, 2014
Messages
165
Good, so far, but i need to make another triggers, for when the Demon Hunter in his Demon Form, reaches lvl 55, to have it in his base form, once he reverts back into it. Because right now, i think, once he levels 55, he will have that very same ability in his Demon Form, but, not the other way around.
 
Level 15
Joined
Mar 25, 2016
Messages
1,327
It's really not that hard and it works in both ways. Check out that map to see how it works.
Keep in mind that a unit variable refers to both versions (normal and morphed), because it's still the same unit (same buffs, items, etc.). Only the unit type changes when you morph it, but it remains the same unit. In this case you do nothing with the unit type only with the unit.
 

Attachments

  • DemonHunterMorph.w3x
    17.5 KB · Views: 34
Level 6
Joined
Jun 1, 2014
Messages
165
Testing, imma reply soon. Rep. points incoming :)

After testing: Duudee! it worked! So, he became lvl 55 in his normal form, got the ability, then he transformed, the ability was there, once he reverted back, it is still there. Then i tried to see, if he reaches lvl 55 while transformed, yes, he did get the ability, and it did stayed, when he reverted back!
Reputation given :) Thanks! You teach me something today :)
 
Status
Not open for further replies.
Top