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

Autoskill Learn

Status
Not open for further replies.
Level 10
Joined
Mar 17, 2012
Messages
582
Hi there! I have a problem: In my map hero pave to gain some stats and skills every 5 levels till 15 level.
here is the code:
  • Demon lvlup
    • Events
      • Unit - A unit Gains a level
    • Conditions
      • (Unit-type of (Triggering unit)) Equal to Demon Fighter
    • Actions
      • -------- SKILLS --------
        • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
          • If - Conditions
            • (Level of (Triggering unit)) Equal to 5
          • Then - Actions
            • Hero - Modify Strength of (Triggering unit): Add (41 / 10)
            • Hero - Modify Intelligence of (Triggering unit): Add (25 / 10)
            • Unit - Add Power Strike to (Triggering unit)
          • Else - Actions
        • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
          • If - Conditions
            • (Level of (Triggering unit)) Equal to 10
          • Then - Actions
            • Hero - Modify Strength of (Triggering unit): Add (41 / 10)
            • Hero - Modify Intelligence of (Triggering unit): Add (25 / 10)
            • Unit - Add Power Strike to (Triggering unit)
            • Unit - Set level of Power Strike for (Triggering unit) to 2
            • Unit - Add Self Buffs demon fighter to (Triggering unit)
          • Else - Actions
        • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
          • If - Conditions
            • (Level of (Triggering unit)) Equal to 15
          • Then - Actions
            • Hero - Modify Strength of (Triggering unit): Add (41 / 10)
            • Hero - Modify Intelligence of (Triggering unit): Add (25 / 10)
            • Unit - Add Power Strike to (Triggering unit)
            • Unit - Set level of Power Strike for (Triggering unit) to 3
            • Unit - Add Drain Health (demon fighter) to (Triggering unit)
          • Else - Actions
The problem is: When a hero jumps over 5-th level and gets the 6-th from the 4-th - he gets no stats and skill... If I check it every level - I get stats every level...

Any ideas? :grin:
 
Level 18
Joined
Sep 14, 2012
Messages
3,413
Why do you add every time Power Strike ?
You just have to add this one time.

In which world a hero jumps a level xD ?
If in your map there is a jump just make that the first time your hero goes beyond the level 5 he gets stats and set a boolean to false for level 5, ect...
 
Level 10
Joined
Mar 17, 2012
Messages
582
Why do you add every time Power Strike ?
You just have to add this one time.

In which world a hero jumps a level xD ?

I add power strike because it can be a situation when hero will jump over 10-th level and get 11-th at once if he kills a high level creep ^_^.
He jumps when kills level 6 creep on level 4... this is normal...

just make that the first time your hero goes beyond the level 5 he gets stats and set a boolean to false for level 5, ect...

could you please type how it have to be? because I can make it wrong :ogre_kawaii:
 
Level 18
Joined
Sep 14, 2012
Messages
3,413
:O
I didn't know that when a hero kills a level 6 creep on level 4 he jumps an entire level :O !
  • Demon lvlup
    • Events
    • Conditions
    • Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • Bool_5 Equal to True
          • (Level of (Triggering unit)) Greater than 5
        • Then - Actions
          • Set Bool_5 = False
          • Hero - Modify Strength of (Triggering unit): Add (41 / 10)
          • Hero - Modify Intelligence of (Triggering unit): Add (41 / 10)
        • Else - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • Bool_10 Equal to True
              • (Level of (Triggering unit)) Greater than 10
            • Then - Actions
              • Set Bool_10 = False
              • Hero - Modify Strenght of (Triggering unit)) : Add (41 / 10)
              • Hero - Modify Intelligence of (Triggering unit)) : Add (41 / 10 )
              • -------- Not sure this is useful --------
              • Unit - Add Power Strike to (Triggering unit)
              • Unit - Set level of Power Strike for (Triggering unit) to 2
              • Unit - Add Self Buffs demon fighter to (Triggering unit)
            • Else - Actions
              • If (All Conditions are True) then do (Then Action) else do (Else Actions)
                • Bool_15 Equal to True
                • (Level of (Triggering unit)) Greater than 15
              • Then - Actions
                • Set Bool_15 = False
                • Hero - Modify Strenght of (Triggering unit) : Add (41 / 10)
                • Hero - Modify Intelligence of (Triggering unit) : Add(41 / 10)
                • -------- Not sure this is useful --------
                • Unit - Add Power Strike to (Triggering unit)
                • Unit - Set level of Power Strike for (Triggering unit) to 3
                • Unit - Add Drain Health (demon fighter) to (Triggering unit)
              • Else - Actions
Sry for the indenting, i'll post a good one soon.
 
Level 10
Joined
Mar 17, 2012
Messages
582
:O
I didn't know that when a hero kills a level 6 creep on level 4 he jumps an entire level :O !
  • Demon lvlup
    • Events
      • Unit - A unit Gains a level
    • Conditions
      • (Unit-type of (Triggering unit)) Equal to Demon Fighter
    • Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • Bool_5 Equal to True
          • (Level of (Triggering unit)) Greater than 5
        • Then - Actions
          • Set Bool_5 = False
          • Hero - Modify Strength of (Triggering unit): Add (41 / 10)
        • Hero - Modify Intelligence of (Triggering unit): Add (25 / 10)
        • Unit - Add Power Strike to (Triggering unit)
        • Else - Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
        • (Level of (Triggering unit)) Greater than 10
        • Bool_10 Equal to True
      • Then - Actions
        • Set Variable Bool_10 = False
        • Hero - Modify Strength of (Triggering unit): Add (41 / 10)
        • Hero - Modify Intelligence of (Triggering unit): Add (25 / 10)
        • --------- Not Sure this is useful to add again ----------
        • Unit - Add Power Strike to (Triggering unit)
        • Unit - Set level of Power Strike for (Triggering unit) to 2
        • Unit - Add Self Buffs demon fighter to (Triggering unit)
      • Else - Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Level of (Triggering unit)) Equal to 15
          • Bool_15 Equal to True
        • Then - Actions
          • Set Variable Bool_15 = False
          • Hero - Modify Strength of (Triggering unit): Add (41 / 10)
          • Hero - Modify Intelligence of (Triggering unit): Add (25 / 10)
          • ------- Not sure this is useful to add again --------
          • Unit - Add Power Strike to (Triggering unit)
          • Unit - Set level of Power Strike for (Triggering unit) to 3
          • Unit - Add Drain Health (demon fighter) to (Triggering unit)
          • Else - Actions
Sry for the indenting, i'll post a good one soon.

I did like you said, but didn't test it yet... but theoretically it will work! Thanks a lot! :thumbs_up:

:O
I didn't know that when a hero kills a level 6 creep on level 4 he jumps an entire level :O !

I just changed a gameplay constants :D
 
Level 10
Joined
Mar 17, 2012
Messages
582
Booleans, lol. Check if the unit has ability and is Level 5 above. If both is false, add ability. That way, no arrayed variables and frills.
Just use ''Greater then or Equal to'', not ''Equal to''. I had similar prob and that was the solution.

The problem is not in ability! Problem in attribute modification!

Boolean_Array :) !

You mean I have to create 10 boolean variables for every player or what? I didn't catch you =(
I already use a Boolean_Array... but first I set Boolean[5] = false - it will never give skill and stats to another the same hero! right?
 
Level 10
Joined
Mar 17, 2012
Messages
582
If that is what you fear with boolean arrays, use three of them.

I guess you didn't understand the whole problem...
In my map every player may choose the same hero.
I need every hero to get his spells and stats when he reaches required level.
But if he jumps over level where he have to get his spells and stats - he doesn't get them...
If a use the advice that Malhorne gave me, it will give me what I need.
But if another player have chosen the same hero - will he get his spell too?
here is my code now:
  • Demon lvlup
    • Events
      • Unit - A unit Gains a level
    • Conditions
      • (Unit-type of (Triggering unit)) Equal to Demon Fighter
    • Actions
      • -------- CON and MEN --------
      • Unit - Add CON Demon Fighter +32 to (Triggering unit)
      • Unit - Increase level of CON Demon Fighter +32 for (Triggering unit)
      • Unit - Remove CON Demon Fighter +32 from (Triggering unit)
      • Unit - Add MEN Demon/Elf/Undead Fighter +26 to (Triggering unit)
      • Unit - Increase level of MEN Demon/Elf/Undead Fighter +26 for (Triggering unit)
      • Unit - Remove MEN Demon/Elf/Undead Fighter +26 from (Triggering unit)
      • -------- SKILLS --------
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • Demon_Fighter_Boolean[5] Equal to True
          • (Level of (Triggering unit)) Greater than or equal to 5
        • Then - Actions
          • Set Demon_Fighter_Boolean[5] = False
          • Hero - Modify Strength of (Triggering unit): Add (41 / 10)
          • Hero - Modify Intelligence of (Triggering unit): Add (25 / 10)
          • Unit - Add Power Strike to (Triggering unit)
        • Else - Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • Demon_Fighter_Boolean[10] Equal to True
          • (Level of (Triggering unit)) Greater than or equal to 10
        • Then - Actions
          • Set Demon_Fighter_Boolean[10] = False
          • Hero - Modify Strength of (Triggering unit): Add (41 / 10)
          • Hero - Modify Intelligence of (Triggering unit): Add (25 / 10)
          • Unit - Set level of Power Strike for (Triggering unit) to 2
          • Unit - Add Self Buffs demon fighter to (Triggering unit)
        • Else - Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • Demon_Fighter_Boolean[15] Equal to True
          • (Level of (Triggering unit)) Greater than or equal to 15
        • Then - Actions
          • Set Demon_Fighter_Boolean[15] = False
          • Hero - Modify Strength of (Triggering unit): Add (41 / 10)
          • Hero - Modify Intelligence of (Triggering unit): Add (25 / 10)
          • Unit - Set level of Power Strike for (Triggering unit) to 3
          • Unit - Add Drain Health (demon fighter) to (Triggering unit)
        • Else - Actions
If you fear this as said above : create one boolean array for level 5 with size 12, same for level 10 and 15.
Then the boolean_5[X] is for the level 5 of Player X.
I hope I got it... I'll try to do it tonight)))... If there is no more easy way...
 
Level 18
Joined
Sep 14, 2012
Messages
3,413
No no !
Create three variables :
- Boolean_5 array size 12
- Boolean_10 array size 12
- Boolean_15 array size 12

Create another variable, let's say X, an integer stocking the player number of the leveling hero.
And for instance, check the Boolean_5[X] for the level 5 and X is the player number of the leveling hero.
 
Level 10
Joined
Mar 17, 2012
Messages
582
No no !
Create another variable, let's say X, an integer stocking the player number of the leveling hero.
And for instance, check the Boolean_5[X] for the level 5 and X is the player number of the leveling hero.
Variable must be a Player[array] or Integer? do I need a trigger that will set X[array] a Player Number or it can be solved in this trigger?

It would be perfect if you showed me a code so I could understand it because I'm realy bad in theory :vw_sad:

Seems you never read about it. Leave all array sizes to 1 except for timers.

Excuse me, what do you mean? :ogre_icwydt:
 
Level 10
Joined
Mar 17, 2012
Messages
582
Ok good !

Check it out! I don't have a second person to help me now, so take a look and say is it right or yes?)))

  • LVLup Demon Fighter
    • Events
      • Unit - A unit Gains a level
    • Conditions
      • (Unit-type of (Triggering unit)) Equal to Demon Fighter
    • Actions
      • Set Demon_Fighter_Player = (Player number of (Owner of (Triggering unit)))
      • -------- CON and MEN --------
      • Unit - Add CON Demon Fighter +32 to (Triggering unit)
      • Unit - Increase level of CON Demon Fighter +32 for (Triggering unit)
      • Unit - Remove CON Demon Fighter +32 from (Triggering unit)
      • Unit - Add MEN Demon/Elf/Undead Fighter +26 to (Triggering unit)
      • Unit - Increase level of MEN Demon/Elf/Undead Fighter +26 for (Triggering unit)
      • Unit - Remove MEN Demon/Elf/Undead Fighter +26 from (Triggering unit)
      • -------- SKILLS --------
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • Demon_Fighter_Bool_5[Demon_Fighter_Player] Equal to True
          • (Level of (Triggering unit)) Greater than or equal to 5
        • Then - Actions
          • Set Demon_Fighter_Bool_5[Demon_Fighter_Player] = False
          • Hero - Modify Strength of (Triggering unit): Add (41 / 10)
          • Hero - Modify Intelligence of (Triggering unit): Add (25 / 10)
          • Unit - Add Power Strike to (Triggering unit)
        • Else - Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • Demon_Fighter_Bool_10[Demon_Fighter_Player] Equal to True
          • (Level of (Triggering unit)) Greater than or equal to 10
        • Then - Actions
          • Set Demon_Fighter_Bool_10[Demon_Fighter_Player] = False
          • Hero - Modify Strength of (Triggering unit): Add (41 / 10)
          • Hero - Modify Intelligence of (Triggering unit): Add (25 / 10)
          • Unit - Set level of Power Strike for (Triggering unit) to 2
          • Unit - Add Self Buffs demon fighter to (Triggering unit)
        • Else - Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • Demon_Fighter_Bool_15[Demon_Fighter_Player] Equal to True
          • (Level of (Triggering unit)) Greater than or equal to 15
        • Then - Actions
          • Set Demon_Fighter_Bool_15[Demon_Fighter_Player] = False
          • Hero - Modify Strength of (Triggering unit): Add (41 / 10)
          • Hero - Modify Intelligence of (Triggering unit): Add (25 / 10)
          • Unit - Set level of Power Strike for (Triggering unit) to 3
          • Unit - Add Drain Health (demon fighter) to (Triggering unit)
        • Else - Actions
 
Level 10
Joined
Mar 17, 2012
Messages
582
You know the meaning of Temp? Things that aren't used anywhere else. For example. When casting a spell, you need the hero's location. Just use TempPoint.

If you periodically pick all players and check something or their hero, use TempPlayer.

Yeah, I know that... but it seems to me that sometimes it is better to use perconal variables... it is more safe...
 
Status
Not open for further replies.
Top