• 🏆 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!
  • It's time for the first HD Modeling Contest of 2024. Join the theme discussion for Hive's HD Modeling Contest #6! Click here to post your idea!

Need to add ability

Status
Not open for further replies.
Level 12
Joined
Apr 16, 2010
Messages
584
So my problem is that i create a hero, same as main hero that is used in map, like illusion, and i need to order created hero to learn skills that main hero has. I don't want to use actions like Hero - Learn skill for (Triggering unit): Human Archmage - Blizzard because i don't need to specify an ability, in this example: Human Archmage - Blizzard. I want to add ability that main hero has, like same thing with items:
  • Do Multiple ActionsFor each (Integer A) from 1 to 6, do (Actions)
    • Loop - Actions
      • Hero - Create (Item-type of (Item carried by Game_Hero[(Player number of (Triggering player))] in slot (Integer A))) and give it to AS_Dummy[(Player number of (Triggering player))]
I'm using JNGP, so i guess this will be easier to make, i think it can be done in JASS, so i think there's a way to add ability through this action: Unit - Add (JASS Code) to AS_Dummy[(Player number of (Triggering player))]
In field JASS Code is there a way to type some code that will add ability?
I hope you understood what i've been trying to say. Any help is appreciated!
 
Level 2
Joined
Dec 16, 2010
Messages
26
that program is banned by blizzard. (they dont condone the use of third party programs.) you will need to write in jass code in the trigger editor or just use the trigger editor. i dont quite understand what you are trying to do. please explain.

Im not attacking you in Any way At All but even if it is against rules blizz couldn't say much, besides the hosting bots are a bigge problem. But I agree GUI triggers would be better
 
Level 14
Joined
Nov 18, 2007
Messages
1,084
I'm guessing that you want this to work for different heroes which is why you said you don't want specific abilities to be learned, right?

You could use a hashtable to store the different abilities a hero can learn. By hero, I'm talking about the unit-type.
Ex:
  • HeroAbilityInfo
    • Events
      • Map initialization
    • Conditions
    • Actions
      • Hashtable - Create a hashtable
      • Set HeroAbility = (Last created hashtable)
      • -------- 'H000' refers to the raw id of a hero. --------
      • -------- The numbers (0-3) are to store the ability in a different place. (They'll also be used for looping when you learn the skills for the illusion.) --------
      • -------- 'A000' is an ability that a hero has. --------
      • Custom script: call SaveInteger(udg_HeroAbility, 'H000', 0, 'A000')
      • Custom script: call SaveInteger(udg_HeroAbility, 'H000', 1, 'A001')
      • Custom script: call SaveInteger(udg_HeroAbility, 'H000', 2, 'A002')
      • Custom script: call SaveInteger(udg_HeroAbility, 'H000', 3, 'A003')
      • -------- Another hero: --------
      • Custom script: call SaveInteger(udg_HeroAbility, 'H001', 0, 'A004')
      • -------- And so on... --------
To copy the abilities and learn them correctly, it would just be a matter of loading the ability via loop.
It would be easier to do this in Jass because it treats ability-ids and unit-types as integers.
JASS:
        local unit mainHero // Your main hero
        local integer unitType = GetUnitTypeId(mainHero) // The unit-type of the main hero.
        local unit illusionHero  // Your illusion unit
        local integer i = 0 // Used for looping.    
        local integer spellID
        local integer lvl 
        loop
            set spellID = LoadInteger(udg_HeroAbility,unitType,i) // Load the spell id from the hashtable
            set lvl = GetUnitAbilityLevel(mainHero,spellID) // Get the level of the ability for the hero.
            if lvl > 0 then
                call SelectHeroSkill(illusionHero,spellID)
                call SetUnitAbilityLevel(illusionHero,spellID,lvl)
            endif
            set i = i + 1
            exitwhen i == 4 // 4 represents the total amount of hero abilities main could have. 
        endloop
        call UnitModifySkillPoints(illusionHero, GetHeroSkillPoints(mainHero)-GetHeroSkillPoints(illusionHero)) // This needs to be done since the illusion will learn skills differently.
        set mainHero = null
        set illusionHero = null
 
Level 21
Joined
Mar 2, 2010
Messages
3,069
blizzard told me personally that they dont condone the use of third party programs. they even threatened with punishing me just for suggestion the use of vjass. if i posted the contents of the email here i would most likely have been assassinated. i am willing to help without the use of vjass though.
 
Status
Not open for further replies.
Top