• Our software update is now concluded. You will need to reset your password to log in. In order to do this, you will have to click "Log in" in the top right corner and then "Forgot your password?".
  • Welcome to PokéCommunity! Register now and join one of the best fan communities on the 'net to talk Pokémon and more! We are not affiliated with The Pokémon Company or Nintendo.

How to set up O Powers

11
Posts
5
Years
Hi! I'm learning programming and I joined this community because I wanted to share some scripts I did (and I think they are pretty well).

I'm gonna give you some instructions to set up the 6th generation powers that you have. They have several functions: boost your team in battles, increase the gained money, speed up your egg hatching and pokemon growth... In the original games, using this consumes some "energy", which is restored when you close your DS and start walking.

Obviously, it's difficult to walk if you are playing your fan game in your desktop XD, so I created this code adapted to the Essentials scripts. This is how the O Powers works with this script:
  • The O Power menu is in a button of Pokegear, and it is visible when you receive your first O Power level.
  • The O Power data is stored in the global variable $PokemonGlobal (object of PokemonGlobalMetadata)
  • The power energy is shown like a bar and fills up each 6400 steps (5% each 128)
  • The effect of O Power dissapear in the specified minutes (3 by default) and a message is shown to let you know.

Here is the script you need. Put it above main to make it work.
Spoiler:
This is the basis to set up O Power. In this thread you have a ZIP with pictures that this code need. You can modify them, but make sure you also modify the coordinates in the Scene_OPowers class.
Now you need to make some changes in your scripts. I recommend you to put comment to point out that you have modified the script, if there was any error.

Attack and defense
I have modified this O Power: Attack makes the leading Pok?mon raise its attack and special attack when it is called out. Defense does it for defense and special defense. To set up this, find in PokeBattle_Battle, in def pbStartBattleCore (line 2515) pbOnActiveAll and put this below it:
Spoiler:
Catch
Again, find in PokeBattle_Battle, def pbThrowPokeball and put this above shakes=0 (line 124).
Spoiler:
Reward
In the same class, find in def pbEndOfBattle (line 3939) and put this below tmoney*=2 if @doublemoney.
Spoiler:
Critical
Now, in PokeBattle_Move, in def pbIsCritical? find c+=1 if attacker.hasWorkingItem(...) (line 582) and put this below it:
Spoiler:
Happiness
Go to PokeBattle_Pokemon to def changeHappiness and before @happiness+=gain (line 837) put this:
Spoiler:
This will make the gaining happiness multiplies, even giving the Pok?mon an object.
Discount
Go to PScreen_Mart, def pbPokemonMart (line 792). Replace everything that is before stock.compact! and put this (make sure you also change your own methods!):
Spoiler:
Encounter and Repel
Go to PField_Encounters, def pbGenerateEncounter, line 321. Put above return nil if rand ...:
Spoiler:
Incubation
I have change this proc because it was inadaptable to these scripts. The effect is exactly the same, but more flexible to changes. In PScreen_EggHatching, line 205, comment by putting a =begin ... =end block (like commenting with '#') starting in the method Events.onStepTaken+=proc {|sender,e and add out of the block this:
Spoiler:
Warning! Using this method may convert eggsteps (Integer) into Float, so be aware if you are checking an exact number of eggsteps anywhere.
Experience gain
Go back to PokeBattle_Battle section in def pbGainExpOne. Below isConst?(thispoke.itemInitial,PBItems,:LUCKYEGG) (line 1930) put this code:
Spoiler:
I also added a Power that makes wild pokemon have 31 IVs according to the given level.

Now you have to put the button in the Pok?Gear.
Add this line in the section PScreen_Pokegear (def pbStartScreen, line 120) below [I@cmdJukebox=-1[/I]
Code:
cmdOPower=-1 #!#OP
Then a few lines below, above commands[cmdJukebox=commands.length]=_INTL("Jukebox") put this line:
Code:
commands[cmdOPowers = commands.length] = ["o-powers",_INTL("O-Powers")] if !$PokemonGlobal.oplevels.empty? #!#OP
Now, in the loop, (line 149) add this condition:
Code:
      elsif cmdOPowers>=0 && cmd==cmdOPowers #!#OPOWERS
        pbPlayDecisionSE()
        Scene_OPowers.new.start
#      end

And Now the code is set! All you have to do is activate O-Powers in the adventure by using this code:n
Code:
$PokemonGlobal.opLevelUp(OPowers::X,level)
Being X the internal name of the O-Power (defined in module OPowers) and level the number to sum to the current level (if you don't specify, by default is 1). This will allow the player to find the menu in the PokeGear and update that O Power.

The attribute $PokemonGlobal.oplevels is an Array of the current level of each O Power id. If it is empty, the PokeGear won't show the O Power button. $PokemonGlobal.opower_data Array stores the current working O Power wich also relates each O Power id with the launched O Power ([level,launch time,duration] or nil if none). $PokemonGlobal.openergy is the energy in % of the power bar shown in the O Power scene. It can be between 0 and 100 inclusive.

What can you add in?
You can program a way to have the "most powerful O-Power". Each activation of powers checks its level, and if it has an unknown level (i.e. not 1, 2 nor 3), the power is more beneficial than other. If you want to add a new O-Power, all you have to do is define an id in module OPowers as well as a name, description and cost, and modify the code.

I hope this is worth for you, and I would thank if you mention me in the credits. :D
 

Attachments

  • O Power.zip
    3.2 KB · Views: 16
Last edited:

WolfPP

Spriter/ Pixel Artist
1,309
Posts
5
Years
My god, so nice! I will put into my game. Ty ty!

So, i dont get it how put 'Incubation'. Sorry to ask but can you teach more about that?

My line 178:
Spoiler:
Im usin v17.2 and EBS.

Ty ty!


EDIT:

And i get this error:

Spoiler:

I see than your start screen is different to the others

This is mine (the last add to pokegear, custom:
Code:
      elsif cmdWallClockTimer>=0 && cmd==cmdWallClockTimer
        pbPlayDecisionSE
        pbFadeOutIn(99999){
          scene = WallClockScene.new
          screen = WallClockScreen.new(scene)
          screen.pbStartScreen($Trainer.gender==0)
        }
      end
    end
    @scene.pbEndScene
  end
end

How could be?

Thanks!
 
Last edited:
11
Posts
5
Years
My god, so nice! I will put into my game. Ty ty!

So, i dont get it how put 'Incubation'. Sorry to ask but can you teach more about that?

My line 178:
Spoiler:
Im usin v17.2 and EBS.

Ty ty!


EDIT:

And i get this error:

Spoiler:

I see than your start screen is different to the others

This is mine (the last add to pokegear, custom:
Code:
      elsif cmdWallClockTimer>=0 && cmd==cmdWallClockTimer
        pbPlayDecisionSE
        pbFadeOutIn(99999){
          scene = WallClockScene.new
          screen = WallClockScreen.new(scene)
          screen.pbStartScreen($Trainer.gender==0)
        }
      end
    end
    @scene.pbEndScene
  end
end

How could be?

Thanks!
Oh, I see, I'm sorry, my version was 16, this is why the starting script is so different. I will update this script, so by the moment, you only need to adapt it to the v17. So, in the PScreen_Pokegear, in the def pbStartScreen add what I told to set the Pokégear but removing the '@' of cmdOPower and instead the update_command (which doesn't exist in v17), put this after the several conditional branches:
Spoiler:
Then replace the script I'd given by this:
Spoiler:

By the way, the problem that you had trying to set the Incubation power is because of the version too. You just need to do what I specified in the last section's proc (line 205).

I'm sorry for this all, I'm going to change the script and update the thread. This is the temporal solution, please tell me if you notice another error. Thanks for using the script!! :D
 
Last edited:

WolfPP

Spriter/ Pixel Artist
1,309
Posts
5
Years
Hmmm, give me that issue:

Code:
---------------------------
Pokemon Essentials
---------------------------
[Pokémon Essentials version 17.2]

[Pokétch v1.1]

Exception: NoMethodError

Message: undefined method `start' for #<Scene_OPowers:0xd0e73a0>

PScreen_Pokegear:193:in `pbStartScreen'

PScreen_Pokegear:192:in `pbFadeOutIn'

PScreen_Pokegear:192:in `pbStartScreen'

PScreen_Pokegear:155:in `loop'

PScreen_Pokegear:196:in `pbStartScreen'

Neo Pause Menu:405

Neo Pause Menu:404:in `pbFadeOutIn'

Neo Pause Menu:404

Neo Pause Menu:401:in `call'

Neo Pause Menu:48:in `runAction'

i think its your startscreen. You havent a pbStartScreen. And idk how to make one (to sad).
Look:
Code:
      elsif cmdJukebox>=0 && cmd==cmdJukebox
        pbPlayDecisionSE
[B]        pbFadeOutIn(99999){
          scene = PokemonJukebox_Scene.new
          screen = PokemonJukeboxScreen.new(scene)
          screen.pbStartScreen
        }[/B]

And "i" thank you lol :D
 
11
Posts
5
Years
Ok, I'm stupid, I forgot to change the most important thing. I have edited the previous post with a 'start' method, try again copying that script. If it still doesn't work, you can PM me.
 

WolfPP

Spriter/ Pixel Artist
1,309
Posts
5
Years
Ok, I'm stupid, I forgot to change the most important thing. I have edited the previous post with a 'start' method, try again copying that script. If it still doesn't work, you can PM me.

Ok. I did :D

EDIT:

DONE!

How?

in ' def pbStartScreen' add:
Code:
cmdOPower         = -1

above '@scene.pbStartScene(commands)' add:
Code:
 commands[cmdOPower = commands.length] = ["opower",_INTL("O Powers")] if !$PokemonGlobal.oplevels.empty? #!#OP

Then, below this:
Code:
    loop do
      cmd = @scene.pbScene
      if cmd<0
        pbPlayCancelSE
        break
add this:
Code:
      elsif cmdOPower>=0 && cmd==cmdOPower
        pbPlayDecisionSE
        pbFadeOutIn(99999){
          Scene_OPowers.new.start
        }

Ty ty! <3

EDIT2: Now when i try to exit to overworld, i dont get it cuz keep the O Power screen.
 
Last edited:
Back
Top