 |
Castle Paradox
|
View previous topic :: View next topic |
Author |
Message |
RedMaverickZero Three pointed, red disaster! Halloween 2006 Creativity Winner


Joined: 12 Jul 2003 Posts: 1459
|
Posted: Mon Jul 28, 2003 3:56 am Post subject: Move on |
|
|
You know how when you make a game you can enable the caterpillar party thing? Well how do you get to make the other people other than the main character move, you know, like seperately? I need this for my game and am completely stumped as to how it would happen! _________________ ---------------Projects----
Mr.Triangle's Maze: 70%
Takoyaki Surprise: 70% |
|
Back to top |
|
 |
Guest
|
Posted: Mon Jul 28, 2003 6:32 pm Post subject: Re: Move on |
|
|
you can make a plotscript that makes the character move where ever you want and you make him an NPC and you make it so you can switch characters and control the rest of your party
you can do all of this in a plotscript
its very easy  |
|
Back to top |
|
 |
Cube Dimensional Traveller

Joined: 02 Feb 2003 Posts: 294
|
Posted: Mon Jul 28, 2003 9:02 pm Post subject: |
|
|
It's just like walking the main hero. Instead of going:
walk hero (me, north, 1)
You'd just specify the hero slot. "me" is just a constant that means the same thing as the number 0.
walk hero (0, north, 1), or
walk hero (1, north, 1), or
walk hero (2, north, 1), or
walk hero (3, north, 1)
So...Yeah, heh. |
|
Back to top |
|
 |
RedMaverickZero Three pointed, red disaster! Halloween 2006 Creativity Winner


Joined: 12 Jul 2003 Posts: 1459
|
Posted: Mon Jul 28, 2003 9:53 pm Post subject: |
|
|
Oh, it's that easy? Dang, I'm suprised I didn't think of that. Thanks a lot. _________________ ---------------Projects----
Mr.Triangle's Maze: 70%
Takoyaki Surprise: 70% |
|
Back to top |
|
 |
planethunter Lost In Emotion

Joined: 07 Jul 2003 Posts: 258 Location: Éire
|
Posted: Mon Jul 28, 2003 11:51 pm Post subject: |
|
|
on the subject of heros and paties. I have a question, how do you make
a script that would make an npc follow you, like the way heros in a catapillar party do. Except with an npc. Thing is, this would be difficult
for each map. And yes this script has a useful purpose.
<just wondering> how would you go about to create fake "ai" for npcs.
I mean, when an npc follows you it gets stuck half the time. Is there any
way you could make them 'smarter' and know when they've reached a
dead end and avoid obstacles?
I know one way: When the npc is "in Range" of a hero you could set the
npc to copy the hero's movements, but it doesn't always work... _________________ ~PH
 |
|
Back to top |
|
 |
TMC On the Verge of Insanity
Joined: 05 Apr 2003 Posts: 3240 Location: Matakana
|
Posted: Tue Jul 29, 2003 12:41 am Post subject: |
|
|
Well, to have an NPC follow after your party, or your main hero, you'll have to record which moves the player makes and then move the npc according to these down the track.
from scancode.hsi:
Code: |
72,key:UP
75,key:LEFT
77,key:RIGHT
80,key:DOWN
|
Use an on keypress script that checks these keys, and moves the NPC according to a previouly stored GV. Then rewrite the GV with which key the player pressed.
As for the AI..... its very hard. _________________ "It is so great it is insanely great." |
|
Back to top |
|
 |
Dark SKell Angel über beer drinker

Joined: 11 Jun 2003 Posts: 45 Location: 9th circle of hell : COM
|
Posted: Tue Jul 29, 2003 3:49 am Post subject: |
|
|
Another way to do this is just by using a simple script
define script(1,FollowMeFriend,0)
script,follow me friend,begin
#This is the one player version of the script
#And make sure you call the script in while tag, so that the NPC follows #you
if(hero direction(me)==up,and,heroy(me)+1<<npcy(1))then(
walk npc(1,up,1)
)
if(hero direction(me)==down,and,heroy(me)--1>>npcy(1))then(
walk npc(1,down,1)
)
if(hero direction(me)==right,and,herox(me)--1>>npcx(1))then(
walk npc(1,right,1)
)
if(hero direction(me)==left,and,herox(mer)+<<npcx(1))then(
walk(1,left,1)
)
end
It didnt try out this script yet though so may have mixed up the directions. :flamedevil: _________________ Yeah, I thought I was dead too.
Old skool RPGexcel member |
|
Back to top |
|
 |
Me HI.

Joined: 30 Mar 2003 Posts: 870 Location: MY CUSTOM TITLE CAME BACK
|
Posted: Tue Jul 29, 2003 7:19 am Post subject: |
|
|
Cube:
You need to include the "disable caterpillar" command in there. Otherwise I don't think it'll work. _________________ UP DOWN UP DOWN LEFT LEFT RIGHT RIGHT A B START |
|
Back to top |
|
 |
Cube Dimensional Traveller

Joined: 02 Feb 2003 Posts: 294
|
Posted: Tue Jul 29, 2003 8:53 am Post subject: |
|
|
No, disable catapillar isn't need. You'd only use that when you didn't want them to follow you while you walked around.
Having a NPC follow behind you ought to be pretty easy. I did this off the top of my head, and was about to post it but then thought I'd better test it. It worked just fine and didn't overload the script buffer either. What I did was create a command that walked the NPC to a specific spot. Pretty simple:
define script (autonumber, walk npc to spot, 3, 0, 0, 0)
script, walk npc to spot, number, x2, y2, begin
walk npc to x (number, x2)
walk npc to y (number, y2)
end
Next, we make a script that will be used in the every step script option for the maps. Mine looked like this:
script, every step, begin
variable (number)
number:=0
if (hero direction (me) == west) then (
walk npc to spot (number, hero x (me)+1, hero y (me))
)
if (hero direction (me) == east) then (
walk npc to spot (number, hero x (me)--1, hero y (me))
)
if (hero direction (me) == north) then (
walk npc to spot (number, hero x (me), hero y (me)+1)
)
if (hero direction (me) == south) then (
walk npc to spot (number, hero x (me), hero y (me)--1)
)
end
And yay, we're done. I have the variable "number" in the "every step" script so that you can change the NPC number easily. |
|
Back to top |
|
 |
TMC On the Verge of Insanity
Joined: 05 Apr 2003 Posts: 3240 Location: Matakana
|
Posted: Tue Jul 29, 2003 11:30 am Post subject: |
|
|
ok, but that script might try to force the npc to walk into a wall if you place the lead hero between 2 obstacles and try to walk into one of them.
Also, all these scripts only work if you want the npc to walk one step behind the hero. If your trying to write a script to make it appear that you have 5 or more heros in your party, your script will look quite different. _________________ "It is so great it is insanely great." |
|
Back to top |
|
 |
Cube Dimensional Traveller

Joined: 02 Feb 2003 Posts: 294
|
Posted: Tue Jul 29, 2003 10:00 pm Post subject: |
|
|
If the NPC is meant to be behind the player at all times, it will never get stuck between 2 obstacles. Plus, because of the way the "move NPC to spot" is made, that shouldn't really happen unless you get WAY ahead of the NPC.
I once made a NPC AI that had it follow the player through a complex maze... It was for a game Squall as making. I'm not sure if he still intends to release or not. If he doesn't, maybe I'll post it to show to you guys.
The script wouldn't be too much different if you wanted more than 1 NPC to follow the hero around. Instead of having hero x (me) in the "move NPC to spot" command, you'd just npc x(0) for example. Not hard, but definately makes the script a bit longer. |
|
Back to top |
|
 |
Pepsi Ranger Reality TV Host

Joined: 05 Feb 2003 Posts: 493 Location: South Florida
|
Posted: Thu Jul 31, 2003 9:06 am Post subject: |
|
|
For anyone interested, there's a plotscript included in the Junkyard Bob's Mission: Impossible .zip file that shows how you can *control* two different heroes separately. It is written out a bit long hand (I don't use arguments either), but hopefully that's okay. If any of you plotscripting geniuses want to shorten it and make it easier to use, be my guest.
But just so you know what you're looking at, the first main script (second in the file) allows you to switch between hero #1 and hero #2 as the "lead" hero (as in one hero stays behind while the other explores, or by pressing the corresponding number on the keypad the first hero will take a break and the alternate hero, wherever he is, will begin exploring--hopefully that makes sense). It also allows the two heroes to join in a "caterpillar" when the "C" key is pressed, and to "split" when the "S" key is pressed. Of course, the caterpillar and split keys only work when the two heroes are standing next to each other.
The second main script (which is third in the plotscript file) is used as an autorun script that keeps track of where the stationary hero is waiting in case the two heroes happen to be walking around in separate maps. Without this the heroes would be waiting in the (0,0) coordinate, which would have a pretty poor outcome for most games.
So, I don't know if any of you would even have a use for it, but I've been wanting to bring it to attention and I think this is the best thread for it.
Let me know if this is helpful (or if the script is confusing).
And the game is unpassworded so the inner workings should make some sense for those who peek inside. _________________ Progress Report:
The Adventures of Powerstick Man: Extended Edition
Currently Updating: General sweep of the game world and dialogue boxes. Adding extended maps.
Tightfloss Maiden
Currently Updating: Chapter 2 |
|
Back to top |
|
 |
Setu_Firestorm Music Composer

Joined: 26 Mar 2003 Posts: 2566 Location: Holiday. FL
|
|
Back to top |
|
 |
planethunter Lost In Emotion

Joined: 07 Jul 2003 Posts: 258 Location: Éire
|
Posted: Fri Aug 01, 2003 1:11 am Post subject: |
|
|
So a two player game would be possible, I assume split screen action
would be waaay out the question though.
Checking the direction and then acting isn't good. The hero could press
the directional keys while against an obstacle, and the npc would start
walking in those directions. You'd want one extra if constant to check
if they're trying to trick the npc.
if (hero direction (me) == north,and,heroiswalking==true) then(
I mentioned this before but has anybody tried 8 directional walking?
You could use the numpad keys: 8,2,4 and 6 for normal ohr controls
and the numpad keys: 7,9,1 and 3 for the diagonal directions.
heck, five on the numpad could even be a run key.
Npc "ai" is hard. To make it anyway realistic you'd want a whole lot
of 'if' statements! The thing is, you'd need to find a way to know when
an npc "bumps" into something and react accordingly... _________________ ~PH
 |
|
Back to top |
|
 |
Cube Dimensional Traveller

Joined: 02 Feb 2003 Posts: 294
|
Posted: Fri Aug 01, 2003 2:26 am Post subject: |
|
|
No, my script is perfect. Study it a little and see how it works exactly.
First of all, you're thinking that it's being called through the "key press" script. The "every step" script works much differently. It will only run if you have moved ONE step. So it will never activate when you press any key, or try to move into a wall.
Plus, even if it WERE called in the every key press script, it wouldn't make much difference (Other than being called more than needed, and cause POSSIBLE slow down). My "walk npc to spot" command walks the NPC to a specific x y coordinate. So, even if the script was activated while the hero was walking into a wall, the NPC wouldn't try to even move because it's ALREADY on the x y coordinate it's supposed to be on (Which is ALWAYS directly behind the hero).
So, it will work no matter what. That is, as long as the NPC is moving as fast as the hero. If the hero is moving at speed 10, and the NPC at 4, the NPC will still follow the hero perfectly but it may get stuck behind stuff. So keep that in mind.
And why yes, I have tried 8 directional walking. Should I post my test file? It's like Chrono Trigger where you aren't limited to just the tile. Making it work in a tile fashion would be even easier, heheh. |
|
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
|