Pokémon Holding Item Problem

KrakerwatYT

Pokémon Master
Member
Joined
Aug 25, 2017
Posts
21
Age
20
So, I'm having problems with making my starter Pokémon come holding an item. Yes, I checked the wiki but nothing's working.



That's the event I put and I even tried copying from the example but I always get this error:


Can someone please tell me how I fix this?
 

Senn62

There is water at the bottom of the ocean
Member
Joined
Jul 8, 2018
Posts
3
I prefer generating the Pokémon separately and then giving it to the player because it gives you more options and is more straightforward in my opinion. You can use this to get it to work:

Script: p=PokeBattle_Pokemon.new(
:CYNDAQUIL,5,$Trainer)
p.setItem(:ORANBERRY)
Script: Kernel.pbAddPokemon(p)

Paste the first two lines in on Script Event Command and the other in a following command without including the Script: part. Make sure the first line of the first command ends in a right-facing parenthesis ( and the second starts with a colon : and you should be good.
 

Maruno

Pokémon Essentials dev
Essentials Developer
Joined
Apr 5, 2017
Posts
409
Your error is caused because your first "line" of code where you define what poke is is actually split across two lines, and the game has no idea that it should read line two as an extension of line one because poke=$Trainer.party is a valid and complete line of code in itself.

To fix, simply take the [ from the start of the second line and put it on the end of the first line:

Code:
poke=$Trainer.party[
  $Trainer.party.length-1]
This makes the game expect more out of the first line, so it looks to the second line for a continuation.

Alternatively, use poke=$Trainer.lastParty (or poke=$Trainer.lastPokemon or poke=$Trainer.lastAblePokemon, although in this case they'll all do the same thing).
 
Top