Yup, new year, new topic.
I got the code for the NPCs to supposedly talk, but something is messed up and I get an error syntax and dumped onto the homescreen with 'prgmZGA' listed. It is odd, because this is a BASIC program, not ASM.
I am not 100% sure what is wrong at this very moment, but I will work on it more in the morning.
Edit:
Oh, I am totally the man. XD
I figured out the problem with it not working was my use of expr(. Once removed, I can now get the text for the proper NPCs, however.. I can't seem to get the sprites to display just yet. I think I forgot to add in something, so I am about to go take care of that now.
Edit2:
Next up is working on the 'Event NPCs'.
Basically they are things that are effected by you doing certain things. An example would be Ash's mom. She repeatedly just says you need to gtfo and the prof is looking for you. Once you get your pokemon, she will then be able to heal.
This part is easy to code. It is a matter of 'groups'. Each 'group' is based off the NPC#, And then those check to see if the L_EVEN list element is tripped. From there, it sub(s the string and dumps it back off into Str7 for safe keeping until it is needed.
I also just realized that I can eliminate 2 bytes per NPC string being used for the normal NPCs and 4 or more for the ones that are event related. The event related ones I currently have separated out in to chunks split by the '[' character, but I will end up removing them as I get the ZNPCEV program created.
Hooray for small optimizations XD
event NPCs now work, tho some adjustments to where the text is cropped from still needs to be dealt with.
I have planned to rework the events moving engine, but I am concerned that it will be too slow to do any real good. I may just leave the current system and see if I can't just do some optimizing with it.
Have been writing out new movement code for NPCs to move around the map for events, like when you walk into the grass for the first time.
In doing so, I may have figured out some massive optimizations for the actual NPC walking engine that will speed it up for walking up and down for them.
All I have to do is test the system, but by the looks of the code, it should work flawlessly.
Have been playing around with the optimized code and trying to get it incorporated into the game engine. Getting things to go up took a lot of messing with. But going up works again, going down still messes up, so I am working on that now. You can see a slight decrease in time it takes to make the npcs go up, and the code is a bit smaller, so that's good.
Anyways, just trying to keep updated.
Seems I managed to get the optimized code to work. Means I can finish my post on my forums that gives some insight into adding NPC movement to the RPGSK II. =]
tifreak8x wrote:
Seems I managed to get the optimized code to work. Means I can finish my post on my forums that gives some insight into adding NPC movement to the RPGSK II. =]
Ooh, awesome, I love when progressing development on one project makes another project advance.
Thanks guys. Almost done getting the code posted up, I just kept getting distracted by everything last night XD one of the many things sleep deprivation brings, I guess =p
http://tifreakware.ath.cx/index.php?showtopic=1490&st=0#entry9706804
Well, I have some explanation on how the lists and such should be. You have to keep in mind that this is developed also for the RPGSKII, so you will have to reference its engine (prgmZGA) so some of this other makes sense.
I am not sure if I need to explain any of how the code works, but if I do, please feel free to leave questions there so I know exactly what else I need to add. ^_^ And I ask for them to be there, so it makes it easier for me to keep track. ^_^
Happy to report that the.. hmm, what to call it.. 'self walking engine?' bleh, basically, you feed it a list of directions and it makes the NPC and character move around on the map all by itself.
Basically,
if you happen to remember from Oct 08.
Anyways, it was implemented and tested this morning. Surprisingly, it isn't too horribly slow. I do have a few small issues to work out, mainly that when the npc walks around, he deletes the tiles ahead of him, which is what should happen.. except that he deletes the door. that being the case.. you kind of don't stop and enter oak's lab like you are supposed to, cause the door is gone XD And boy he can move on his own XD
I might have to make a screenshot of it just to show what I mean.
But I have come up with a quick solution and things should work out well enough.
Edit: Screenshot of the problem XD
This shouldn't be too hard to correct, hopefully.
So this is for the NPCs who wander about the map of their own accord, yeah?
No. That needs to be upgraded to not use the list elements as much when recalling the data and for size concerns.
This is for the events, when you first step into the grass, you get drug back to Oak's lab so he can give you a pokemon. Since the 'D' gets overwritten by 'Oak', you go on past without loading to the next bit.
Determined this morning I need to program in 4 more directions, essentially, to fix the error I showed in the screenshot.
As specified before, my problem stems from the fact that the NPCs are part of the map data string, and they replace characters as they are moved around. Since you can only enter doors if there is a 'D' in the map, and they overwrite it, I needed to come up with a way to make the npc disappear like they went inside without overwriting the door and still make the character move.
So now, I have written in a bit of code that replaces the NPC with a space, and moves the character in 1 of 4 directions. This should take care of all problems that I currently have with the system.
I hope. ><
Stupid nspire. <<
Went to fire it up this morning to get back to programming while I waited for a store to open up, and powered up the nspire. Was greeted with the RAM clear screen. I have no idea WHY it did that, as I have done no switching of programs to appvars, or run any other asm program that I haven't been running for a while on it now.
So from my latest backup, which I made the screenshot from, I shall dump onto a cleared out 83+SE and restart from there.
Alright, I have managed to get back to where I was on my 83+SE when the nspire did its random crash. Actually, a little further along. I have now confirmed that the event works all the way to the point where you are told to choose your pokemon, and you are dropped back into the main game engine.
From here, I need to develop a system to keep your character from moving past certain points on the maps that will trigger different events. I have some ideas to go with, Mainly to check and see if an event has been dealt with and make changes to the map list to set a restriction. Might need to have it set a variable as well.
Also giving some consideration to moving the event list to an appvar, with the plus side of being able to read the value from archive, but the problem of needing more code to be able to do that. That could be somewhat countered by creating yet another subprogram that would recall that data, and I would just need to set a variable to tell it which line to look at..
AAAAAHHHH the possibilities x.x
Did some brain storming this morning, and have gotten the start of the new event system getting set up. So far I have the old code that made Oak walk around and stuff copied off to another subprogram, and have come up with a quick way to checking if T=L_BDY(# (BDY for BounDarY) is to do just that:
T=L_BDY
If sum(Ans)=1:Then: code :End
Now sure why I didn't think of this sooner. Anyways, going with that. Had to move the code for the player display around, so I could make sure that you appear first on the screen before it did any form of check for events or attacks. If you notice from one of the previous screenshots, you disappear when the text appears above where you should be. This new setup should eliminate this problem.
Before I can go any further though, I need to play through pokemon on the GB and see what kind of reactions I get when I do certain things so I can get that set up properly before continuing on. ><
And then after that, I do believe I will be ready to make it so you can get your pokemon. =]
So, got some progress done today. As of this moment, I have confirmed that the new system works, it sees you start out in the grass and suck you away to Oak's lab. That means the new get-up works. Now to fully implement it for the other things that need to be done.
Thought I would post up what progress I have now.
Added in the code that should have prevented you from leaving Oak's lab after he drug you there, but it did not. I can force-ably make the program run from the home screen, but I am unable to get it to work from within the game. I will spend a bit more time tomorrow, since it is unlikely I will be cutting firewood this weekend, picking the problem apart.
At this point the problem can only be in one place. And that is in the program that calls the actual events themselves. I most likely just have a wrong value being looked at somewhere.
Bug found. It seems trying to optimize L_EVEN(1)=1 as L_EVEN(1) will not work if you are also trying to do L_EVEN(1)=.5 :p Cause if it is still .5, it is >0, which means that L_EVEN(1) just like that is still true. Now with that fixed, and you not able to leave Oak's lab (going to have to figure out a way to maybe save the current map and such to a save slot when only working with events. If you save and quit, the map resets and you won't get yer pokemon D=
Anyways, that is what I am doing later this evening, making it so you can has your very first pokemans.
And this makes.. what, 8 posts in a row? XD