 |
Castle Paradox
|
View previous topic :: View next topic |
Author |
Message |
CloudX
Joined: 08 Jan 2004 Posts: 25
|
Posted: Thu Apr 08, 2004 10:34 am Post subject: Help on making plants grow Harvest Moon style. |
|
|
I know everyone thinks i want everything done for me, but right now i need help on making plants grow like in harvest moon. The main part i require help with is making it so that when you have a bag of seeds equiped, that on key press, youll spread seeds all around you. a 3x3 square below you. Ofcourse these would be npcs, but i dont know who to make them appear like that. Any help would be appreciated. |
|
Back to top |
|
 |
*Worthy* Critical Thinker

Joined: 11 Aug 2003 Posts: 186
|
Posted: Thu Apr 08, 2004 1:32 pm Post subject: |
|
|
I would use a maptile, rather than an NPC for that. To do this, simply use the "write map block (x,y,tile#)" command.
I'm sure I only vaguely, if at all, answered your question. If you have another question in specific, let me know.
~Worthy _________________ You can do whatever you want...but prison is full of people who make bad decisions. |
|
Back to top |
|
 |
Bob the Hamster OHRRPGCE Developer

Joined: 22 Feb 2003 Posts: 2526 Location: Hamster Republic (Southern California Enclave)
|
Posted: Fri Apr 09, 2004 2:43 pm Post subject: Re: Help on making plants grow Harvest Moon style. |
|
|
CloudX wrote: | I know everyone thinks i want everything done for me, but right now i need help on making plants grow like in harvest moon. The main part i require help with is making it so that when you have a bag of seeds equiped, that on key press, youll spread seeds all around you. a 3x3 square below you. Ofcourse these would be npcs, but i dont know who to make them appear like that. Any help would be appreciated. |
That sounds like a fun project. here are some pointers.
You can use the "check equipment" command to find out if you have a bag of seeds equipped:
Code: |
script, on key press, begin
if (key is pressed(key:X)) then,begin
if (check equipment(find hero(hero: Farmer Bob),slot:hands)==item:seedbag) then,begin
end
end
end
|
Then you can use the "hero x" and "hero y" commands to find out where you are standing
Code: |
script, on key press, begin
if (key is pressed(key:X)) then,begin
if (check equipment(find hero(hero: Farmer Bob),slot:hands)==item:seedbag) then,begin
variable(x,y)
x:=hero X(me)
y:=hero Y(me)
end
end
end
|
I suggest breaking the seed-placement code into a separate autonumbered script like this:
Code: |
define script(autonumber,drop seed,2,0,0)
define constant(10,seed NPC ID)
script, drop seed, seed X, seed Y, begin
create NPC(seed NPC ID, seed X, seed Y)
end
|
now you can just call this script like a new command from your main script.
Code: |
script, on key press, begin
if (key is pressed(key:X)) then,begin
if (check equipment(find hero(hero: Farmer Bob),slot:hands)==item:seedbag) then,begin
variable(x,y)
x:=hero X(me)
y:=hero Y(me)
drop seed(x--1,y--1)
drop seed(x,y--1)
drop seed(x+1,y--1)
drop seed(x--1,y)
drop seed(x--1,y+1)
drop seed(x,y+1)
drop seed(x+1,y+1)
end
end
end
|
Voila! But maybe you want to use maptiles instead? Just change your "drop seed" script.
Code: |
define script(autonumber,drop seed,2,0,0)
define constant(5,new seed tile)
script, drop seed, seed X, seed Y, begin
write map block(seed X, seed Y, new seed tile)
end
|
or what if you want to get even fancier, and only allow the player to plant seeds on plowed land?
Code: |
define script(autonumber,drop seed,2,0,0)
define constant(2,plowed dirt tile)
define constant(5,new seed tile)
script, drop seed, seed X, seed Y, begin
if(read map block(seed X,seed Y)==plowed dirt tile) then, begin
write map block(seed X, seed Y, new seed tile)
end
end
|
|
|
Back to top |
|
 |
CloudX
Joined: 08 Jan 2004 Posts: 25
|
Posted: Sun Apr 11, 2004 11:59 am Post subject: |
|
|
Thank you so much! You dont know how much that helped! I cant wait to get a working version of this. And maybe i will name the main character Farmer Bob. Thanks again! |
|
Back to top |
|
 |
Ysoft_Entertainment VB Programmer

Joined: 23 Sep 2003 Posts: 810 Location: Wherever There is a good game.
|
Posted: Sun Apr 11, 2004 6:26 pm Post subject: |
|
|
I would have to disagree with worthy on using maptiles there.
While using maptiles is a good idea, however using npcs is WAY better for several reasons
1, is the you can alter the npc stat for when the seed is growing
2, there is 8 graphics frame per npc, so it gives you enough graphics to make the seed grow from seeds to plants in no time at all.
so my advice use the npcs
and set up the counter in your day routine that checks like if 3 days passed, display the new shoots and alter npc so that you won't be able to walk on the seeds anymore.
hope this helps
and James's script is awsome, tried it myself.
although you gonna run into tiny problem. and her is the problem
after each use you gonna have to reequip the bag again.
unless of course you seed supply is infinite. _________________ Try my OHR exporter/importer.
OHRGFX
Striving to become better pixel artist then Fenrir Lunaris. Unfortunately the laziness gets in the way of my goals. |
|
Back to top |
|
 |
TMC On the Verge of Insanity
Joined: 05 Apr 2003 Posts: 3240 Location: Matakana
|
Posted: Sun Apr 11, 2004 11:19 pm Post subject: |
|
|
I also disagree. If you use npcs, you are going to inevitably get a huge number of npcs on map, which will really slow your game down. Also, the problem with using alter npc is that every npc on the map is changed, so you can't plant some seeds and then come back a fe days later and plant more.
Why would you have to re-equip the bag after each use? _________________ "It is so great it is insanely great." |
|
Back to top |
|
 |
Guest
|
Posted: Mon Apr 12, 2004 5:56 am Post subject: |
|
|
well, which is easier to do?
scanning the entire map, and changing the maptiles over and over for the process of growing plants, or just altering npcs?
as for the reequipment of bag, well here is a reason
say the dude got 2 bags of seeds, as far as I know, the dude equipes, the bag, and when the seed is planted, the bag should be gone, right?
so he goes back and equipes the bag again.
thats why.
and in order for the game to dramatically slow down, is to animate the npcs, but if they are stationary, I don't think it will slow down the game. |
|
Back to top |
|
 |
*Worthy* Critical Thinker

Joined: 11 Aug 2003 Posts: 186
|
Posted: Mon Apr 12, 2004 9:32 am Post subject: |
|
|
I would strongly recommend against NPCs. Not only would is slow your game down, but it would take up NPC slots in which you may want to include other things such as other characters in your game or whatever.
You would not have to scan the entire map if you use maptiles. If there are only certain areas where the player can plant stuff, that narrows down what you have to scan. Also, you can store where the player plants stuff in some way (like global variables). There are really a lot of ways to animate maptiles without having to scan the entire map, you just have to think.
Still, you may want to use NPCs. Just remember that when you use "alter NPC," it changes every NPC with that ID number, not just one copy of the NPC, which means you have to use one NPC (out of the 36) for each thing planted.
Let me know how your game progresses,
~Worthy _________________ You can do whatever you want...but prison is full of people who make bad decisions. |
|
Back to top |
|
 |
Ysoft_Entertainment VB Programmer

Joined: 23 Sep 2003 Posts: 810 Location: Wherever There is a good game.
|
Posted: Mon Apr 12, 2004 9:59 am Post subject: |
|
|
ok......
tell me this, how about harvesting part of the game?
in this case npc would be an easy alternative.
the maptiles would be almost imposible to use for that part
but then again, I am a newbie, I will write my own harvest moon game and see if my theory works. _________________ Try my OHR exporter/importer.
OHRGFX
Striving to become better pixel artist then Fenrir Lunaris. Unfortunately the laziness gets in the way of my goals. |
|
Back to top |
|
 |
TMC On the Verge of Insanity
Joined: 05 Apr 2003 Posts: 3240 Location: Matakana
|
Posted: Mon Apr 12, 2004 5:00 pm Post subject: |
|
|
Why would nps be harder at harvesting time?
You simply check the tile in front of the hero, change it to a dirt/cut off stalk tile if its a plant tile, and increment a GV. _________________ "It is so great it is insanely great." |
|
Back to top |
|
 |
junahu Custom Title: 45 character limit

Joined: 13 Jan 2004 Posts: 369 Location: Hull, England
|
Posted: Wed Apr 14, 2004 5:32 am Post subject: |
|
|
...I miss everything don't I.
Go CloudX! Woo! I hope this blows my crappy chicken farm out of the water.
Although I do warn you to be very careful about avoiding script buffer overloads. They're a real hassle.
I say go for maptiles rather than npcs. If you expand to keeping animals then you will really need all the npcs you can get.
Why not plant individual seeds like in the gamecube harvest moon? _________________
 |
|
Back to top |
|
 |
*Worthy* Critical Thinker

Joined: 11 Aug 2003 Posts: 186
|
Posted: Wed Apr 14, 2004 6:19 am Post subject: |
|
|
I agree with what junahu said regarding buffer overflows. If you do use maptiles, stay away from running a cycle every tick scanning the map for planted objects. Since you are going to have a loop continuously running, it would be wise to make that main script very short and call many other scripts inside of it. Also, use "if" statements to minimize the amount of stuff the program checks. For example:
Code: | script,daytime,begin
while (true) do
(
if (hours,mod,6==0) then #checks to see if the time is 6 AM/PM or 12 AM/PM
(
scanmap #calls a script to scan the map and make any plants grow
)
#whatever else you want to happen in the while loop
wait
)
end |
~Worthy _________________ You can do whatever you want...but prison is full of people who make bad decisions. |
|
Back to top |
|
 |
TMC On the Verge of Insanity
Joined: 05 Apr 2003 Posts: 3240 Location: Matakana
|
Posted: Thu Apr 15, 2004 1:35 am Post subject: |
|
|
Well, I don't think that that would be such a good idea because it would run 'scan map' every tick for as long a hours == 6. You'll want to stick that in the code that increments the hours, so it is once run once each time. _________________ "It is so great it is insanely great." |
|
Back to top |
|
 |
Guest
|
Posted: Thu Apr 15, 2004 5:21 am Post subject: |
|
|
That's what I meant by the "#Whatever else you want to happen..." line; include whatever the increment hours coding was. I should have changed the "wait" to "wait (600)" though. Otherwise yes, it would run every tick for a while. My bad...
~Worthy |
|
Back to top |
|
 |
Leonhart

Joined: 25 Feb 2004 Posts: 383 Location: Philippines
|
Posted: Sun Apr 18, 2004 12:29 am Post subject: |
|
|
Now, are you really a guest or is Guest really your name? Care to register? _________________ The man who smiles when things go wrong has thought of someone to blame it on.
- Robert Bloch |
|
Back to top |
|
 |
|
|
You can post new topics in this forum You can reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
Powered by phpBB © 2001, 2005 phpBB Group
|