PDA

View Full Version : A hard thing to do maybe?


Dyer
February 15th, 2008, 05:41 AM
I'm trying to do something here but it's not working really well I wonder if someone could give me a hand (I'll take feet too).

I want to make it so that a pokémon will be itself during day, evolve during night and go back to himself during day. For ex: Pichu during day , Pikachu during night, back at pichu during day and so on...

This sounds easy enough but I wanted it to be possible to change the charset of the following Pokemon (like in Pkm Yellow) and change the moves. For ex: Pichu has Thundershock and growl, then night comes, turns to Pikachu, Pikachu has Thundershock, Slam, Double Team and Quick Attack.

Help? thnks

Mrchewy
February 16th, 2008, 02:45 AM
Are you going to tell us what program your even using? It's very hard for us to help you if you don't supply enough information ;) .

Dyer
February 16th, 2008, 03:24 AM
You're right sorry. It's RPG Maker XP.

Lorem Ipsum
February 16th, 2008, 12:05 PM
OK. Here is the code. I will tell you of ways to edit it after.


#--------------------------------------#
# Pokémon Day and Night System #
# Lorem Ipsum ---------------------#
# 16.2.08 ---------------------------#
class PokeDayNight
attr_accessor :set

def initialize(set)
@set = set
if set = "1"
if Time.now.hour => 7 && Time.now.hour =< 19
$pokemon == "Pichu"
print $pokemon
else
$pokemon == "Pikachu"
print $pokemon
end
end[/color="red"]
end
end

Extremely basic. Now, to edit it, you should edit the parts in red only.

Set "1" is the Pichu -> Pikachu set. If you want more sets, simply add another instead of the red "end", with this syntax:

elsif set == "2"
if Time.now.hour => 7 && Time.now.hour =< 19
[color="red"]Pokemon Data here etc.
else
Pokemon Data here etc.
end

You can do that as many times as you like with the sets, but after you have finished, you MUST put an "end" command after the last "elsif" block. Remember to change the set number after elsif set ==.

Also, the data which calls a Pokémon needs to be edited. You simply use the Pokémon system your scripts have given you. If you were using a text based thing, like I am developing, that would be all you needed.

To call the event, all you need to do is write this in a call script command on the field.

PokeDayNight.new(SETNUMBERHERE)

SETNUMBERHERE is the number that you referred to in the script, so for the Pikachu/Pichu one, it would be PokeDayNight.new(1).

If you find any errors with the script, don't hesitate to tell me.

Dyer
February 17th, 2008, 04:22 PM
Syntax Error Line 4...
I wonder if I did something wrong.

Lorem Ipsum
February 18th, 2008, 10:02 AM
If you copy and pasted the code, there shouldn't have been any problems. Try this though:

=begin
Pokémon Switching System
Lorem Ipsum
16.2.08
=end
class PokeDayNight
attr_accessor :set

def initialize(set)
@set = set
if set = "1"
if Time.now.hour => 7 && Time.now.hour =< 19
$pokemon == "Pichu"
print $pokemon
else
$pokemon == "Pikachu"
print $pokemon
end
end
end
end

Dyer
February 19th, 2008, 01:08 PM
I really can't make this work. I've changed it around and moved it around and all I get are errors. Sysntax error in the Time line (from x hours to x hours) and after I have fixed that and deleted an end there was an argument error (?)

Lorem Ipsum
February 19th, 2008, 01:22 PM
Ah. I see the problem. It's probably in the call script. You wouldn't put PokeDayNight.new(set), you'd put the set number in between the brackets.

Also, if you delete the time things, it won't work properly.

*tests in Tourmaline*

EDIT: Problem solved. This is the new code.


=begin
Pokémon Switching System
Lorem Ipsum
16.2.08
=end
class PokeDayNight
attr_accessor :set

def initialize(set)
@set = set
if set = "1"
if Time.now.hour >= 7 && Time.now.hour =< 19
$pokemon == "Pichu"
print $pokemon
else
$pokemon == "Pikachu"
print $pokemon
end
end
end
end


It appears that I got the operators the wrong way round.

Dyer
February 20th, 2008, 06:30 AM
if Time.now.hour >= 7 && Time.now.hour =< 19

It keeps giving me a syntax error in this line.
I just created a new class copied that and pasted it there. Why isn't it working?
The call event? I never got to the main menu...
Also I didn't delete the time things I replaced them with one that didn't give me a syntax error
Huh...What did you change about that code?

EDIT: Ok, so I changed that line with a working one. No error in the title screens this time but when I got to the Call Script (and I had a Pichu) there was a message stating "nil". What now?

Wichu
February 20th, 2008, 08:43 AM
It's because the script isn't designed for Essentials (You are using that, right?)
To use it in Essentials, instead of $pokemon=="Pikachu"
print $pokemon
you need to use
for i in 0..5
if $Trainer.party[i].species==PBSpecies::PIKACHU
$Trainer.party[i].species=PBSpecies::PICHU
end
end

and instead of$pokemon=="Pichu"
print $pokemon
use
for i in 0..5
if $Trainer.party[i].species==PBSpecies::PICHU
$Trainer.party[i].species=PBSpecies::PIKACHU
end
end


EDIT: And instead ofif set="1"
usecase @set
when 1

Dyer
February 20th, 2008, 05:20 PM
Sorry I forgot to say it was for Essentials.
Now I punched in this code and everything when smoothly til I used the call script.
There was a Runtime error. Maybe you could try to show me exactly how it's done and the exact code Wichu?
Also, very important question: Where do you put a call script like this? I'm supposed to be walking and if day turns to night then the Pokemon should change. Should I put it in Parallel Process in every map?