View Single Post
  #1311    
Old June 9th, 2009, 04:09 PM
HackMew's Avatar
HackMew
Mewtwo Strikes Back
 
Join Date: Jun 2006
Quote:
Originally Posted by PI Hudson View Post
QUESTION: Is there a way to check if a pokemon is holding an item?
Not with scripting. You need ASM.

Quote:
Originally Posted by Gamer2020 View Post
Hey guys. I have a problem.
Basically I wrote a script so that when the player steps on a certain spot a sprites goes up to him and battles him.
It works up until after the battle where it just plain goes sour.
Ive attached a small video to show you what happens.

This is the script
Spoiler:
#dynamic 800000

#org @start
lock
checkflag 0x1005
if 0x1 call @done
call @pre
applymovement 0x01 @move1
waitmovement 0x0
sethealingplace 0x6
setflag 0x1005
trainerbattle 0x1 0x237 0x0 @before @after @run
end

#org @pre
applymovement 0x01 @move3
msgbox @stuff 0x2
return

#org @run
msgbox @text 0x2
applymovement 0x01 @move2
waitmovement 0x0
hidesprite 0x01
setflag 0x1005
release
end

#org @done
releaseall
end

#org @move1
#raw 0x56
#raw 0x09
#raw 0x0A
#raw 0x02
#raw 0xFE

#org @move2
#raw 0x0B
#raw 0x0B
#raw 0x0B
#raw 0x0B
#raw 0x0B
#raw 0x0B
#raw 0xFE

#org @move3
#raw 0x00
#raw 0xFE

#org @before
= How much did you hear?

#org @after
= Didn't think you'd be that strong.

#org @text
= Bye now!

#org @stuff
= They're are Whirlpools blocking\nthe entrances sir.
Fixed (mostly optimized) script is below. Anyway, the script isn't the root of the problem at all. Do not follow the suggestion to set "No movements" because then applymovement will not work. Also, "Look down" isn't glitchy at all. It's just you need to set the Movement to 11.

Spoiler:
#dynamic 0x800000

#org @start
lock
checkflag 0x1006
if 0x1 goto @done
applymovement 0x01 @move3
waitmovement 0x0
msgbox @stuff 0x2
applymovement 0x01 @move1
waitmovement 0x0
sethealingplace 0x6
setflag 0x1006
trainerbattle 0x1 0x237 0x0 @before @after @run
release
end

#org @run
msgbox @text 0x2
applymovement 0x01 @move2
waitmovement 0x0
setflag 0x1005
hidesprite 0x01
release
end

#org @done
release
end

#org @move1
#raw 0x56
#raw 0x09
#raw 0x0A
#raw 0x02
#raw 0xFE

#org @move2
#raw 0x0B
#raw 0x0B
#raw 0x0B
#raw 0x0B
#raw 0x0B
#raw 0x0B
#raw 0xFE

#org @move3
#raw 0x00
#raw 0xFE

#org @before
= How much did you hear?

#org @after
= Didn't think you'd be that strong.

#org @text
= Bye now!

#org @stuff
= There are whirlpools blocking\nthe entrances sir.



Quote:
Originally Posted by mrhiyuck View Post
Spoiler:
Code:
'---------------
#dynamic 0x800000
#org 0xE3D134
lock
faceplayer
checkflag 0x939
if 0x0 goto @noditto
checkflag 0x941
if 0x1 goto @done
msgbox @1 0x5
compare LASTRESULT 0x1
if 0x1 goto @take
msgbox @2 0x6
release
end

#org @take
checkitem 0x4 0x1
if 0x0 goto @jerk
removeitem 0x04 0x1
hidesprite 0x4
givepokemon 0x84 0xA 0xC3 0x0 0x0 0x0
fanfare 0x13E
msgbox @3 0x4
waitfanfare
closeonkeypress
setflag 0x941
msgbox @4 0x5
compare LASTRESULT 0x1
if 0x1 gosub @name
msgbox @5 0x6
release
end

#org @noditto
msgbox @7 0x6
release
end

#org @jerk
msgbox @8 0x6
release
end

#org @name
call 0x1A74EB
return

#org @done
msgbox @6 0x6
release
end

#org @1
= Hello... could you tell me your\nname?\p[player]?\pWell [player], it seems that DITTO\nover there has taken a liking to\lyou.\pIt's had a stressful time here in\nthe lab, so I was hoping he could\lspend time outside with a Trainer.\pWould you take DITTO?

#org @2
= No? Well come back if you change\nyour mind.\pI feel sorry for the little guy.

#org @3
= You received a DITTO!

#org @4
= Would you like to give a\nnickname to DITTO?

#org @5
= Be a good owner to DITTO!\nBetter then we were...

#org @6
= Hey [player]! How's DITTO doing?

#org @7
= Wow... it's been so busy, and now\nit's calmed down.\pWe were running nonstop with\nexperiments to get the Dojo\lworking.\pThat DITTO was the POK\h1bMON\ninvolved in the experiment. I hope\lhe can rest now.

#org @8
= Oh? You don't seem to have a\nPOK\h1bBALL.\pDITTO's old one was here...\nAll we need is a regular POK\h1bBALL.\pCould you find one?


This all works.. with a couple exceptions. Even without a pokeball, the checkitem doesn't seem to switch to "jerk". It does take a pokeball if you have one but if you don't it still continues without switching.

Also hidesprite works, but when you move just one step, the sprite returns. Could someone help me with these?
That's not the way checkitem works.
You do something like this:

Code:
checkitem 0x172 0x1
compare LASTRESULT 0x1
if 0x0 goto @donthave
About the "sprite returning"... that's normal. Hidesprite will hide the sprite only temporarily.
Before the hidesprite command you need to use a setflag, which value is the Person ID you set.
__________________