Bonus attributes per level?

Status
Not open for further replies.
Level 13
Joined
Oct 16, 2010
Messages
731
Hi

I'm trying to make a system for my Pokemon map where if you level up one of your three attributes will increase at random. I managed to do it with having triggers literally change the attribute but I wanted to make it so the increases where visible to the player.

I have created three different abilities based on "item stat bonus" where each one has 100 levels and increases one of each stat individually.

However the problem comes that when the ability is added to the Hero (Pokemon) when they first gain a bonus there is a massive spike of lag. Further more even when they do indeed have the ability it doesn't increase when it should. Any ideas?

  • Bonus Stats Per Level
    • Events
      • Unit - A unit Gains a level
    • Conditions
    • Actions
      • Set TempInt = (Random integer number between 1 and 3)
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • TempInt Equal to 1
        • Then - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • (Level of Stat Bonus (Agility) for (Leveling Hero)) Equal to 0
            • Then - Actions
              • Unit - Add Stat Bonus (Agility) to (Leveling Hero)
            • Else - Actions
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • (Level of Stat Bonus (Agility) for (Leveling Hero)) Less than 100
                • Then - Actions
                  • Unit - Increase level of Stat Bonus (Agility) for (Leveling Hero)
                • Else - Actions
        • Else - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • TempInt Equal to 2
            • Then - Actions
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • (Level of Stat Bonus (Intelligence) for (Leveling Hero)) Equal to 0
                • Then - Actions
                  • Unit - Add Stat Bonus (Intelligence) to (Leveling Hero)
                • Else - Actions
                  • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                    • If - Conditions
                      • (Level of Stat Bonus (Intelligence) for (Leveling Hero)) Less than 100
                    • Then - Actions
                      • Unit - Increase level of Stat Bonus (Intelligence) for (Leveling Hero)
                    • Else - Actions
            • Else - Actions
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • TempInt Equal to 3
                • Then - Actions
                  • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                    • If - Conditions
                      • (Level of Stat Bonus (Strength) for (Leveling Hero)) Equal to 0
                    • Then - Actions
                      • Unit - Add Stat Bonus (Strength) to (Leveling Hero)
                    • Else - Actions
                      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                        • If - Conditions
                          • (Level of Stat Bonus (Strength) for (Leveling Hero)) Less than 100
                        • Then - Actions
                          • Unit - Increase level of Stat Bonus (Strength) for (Leveling Hero)
                        • Else - Actions
                • Else - Actions
EDIT: Solved - Using Attribute Bonus rather than item abilities appears to have fixed the problem.

EDIT no.2: There is still a small lag spike when the ability is learnt to begin with but now I have met the problem of the ability not carrying over correctly when evolving. Here are the triggers (the copy trigger and one evolution trigger).

  • Copy Bonus Stats
    • Events
    • Conditions
    • Actions
      • Unit - Remove Stat Bonus (Agility) - NEW from (Casting unit)
      • Unit - Remove Stat Bonus (Intelligence) - NEW from (Casting unit)
      • Unit - Remove Stat Bonus (Strength) - NEW from (Casting unit)
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Level of Stat Bonus (Agility) - NEW for (Casting unit)) Greater than 0
        • Then - Actions
          • For each (Integer A) from 1 to (Level of Stat Bonus (Agility) - NEW for (Casting unit)), do (Actions)
            • Loop - Actions
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • (Level of Stat Bonus (Agility) - NEW for (Last replaced unit)) Equal to 0
                • Then - Actions
                  • Unit - Add Stat Bonus (Agility) - NEW to (Last replaced unit)
                • Else - Actions
                  • Unit - Increase level of Stat Bonus (Agility) - NEW for (Last replaced unit)
        • Else - Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Level of Stat Bonus (Intelligence) - NEW for (Casting unit)) Greater than 0
        • Then - Actions
          • For each (Integer A) from 1 to (Level of Stat Bonus (Intelligence) - NEW for (Casting unit)), do (Actions)
            • Loop - Actions
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • (Level of Stat Bonus (Intelligence) - NEW for (Last replaced unit)) Equal to 0
                • Then - Actions
                  • Unit - Add Stat Bonus (Intelligence) - NEW to (Last replaced unit)
                • Else - Actions
                  • Unit - Increase level of Stat Bonus (Intelligence) - NEW for (Last replaced unit)
        • Else - Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Level of Stat Bonus (Strength) - NEW for (Casting unit)) Greater than 0
        • Then - Actions
          • For each (Integer A) from 1 to (Level of Stat Bonus (Strength) - NEW for (Casting unit)), do (Actions)
            • Loop - Actions
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • (Level of Stat Bonus (Strength) - NEW for (Last replaced unit)) Equal to 0
                • Then - Actions
                  • Unit - Add Stat Bonus (Strength) - NEW to (Last replaced unit)
                • Else - Actions
                  • Unit - Increase level of Stat Bonus (Strength) - NEW for (Last replaced unit)
        • Else - Actions
  • Charmander Charmeleon Charizard
    • Events
      • Unit - A unit Finishes casting an ability
    • Conditions
      • (Ability being cast) Equal to Evolve
    • Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Unit-type of (Casting unit)) Equal to Charmander
          • (Hero level of (Casting unit)) Greater than or equal to 16
        • Then - Actions
          • Unit - Replace (Casting unit) with a Charmeleon using The new unit's max life and mana
          • Game - Display to (All players) for 10.00 seconds the text: (((Name of (Owner of (Casting unit))) + ('s + ((Name of (Casting unit)) + ( has evolved into a + (Name of (Last replaced unit)))))) + !)
          • For each (Integer A) from 1 to (Level of Ember (Level 1) for (Casting unit)), do (Actions)
            • Loop - Actions
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • (Level of Ember (Level 1) for (Casting unit)) Greater than 0
                • Then - Actions
                  • Hero - Learn skill for (Last replaced unit): Ember (Level 1)
                • Else - Actions
          • For each (Integer A) from 1 to (Level of Growl (Level 2) for (Casting unit)), do (Actions)
            • Loop - Actions
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • (Level of Growl (Level 2) for (Casting unit)) Greater than 0
                • Then - Actions
                  • Hero - Learn skill for (Last replaced unit): Growl (Level 2)
                • Else - Actions
          • For each (Integer A) from 1 to (Level of Smokescreen (Level 3) for (Casting unit)), do (Actions)
            • Loop - Actions
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • (Level of Smokescreen (Level 3) for (Casting unit)) Greater than 0
                • Then - Actions
                  • Hero - Learn skill for (Last replaced unit): Smokescreen (Level 3)
                • Else - Actions
          • For each (Integer A) from 1 to (Level of Fire Spin (Level 4) for (Casting unit)), do (Actions)
            • Loop - Actions
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • (Level of Fire Spin (Level 4) for (Casting unit)) Greater than 0
                • Then - Actions
                  • Hero - Learn skill for (Last replaced unit): Fire Spin (Level 4)
                • Else - Actions
          • For each (Integer A) from 1 to (Level of Will-o-wisp (Level 5) for (Casting unit)), do (Actions)
            • Loop - Actions
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • (Level of Will-o-wisp (Level 5) for (Casting unit)) Greater than 0
                • Then - Actions
                  • Hero - Learn skill for (Last replaced unit): Will-o-wisp (Level 5)
                • Else - Actions
          • Trigger - Run Copy Bonus Stats <gen> (checking conditions)
        • Else - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • (Unit-type of (Casting unit)) Equal to Charmeleon
              • (Hero level of (Casting unit)) Greater than or equal to 48
            • Then - Actions
              • Unit - Replace (Casting unit) with a Charizard using The new unit's max life and mana
              • Game - Display to (All players) for 10.00 seconds the text: (((Name of (Owner of (Casting unit))) + ('s + ((Name of (Casting unit)) + ( has evolved into a + (Name of (Last replaced unit)))))) + !)
              • For each (Integer A) from 0 to (Level of Fire Spin (Level 4) for (Casting unit)), do (Actions)
                • Loop - Actions
                  • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                    • If - Conditions
                      • (Level of Fire Spin (Level 4) for (Casting unit)) Greater than 0
                    • Then - Actions
                      • Hero - Learn skill for (Last replaced unit): Fire Spin (Level 4)
                    • Else - Actions
              • For each (Integer A) from 0 to (Level of Will-o-wisp (Level 5) for (Casting unit)), do (Actions)
                • Loop - Actions
                  • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                    • If - Conditions
                      • (Level of Will-o-wisp (Level 5) for (Casting unit)) Greater than 0
                    • Then - Actions
                      • Hero - Learn skill for (Last replaced unit): Will-o-wisp (Level 5)
                    • Else - Actions
              • Trigger - Run Copy Bonus Stats <gen> (checking conditions)
            • Else - Actions
EDIT no. 3: So now that also works which is always good. Still got lag spikes whenever they are given the spell though. Not much of an issue but anyone got any ideas?
 
Last edited:
Level 27
Joined
Sep 26, 2009
Messages
2,499
how many levels does that ability have?

Also, whenever you add something for the first time, it will make a little lagspike. That's why many people add all those abilities, that cause lag spike, to some random unit, which they delete immediately after; they do it at the start of the map... like after 1 second elapsed game time => this way the lag is controlled by the map maker.
 
Level 13
Joined
Oct 16, 2010
Messages
731
I have changed it now so that it has 50 abilities and the max is that altogether 1 hero can only have 75 levels of the abilities.

So if I put in a random unit and add the abilities then remove the unit it will fix it? (in a way)
 
Level 27
Joined
Sep 26, 2009
Messages
2,499
I think the problem most likely lies in the fact, that the game has to load the ability for the first time and that the ability has way too many levels (75 as you wrote).

The approach I wrote about won't fix it, however it will be controlled lag - instead of the game lagging some time during the game, it will lag immediately at the beginning. The lag will most likely have same length though.
 
Level 13
Joined
Oct 16, 2010
Messages
731
I have done your idea of adding the spells to a unit at the start of a game and it all works fine now. So cheers!

P.S. It does lag at the beginning now but it takes about 5 seconds for the game to really "begin" anyway so that is no problem for me!!!
 
Status
Not open for further replies.
Top