• 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.

[Trigger] Skill Level Up Automatically...

Status
Not open for further replies.
Level 20
Joined
Jul 14, 2011
Messages
3,213
I'm making an RPG where skills level up automatically depending on the hero level, but I don't think it's the most efficient way to do it. I'd like to know if it's, or if there's a better way to do it.

  • Increase Skill Level
    • Events
      • Time - Every 1.00 seconds of game time
    • Conditions
    • Actions
      • Unit Group - Pick every unit in (Units of type Believer Believer) and do (Actions)
        • Loop - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • (Level of (Picked unit)) Equal to 10
              • (Level of Entangling Roots for (Picked unit)) Equal to 1
              • (Level of War Stomp for (Picked unit)) Equal to 1
              • (Level of Mirror Image for (Picked unit)) Equal to 1
            • Then - Actions
              • Unit - Increase level of Entangling Roots for (Picked unit)
              • Unit - Increase level of Mirror Image for (Picked unit)
              • Unit - Increase level of War Stomp for (Picked unit)
            • Else - Actions
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • (Level of (Picked unit)) Equal to 15
                  • (Level of Entangling Roots for (Picked unit)) Equal to 2
                  • (Level of War Stomp for (Picked unit)) Equal to 2
                  • (Level of Mirror Image for (Picked unit)) Equal to 2
                • Then - Actions
                  • Unit - Increase level of Entangling Roots for (Picked unit)
                  • Unit - Increase level of Mirror Image for (Picked unit)
                  • Unit - Increase level of War Stomp for (Picked unit)
                • Else - Actions
      • Custom script: set bj_wantDestroyGroup = true
And so on...

The map has about 100 skills, that upgrade every 5 levels starting on lvl 10 (5 <- Level 1->, 10, 15, 20, 25, 30, 35, 40, 45, 50 <- Level 10 ->), and the max hero level is 50.
 
Level 20
Joined
Jul 14, 2011
Messages
3,213
There are several trainers around the map where units can get skills, whenever they want to.

- Using "Hero gains a level" would set the skill level when the unit levels up, not when it learns the skill.
 
Level 16
Joined
Aug 7, 2009
Messages
1,406
  • Untitled Trigger 002
    • Events
      • Unit - A unit Learns a skill
    • Conditions
    • Actions
      • Custom script: call SetUnitAbilityLevel(GetTriggerUnit(),GetLearnedSkill(),GetHeroLevel(GetTriggerUnit())/5+1)
Well, there's no way to retrieve the learned ability in GUI (<3 Blizzard).That little trigger would work tho'.
 
Level 20
Joined
Jul 14, 2011
Messages
3,213
Hehehe, that works when the unit learns the skill, not when levels up xD

I did a little modifications to the one I had and is working now, though I don't know if it could lag later, when tons of skills are added...

Question: 'Unit learns a skill' is activated when 'Unit - Add Ability' is used?

I'm thinking about triggering a Countdown Timer when unit learns a skill or levels up, to avoid creating a group with hundreds of actions and conditions every second.
 
Level 16
Joined
Aug 7, 2009
Messages
1,406
You have to use two triggers, not one. One levels up your abilities when the hero gains a level, and this one set's the level of a fresh learned ability to the correct level.

>Question: 'Unit learns a skill' is activated when 'Unit - Add Ability' is used?
It won't.
 
Level 20
Joined
Jul 14, 2011
Messages
3,213
Thanks :D

But skills are added via "Unit - Add Ability", not Learning Abilities... when hero buys a dummy item (I don't know if there's a better way, maybe training a unit?), the skills is added =/

So... one trigger when the unit buys the item, and one trigger when the hero levels up?
 
Level 33
Joined
Mar 27, 2008
Messages
8,035
Hope you have learn "factor" in your math standards.

It is very incosistent to use a check for every 5 interval values, when you can "factorize" them out by using this:

  • ((Hero level of (Triggering unit)) mod 5) Equal to 0
Integer Comparison - Math Modulo

As this trigger will divide your hero's level and checks if it equal to 0, that means your hero has increased its level to 5 per interval and do the following action


As for the periodic event, it is even more inefficient by using a periodic timer of 1 second

As you can see, if this game is based on RPG, you will play it at about 2 ~ 3 hours, you're gonna need to maintain the game process by not making it lag often

If you check once every 1 second, it will eventually decrease your game performance, making it prone to lag

To replace this, you need to use a single-time Event, like A unit Gains a level.

Together with that action and Factor action, you have yourself a bit more efficient system from the previous.
 
Level 20
Joined
Jul 14, 2011
Messages
3,213
Well, that's something I can say I didn't learn because it was never mentioned in Math class nor translated to English in 18 years of Education...

Also, excuse me if it's dumb for me to say this, but... if Hero lvl is 5, and is divided by 5, shouldn't it be equal to 1?... And if hero is lvl 10, wouldn't it be = 2?...

This is getting really hard... I though it was easier xD Bah... I think i'm going to use the basic Skill System based on Wood, like GoH =/
 
Level 33
Joined
Mar 27, 2008
Messages
8,035
I'm sorry, it's not normal divide, it's Modulo

Here: Modulo Operation

Read the "9 mod 3" at the first paragraph of the page

For instance, the expression "5 mod 4" would evaluate to 1 because 5 divided by 4 leaves a remainder of 1, while "9 mod 3" would evaluate to 0 because the division of 9 by 3 leaves a remainder of 0; there is nothing to subtract from 9 after multiplying 3 times 3. (Notice that doing the division with a calculator won't show you the result referred to here by this operation, the quotient will be expressed as a decimal.)

Modulo is finding the "remainder" rather than "the values of the divided numbers"
 
Level 20
Joined
Jul 14, 2011
Messages
3,213
Great! I understood none of it! That's why I study psychology and not maths nor anything related to, lol at me xD

EDIT: After reading repeatedly I understood some of it, but have no clue on how to use it in the system =).

I though about his, and changing the price to 1 Lumber, and give lumber with levels, and restore the lumber if the unit removes the skill via chat.

  • Devotion Aura
    • Events
      • Unit - A unit Acquires an item
    • Conditions
      • (Item-type of (Item being manipulated)) Equal to Entangling Roots
      • ((Triggering unit) is A Hero) Equal to True
    • Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Level of Entangling Roots for (Triggering unit)) Equal to 0
        • Then - Actions
          • Unit - Add Entangling Roots to (Triggering unit)
        • Else - Actions
          • Unit - Increase level of Entangling Roots for (Triggering unit)
I though about having level restriction, but... it's up to the user to have a skill and no mana to use it :)

I would just have to make a trigger for each skill.
 
Level 20
Joined
Jul 14, 2011
Messages
3,213
Damn... why do you have to make everything so efficient and complicated? xD hahaha, Ultra-mega lol.

It looks awesome, but there are some things I don't understand :p anyway, I have stat requirements and Interger Array requirements to learn skills...

I made a new thread to improve that poor-quality system made by me :p (Different than this one, since the subject is different)... You could help me adding mixing your 'Simple Looping Level Up System' and the one I made in the other thread with stat requirements and else.

This is the link: http://www.hiveworkshop.com/forums/triggers-scripts-269/skill-level-up-item-buy-203833/
 
Status
Not open for further replies.
Top