PDA

View Full Version : [Tutorial] Combining Scripts Help!


HackChu
June 19th, 2009, 02:38 PM
This will help those who need help on how to make commands work along with others.I've notice that Scripting Tutorials out there go over the basics,but some people don't know how to combine the methods used together.

1.Rival Type Battles

Okay I'm sure there are those out there that have trouble on knowing how to make a trainer battle where they walk up to you, battle, and than walk away.This will help you,I'll try the best I can.


Trainer battle 0x0
This means that an original type of battle will occur.An example is,a trainer you would meet on a route,or cave,etc.

Trainer battle 0x1
This type of battle is a Gym battle,which is always used to execute a battle when you want the trainer to walk to you before and walk away from you after a battle.

Trainer battle 0x4
This type of battle is an double battle.

Now I'll give an example of each!
Trainer Battle 0x0
Always start a script with #dynamic 0x(offset)
#dynamic 0x800000

#org @start
trainerbattle 0x0 0x001 0x0 @before @after
msgbox @beaten 0x6
release
end

#org @before
= I won't lose to you.

#org @after
= What!

#org @beaten
= Leave me alone!

Now at the trainer battle line 0x0 represents a regualer battle which I explained above.The 0x001 represents the Person ID from PET or Advance Trainer battle editors.The 0x0 is is the reserved byte,which is often used.The @before explains what the trainer would say if they saw you and walked up to you.And @after explains what they say during battle when they lose.Finally @beaten which is always used after the battle is what the trainer says if you talked to him.

Now Trainer battle 0x1 used with applymovements.(Look at diegoisawesome's tut for an explanation on regular 0x1 battles,as well as applymovement commands)
#dynamic 0x800000

#org @start
checkflag 0x200
showsprite 0x(person event)
applymovement 0x(person event) @move
waitmovement 0x0
msgbox @hey 0x6
trainerbattle 0x1 0x001 0x0 @before @after @later
end

#org @move
#raw 0x11
#raw 0x11
#raw 0xFE

#org @hey
= Hey wait up!

#org @before
= I want to battle!

#org @after
= Wow nice battle.

#org @later
msgbox @well 0x6
applymovement 0x(person event) @move2
waitmovement 0x0
hidesprite 0x(person event)
setflag 0x200
release
end

#org @well
= Well I have to go, bye.

#org @move2
#raw 0x10
#raw 0x10
#raw 0xFE


Okay, checkflag is always used to check and see if the battle was used yet,therefore it's always used.The checkflag here 0x200 would go in the person id in Amap,like this 0200, doing that would make the OW not visable until the showsprite command comes into play,than the hidesprite will make it disapear again.Now I explained that applymovements are explainable in diego's tut.Now the command @later is always used here,after the battle this is the pointer it continues from.Here on @later you can put anything,just make sure before you use the release command you add the setflag used,which in this case 0x200.Doing that will set the script,meaning that it wont trigger again.

I will try to add more when I get the chance.I hope you all can understand this.

spenceroone3
June 22nd, 2009, 05:32 AM
I learnt something from this tutorial but I think you need to change the thread title to something more specific. Good luck!

HackChu
June 22nd, 2009, 02:04 PM
Hey thanks alot for the first comment and reading my tut.Whats a good name?

.Seth
June 22nd, 2009, 02:58 PM
You do know about "settrainerflag" and "checktrainerflag" and "cleartrainerflag" don't you?
And to sum up what the tutorial means:

You CAN use more than one type of script command (like applymovement and msgbox, for example) in the same script.

Although, you kind of got off from combining things, to trainerbattles only. O_o

I did learn something about trainer scripts though. I wondered what double battle type's number was.

HackChu
June 22nd, 2009, 03:07 PM
Lol thanks,there is an double type battle command up there I just didn't explain it.But when I find the time I'll edit it and add more things to it and such...

_vince_04
May 4th, 2010, 04:27 PM
why dont you use trainerbattle 0x03 instead of 0x01?

Binary
May 4th, 2010, 09:10 PM
Nice tutorial. Hopefully it will help all those people who've just started scripting and don't know how to combine commands into a single script. (b'.')b