This would be much easier, if GBA would allow multithreading :P
I give you a tip: calling the scripthandler instead of ASMing everything
(like getplayerpos or applymovement), you save much time with it.
If I understand your idea, could be changing clothes in the game.
For if it is possible for a sprite walk along with the player ...
It would be sensational!
Hi there, maybe the last advance about the ram data are usefull but maybe we can study the system used on the script of RPGMaKeR pokemon games on it are created mulriple events (because on it can follow thru 6 pokemon) but esentially an event are created on the map; if i'm not remember too bad its on map at once, my knowledge un Ruby is't closely to Zero but maybe somebody can study and compare the posible syntax comon fuction.
Its only an idea ;P
It's been awhile since I looked at it, but here's my attempt at a follow script. It works nice, for some things, but has serious limitations.
Here's the video of it in action:
Limitations:
1) The sprite doesn't follow when changing areas, including changing routes. I bypassed this by setting up sprites in 'unseeable' areas, then teleporting them as needed when the player enters new areas. (This is seen when the player leaves buildings in the video)
2) Tests showed that battles work as normal....until I edited the code forever ago >.<. I think they still work, but haven't tested it. The code should support normal battle functions.
3) Requires the hacked FireRed Engine/
4) Doesn't currently track swimming or jumping. It does take into account running, but I don't remember if the current version does. (A past version does, but I lost that one.)
Here's the code snippets. It's been forever, so I don't remember if this is all of it or not.
Spoiler:Loading the Follower Script Information:
'---------------
#dynamic 0x00900220
#org 0x00900220
loadpointer 0x0 0x00900000
special 0x81
setvar 0x5000 0x1
checkflag 0x1005
if 0x1 call @end
getplayerpos 0x5018 0x5019
getplayerpos 0x5020 0x5021
movesprite 0xFE 0x5018 0x5019
getplayerpos 0x5014 0x5015
getplayerpos 0x5016 0x5017
release
end
#org @end
release
end
Spoiler:The follow script itself:
'---------
' Strings
'---------
#dynamic 0x00900000
#org 0x900000
release
checkflag 0x1005
if 0x1 call @end
copyvar 0x5010 0x5018
copyvar 0x5011 0x5019
copyvar 0x5012 0x5020
copyvar 0x5013 0x5021
copyvar 0x5006 0x5014
copyvar 0x5007 0x5015
copyvar 0x5008 0x5016
copyvar 0x5009 0x5017
subvar 0x5011 0x5007
compare 0x5011 0x1
if 0x1 call @MoveDown
subvar 0x5009 0x5013
compare 0x5009 0x1
if 0x1 call @MoveUp
subvar 0x5010 0x5006
compare 0x5010 0x1
if 0x1 call @MoveRight
subvar 0x5008 0x5012
compare 0x5008 0x1
if 0x1 call @MoveLeft
copyvar 0x5014 0x5018
copyvar 0x5015 0x5019
copyvar 0x5016 0x5020
copyvar 0x5017 0x5021
getplayerpos 0x5018 0x5019
getplayerpos 0x5020 0x5021
call 0x00905000
Special 0x8f /*the trainer position special*/
Special2 0x800d 0x7f /*returns 1 if ground battles, 2 if water battles*/
Compare 0x800d 0x1
If 0x1 call @grass
Compare 0x800d 0x2
If 0x1 call @water
return
#org @WentDown
applymovement 0xFE @Move1
return
#org @WentUp
applymovement 0xFE @Move2
return
#org @WentLeft
applymovement 0xFE @Move3
return
#org @WentRight
applymovement 0xFE @Move4
return
#org @WentDownRun
applymovement 0xFE @Move5
return
#org @WentUpRun
applymovement 0xFE @Move6
return
#org @WentLeftRun
applymovement 0xFE @Move7
return
#org @WentRightRun
applymovement 0xFE @Move8
return
#org @grass
Special 0x97 /*generates a random grass battle*/
return
#org @water
Special 0x98 /*generates a random water battle*/
return
'-----------
' Movements
'-----------
#org @Move1
#raw 0x10 'Step Up (Normal)
#raw 0xFE 'End of Movements
#org @Move2
#raw 0x11 'Step Up (Normal)
#raw 0xFE 'End of Movements
#org @Move3
#raw 0x12 'Step Up (Normal)
#raw 0xFE 'End of Movements
#org @Move4
#raw 0x13 'Step Up (Normal)
#raw 0xFE 'End of Movements
#org @Move5
#raw 0x1D 'Step Up (Normal)
#raw 0xFE 'End of Movements
#org @Move6
#raw 0x1E 'Step Up (Normal)
#raw 0xFE 'End of Movements
#org @Move7
#raw 0x1F 'Step Up (Normal)
#raw 0xFE 'End of Movements
#org @Move8
#raw 0x20 'Step Up (Normal)
#raw 0xFE 'End of Movements
#org @MoveDown
checkflag 0x82F
if 0x0 call @WentDown
if 0x1 call @CheckRunDown
return
#org @CheckRunDown
special2 0x8006 0x2b
compare 0x8006 0x3
if 0x1 call @WentDownRun
compare 0x8006 0x2
if 0x1 call @WentDownRun
if 0x0 call @WentDown
return
#org @MoveUp
checkflag 0x82F
if 0x0 call @WentUp
if 0x1 call @CheckRunUp
return
#org @CheckRunUp
special2 0x8006 0x2b
compare 0x8006 0x3
if 0x1 call @WentUpRun
compare 0x8006 0x2
if 0x1 call @WentUpRun
if 0x0 call @WentUp
return
#org @MoveLeft
checkflag 0x82F
if 0x0 call @WentLeft
if 0x1 call @CheckRunLeft
return
#org @CheckRunLeft
special2 0x8006 0x2b
compare 0x8006 0x3
if 0x1 call @WentLeftRun
compare 0x8006 0x2
if 0x1 call @WentLeftRun
if 0x0 call @WentLeft
return
#org @MoveRight
checkflag 0x82F
if 0x0 call @WentRight
if 0x1 call @CheckRunRight
return
#org @CheckRunRight
special2 0x8006 0x2b
compare 0x8006 0x3
if 0x1 call @WentRightRun
compare 0x8006 0x2
if 0x1 call @WentRightRun
if 0x0 call @WentRight
return
#org @end
call 0x00905000
Special 0x8f /*the trainer position special*/
Special2 0x800d 0x7f /*returns 1 if ground battles, 2 if water battles*/
Compare 0x800d 0x1
If 0x1 call @grass
Compare 0x800d 0x2
If 0x1 call @water
end
If I remember correctly, this script only needs to be enacted once. Then it will work so long as the follower is within the same map. (Thus, when changing maps, the follower needs to be placed behind or at the player).
Hope this helps some of you =/ I've left Pokemon hacking and went back to Skyrim >_<.
To those who sent me PMs. Sorry, didn't see them >_< But here you go! :D
Saturnus said:But maybe someday a follow script like HG/SS will surely be find.
That will probably be never possible as the GBA has limits.
I actually had an idea as to how to implement this a while back. So the basic follow-me algorithm is to echo the player's movement one step behind them at all times. My idea was to keep a log of the player's last movement and then apply these movements to whatever dummy sprite there is on the map.
Now obviously this is easier said than done, but I have been led to believe that all player movement uses some shape or form of the "applymovement" command, or at least the function that it is tied to. So if we can attach our logger there, and then apply it to another sprite, then we are good to go.
I actually had an idea as to how to implement this a while back. So the basic follow-me algorithm is to echo the player's movement one step behind them at all times. My idea was to keep a log of the player's last movement and then apply these movements to whatever dummy sprite there is on the map.
Now obviously this is easier said than done, but I have been led to believe that all player movement uses some shape or form of the "applymovement" command, or at least the function that it is tied to. So if we can attach our logger there, and then apply it to another sprite, then we are good to go.
AFAIK the player doesn't move with applymovement. I've tried to trace it, but couldn't find anything.
Great news. ShinyQuagsire and I found a macro routine that controls player movement in a similar fashion to applymovement. The next step is to see if we can dump the movements and make another npc follow them. This project will be finished.:D
BTW, shiny never said that applymovement moved the player. He said a system like applymovement. and yes, that is what we found.;)
Um... is this still being worked on or is it dead in the water.