• 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?".
  • Forum moderator applications are now open! Click here for details.
  • 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.

Script Help Thread (DO NOT REQUEST SCRIPTS)

Status
Not open for further replies.
18
Posts
10
Years
  • Seen Jul 11, 2019
Hello again,

Which is the flag, or the var, where i can check if a battle has been won or not? I need it because i would realize a battle that i'm sure i'll loose, and after that i would move my sprite to another bank map and position.
 

Wobbu

bunger bunger bunger bunger
2,794
Posts
12
Years
Hello again,

Which is the flag, or the var, where i can check if a battle has been won or not? I need it because i would realize a battle that i'm sure i'll loose, and after that i would move my sprite to another bank map and position.

Just use checktrainerflag 0xYYY.
YYY would be the trainer's number (the one you'll see in A-Trainer).
 
18
Posts
10
Years
  • Seen Jul 11, 2019
So, like this?

Code:
trainerbattle <etc>..
checktrainerflag 0x<ID>
if 0x1 goto @win
// if you loose

Right? Or have i to compare the last result?
 
Last edited:

karatekid552

What happens if I push it?....
1,771
Posts
11
Years
So, like this?

Code:
trainerbattle <etc>..
checktrainerflag 0x<ID>
if 0x1 goto @win
// if you loose

Right? Or have i to compare the last result?

Nope, a common misconception is that trainerflags are set when you beat them. Trainerflags are really cleared when you beat them.

And yes, you need to compare LASTRESULT 0x0 in between the chckflag and the if.
 
Last edited:
18
Posts
10
Years
  • Seen Jul 11, 2019
So it should be like this:

Code:
checktrainerflag 0x<value>
compare LASTRESULT 0x0
if 0x1 goto @Win
 

Wobbu

bunger bunger bunger bunger
2,794
Posts
12
Years
So, like this?

Code:
trainerbattle <etc>..
checktrainerflag 0x<ID>
if 0x1 goto @win
// if you loose

Right? Or have i to compare the last result?

Yeah, if the trainer has been defeated, then the flag will be set. You don't need to check a variable, just do if 0x1 goto.
If you want to do a script with the actual trainerbattle in it, then this is what you want:
Code:
trainerbattle 0x3 0xYYY 0x0 @intro @defeat

Iirc, trainerbattle 0x3 allows execution after the battle, even if you lose.
 

karatekid552

What happens if I push it?....
1,771
Posts
11
Years
Yeah, if the trainer has been defeated, then the flag will be set. You don't need to check a variable, just do if 0x1 goto.
If you want to do a script with the actual trainerbattle in it, then this is what you want:
Code:
trainerbattle 0x3 0xYYY 0x0 @intro @defeat

Iirc, trainerbattle 0x3 allows execution after the battle, even if you lose.

NO!

Sorry bro, but this is completely wrong. Trainerflags are cleared when you win, and trainerbattle 0x3 doesn't require a pounter to continue the script, however the wcript will NOT continue if you lose. The only trainerbattle that will continue is 0x9. However that is the tutorial battle which has all sprts of messaged which pop up, though woth a alittle work, they can be removed.

So it should be like this:

Code:
checktrainerflag 0x<value>
compare LASTRESULT 0x0
if 0x1 goto @Win

Yes, that is correct, for checking if you won of course.
 
Last edited:

destinedjagold

You can contact me in PC's discord server...
8,593
Posts
16
Years
  • Age 33
  • Seen Dec 23, 2023
Thanks for the insight on the hidden scripts, but the problem is that I the grunts won't leave their "hiding place" but still move the way they are supposed to minus the appearing which you have just informed me how to do. I will post a video, but seeing as I can't post links yet, just check out my youtube channel for the video if you are willing to help. the channel name is cclemur

Your NPCs are too far away from the player for them to move.
Spoiler:

There is a limit of distance for NPCs to be able to be controlled by your scripts.
They should be within an 8(or 9 maybe) tile distance horizontally, and 7 tiles vertically.
 
5
Posts
10
Years
  • Seen Aug 15, 2013
Hey again guys,

So i'v been getting pretty good at scripting (at least in my own opinion anyways), I'm hacking FR and i'm changing the way Professor Oak comes to you at the start and I have two Psyduck blocking the exit of Pallet to Route 1, these blocks are unpassable until after you have been to the lab, but the question im really asking is, is there a ways i can make a tile passable in script?

The Psyducks disappear, thats no problem but the tile itself is still locked to movement because of the movement permissions...so yea ill just leave this here, if anyone can help great!

Or if there is a forum which can teach my how to do this that would be great!

Anyways, cheers in advance you guys are always great help :)

Don't need the help anymore guys, I found the "setmaptile" command tinkered with it till I got it to work :D
 
Last edited:

DaleH771

Pokémon: Giovanni Origins developer
196
Posts
12
Years
  • Seen Nov 23, 2023
I had a hack in production, but deserted it because after coming back it my scripting skills weren't exactly great... Anyone made a simple and easy tool for scripting yet?

I might re-open my hack if I can get scripting again easily
 
154
Posts
11
Years
  • Seen Jan 8, 2017
hey guys, i wanted to know is it possible to give money in a script in the same way you would an item? Ive done a lot of scripting already, ive just never wanted to do this until now, so i havent payed any attention to whether or not i could.
 

karatekid552

What happens if I push it?....
1,771
Posts
11
Years

Wobbu

bunger bunger bunger bunger
2,794
Posts
12
Years
Givemoney will give the player money, whereas paymoney will take away money. They're complete opposites, so remember which one is which when you're using them.
 

xGal

Mhm
241
Posts
12
Years
Pfft, haha, thanks. And im assuming paymoney and givemoney are the same thing right? I just read it, but i want to make sure theres not some secret way of using them, haha.

Givemoney = gives the player money
Paymoney = player pays money

First post here ^^
 
6
Posts
12
Years
  • Seen Jul 21, 2015
Im trying to give the hero the HM Fly...
But all that comes up is Hero has received ?????????????
Why?
Spoiler:
 

destinedjagold

You can contact me in PC's discord server...
8,593
Posts
16
Years
  • Age 33
  • Seen Dec 23, 2023
Im trying to give the hero the HM Fly...
But all that comes up is Hero has received ?????????????
Why?
Code:
#dynamic 0x800000
 
#org @start
lock
faceplayer
checkflag 0x835
if 0x1 goto @done
msgbox @1 0x5
compare 0x800D 0x1
if 0x1 goto @take
msgbox @2 0x6
release
end
 
#org @done
msgbox @3 0x6
release
end
#org @take
giveitem [COLOR="Red"]0x[/COLOR]340 0x1 MSG_OBTAIN
msgbox @3 0x6
setflag 0x835
release
end
 
#org @1
= Hey kid,\nI found this item....\pBut I have no use for it......\pYou want it?
 
#org @2
= It's a pretty nice item!
 
#org @3
= If you plan on using it,\nYou need the VoidBadge first!

You are confusing yourself with hex (0x340) and decimal(340).
Hex and decimal values are not equivalent (except from 0 to 9).

Buy anyway, remove the part in red.
 

Teh Blazer

Divider of Zero
776
Posts
15
Years
Posted in the wrong section...

*sigh* Level scripts just seem to hate me... :/

This is a level script that triggers when the player is warped into their room. So far there is only one other level script on the map, one that I put up to lay the groundwork for other level scripts and action in the future. I'm using the [04] Script Type because I dunno and I made sure to set the var in the script. The thing is, it starts with the lockall command and then the script just stops with the player locked in place.

Here's the script for reference:
Spoiler:
 
Status
Not open for further replies.
Back
Top