• 🏆 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!
  • 🏆 Hive's 6th HD Modeling Contest: Mechanical is now open! Design and model a mechanical creature, mechanized animal, a futuristic robotic being, or anything else your imagination can tinker with! 📅 Submissions close on June 30, 2024. Don't miss this opportunity to let your creativity shine! Enter now and show us your mechanical masterpiece! 🔗 Click here to enter!

Give spellbook to unit after research (help)

Status
Not open for further replies.
Level 4
Joined
Feb 13, 2015
Messages
60
Hi, i have been trying to give my hero a spellbook that is not relly going to be there and give him a passive of 5 armor. Some heros might have the same.

If someone sees this please help, thanks.

:vw_wtf:
 
Last edited:
Level 25
Joined
Sep 26, 2009
Messages
2,390
If all you want is to add armor to the unit (no need to see buff like with Devotion Aura, etc.), you can use the Item ability which adds armor (check the rings of protection to see which spell they use). That ability does not show in game, but it still adds the armor.
 
Level 4
Joined
Feb 13, 2015
Messages
60
Yha, that is better then what i fought off (spiked carapace). But the problem is giving it to the hero after he finishes a special research.
 
Level 25
Joined
Sep 26, 2009
Messages
2,390
You could try to add the ability to hero in Object Editor and make the research a requirement for the ability itself (Check for example Inner Fire ability which Priest units use - it requires level 2 of a research to be usable).
 
Level 25
Joined
Sep 26, 2009
Messages
2,390
Well, you could make two triggers then:
1st fires when research is finished. Pick every unit of player (that researched it) into unit group and add to each picked unit the ability.
2nd fires whenever a unit enters region (playable map area). If the unit type of triggering unit == the desired unit type and research has been finished and level of the armor spell for that unit == 0, add the armor ability to that unit.
 
Level 4
Joined
Feb 13, 2015
Messages
60
Im sry but im new to triggers and instead of med asking hudnreds of questions, could you show exempel with a picture or text lined up? And maybe i only need ten questions. :p
 
Level 25
Joined
Sep 26, 2009
Messages
2,390
  • Research Finished
    • Events
      • Unit - A unit Finishes research
    • Conditions
      • (Researched tech-type) Equal to Your_Research
    • Actions
      • Custom script: set bj_wantDestroyGroup = true
      • Unit Group - Pick every unit in (Units owned by (Triggering Player)) and do (Actions)
        • Loop - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • (Unit-type of (Picked unit)) Equal to Footman
              • ((Picked unit) is alive) Equal to True
            • Then - Actions
              • Unit - Add Armor (+1) to (Picked unit)
            • Else - Actions
What the above does is that when any unit (most likely structure) finishes researching the Your_Research tech, you pick all units of that player and checks if they're alive and they're Footman (= your desired unit type, you can add more unit types if you want) and gives them the Armor(+1) ability.
The custom script is needed to prevent memory leak. All you really need to do is use the action "Custom script" found under general tab in Actions menu and write exactly what I wrote there.

Second trigger looks like this:
  • New Unit
    • Events
      • Unit - A unit enters (Playable map area)
    • Conditions
      • (Current research level of Your_Research for (Owner of (Triggering unit))) Equal to 1
      • Or - Any (Conditions) are true
        • Conditions
          • (Unit-type of (Triggering unit)) Equal to Footman
    • Actions
      • Unit - Add Armor (+1) to (Triggering unit)
What this does is that whenever a unit enters playable map area (= when it is created), it will start this trigger. This trigger checks if the owner of that unit has researched the Your_Research tech and if yes, it adds the Armor(+1) ability to the newly created unit.
 
Level 4
Joined
Feb 13, 2015
Messages
60
Sry, was away, but now im back. :)

Thanks alot, for taking up your time, just one thing. "(Current research level of Your_Research for (Owner of (Triggering unit))) Equal to 1", how do i get this part?
 
Status
Not open for further replies.
Top