Castle Paradox Forum Index Castle Paradox

 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 
 Gamelist   Review List   Song List   All Journals   Site Stats   Search Gamelist   IRC Chat Room

How can i make an npc use a door?

 
Post new topic   Reply to topic    Castle Paradox Forum Index -> HELP!
View previous topic :: View next topic  
Author Message
potatoe_farmer




Joined: 23 Nov 2007
Posts: 3

PostPosted: Fri Nov 23, 2007 8:37 am    Post subject: How can i make an npc use a door? Reply with quote

I'm attempting to create a two player game with the ohr but, i've run into a problem, i don't know how i can make an npc use a door, or at least appear like it used that door, can anyone help!
Back to top
View user's profile Send private message Send e-mail
Moogle1
Scourge of the Seas
Halloween 2006 Creativity Winner
Halloween 2006 Creativity Winner



Joined: 15 Jul 2004
Posts: 3377
Location: Seattle, WA

PostPosted: Fri Nov 23, 2007 9:41 am    Post subject: Reply with quote

There's the use door plotscript command, but that will really only teleport the hero. I'm not sure exactly what you're trying to do, but there's no way to pass an NPC between maps.
_________________
Back to top
View user's profile Send private message Visit poster's website AIM Address
Newbie_Power




Joined: 04 Sep 2006
Posts: 1762

PostPosted: Fri Nov 23, 2007 3:23 pm    Post subject: Reply with quote

I'm sure there are many ways to *fake* what you're trying to do, like if you want an NPC to go to another map, then you can just re-make the NPC on that particular map then use create npc to place him in front of the hero whenever the hero gets inside the door, then use that particular NPC as player 2.
_________________

TheGiz> Am I the only one who likes to imagine that Elijah Wood's character in Back to the Future 2, the kid at the Wild Gunman machine in the Cafe 80's, is some future descendant of the AVGN?
Back to top
View user's profile Send private message
potatoe_farmer




Joined: 23 Nov 2007
Posts: 3

PostPosted: Sat Nov 24, 2007 4:03 pm    Post subject: npc's and doors Reply with quote

okay, but what if i wanted my hero to use a door, when the npc steps on a door, and the hero must use the same door the npc stepped on.
Back to top
View user's profile Send private message Send e-mail
Moogle1
Scourge of the Seas
Halloween 2006 Creativity Winner
Halloween 2006 Creativity Winner



Joined: 15 Jul 2004
Posts: 3377
Location: Seattle, WA

PostPosted: Sat Nov 24, 2007 4:35 pm    Post subject: Reply with quote

Did you read what I just wrote. I don't want to be rude, but come on.
_________________
Back to top
View user's profile Send private message Visit poster's website AIM Address
msw188




Joined: 02 Jul 2003
Posts: 1041

PostPosted: Sun Nov 25, 2007 4:59 pm    Post subject: Reply with quote

I think you need to explain what you want a little more carefully. If you want the hero to instantly teleport to the other place AS IF he had used the door that the NPC stepped on, then the command 'use door' should be sufficient.

If you want the NPC to sort of use the door (as in, disappear and appear in the other place) and THEN the hero uses the door as if he's following the NPC, then you should probably use the command 'destroy npc' to make the NPC disappear. If you want to make the hero walk to the door, but aren't entirely sure where the player will have been standing, the commands 'walk hero to x' and 'walk hero to y' might be helpful to you.

If you cannot predict beforehand which door the NPC will walk on and use, then you are in a much worse situation. If this is the case, there is a lot more work to be done. Let us know and we will try to help you with it (chances are we will not be using normal map editor doors at all).
_________________
My first completed OHR game, Tales of the New World:
http://castleparadox.com/gamelist-display.php?game=161

This website link is for my funk/rock band, Euphonic Brew:
www.euphonicbrew.com
Back to top
View user's profile Send private message Visit poster's website
potatoe_farmer




Joined: 23 Nov 2007
Posts: 3

PostPosted: Mon Nov 26, 2007 2:44 pm    Post subject: k Reply with quote

My plan is to have 2 "hero's" walking about, exploring maps together. one will be the regular hero, the other will actually be a human controlled NPC.

So far i was able to figure out how control the npc so that when i hit my assigned up key (lets say its W) the npc walked up, when I hit the my assigned left key (lets say its A) it walked left, etc. I was also able to figure out how to make it so that when player to hits a dessignated use key (lets say left shift) it would activate the NPC infront of it, just as if the hero (player 1) had activated it. In other words my NPC can walk and activate/communicate with other NPC's.

My problem is when using doors. If player one steps on a door, he goes to the new map, and player 2 is right their beside him. but if player 2 (the NPC) steps on the door, obviously nothing happens. So what i want to know is if their is a way to make it so that when the NPC steps on the spot where the door is suppose to be that the new map will be brought up. just as if player 1 had stepped on the door. And no unfortunatly i won't be able to predict which door will be used.
Back to top
View user's profile Send private message Send e-mail
TwinHamster
♫ Furious souls, burn eternally! ♫




Joined: 07 Mar 2004
Posts: 1352

PostPosted: Mon Nov 26, 2007 3:05 pm    Post subject: Reply with quote

From what you just said, you can predict where the doors are at, because you'll be placing them yourself.

It seems like all you have to do is have a script check your NPC-Hero's location and map after each of its steps.

Your hero and NPC-Hero should be on the same map, so you can use the command 'current map' to return the map that both players are currently on.

So a script might look like:

Code:
if(current map == #)
then(

if(npcx (0)==5, and, npcy (0) == 6)
then(
teleport to map (6,7,8)
)
)


This would first check to see if your players are even on the same map as the specified door and then it would check to see if your npc-hero's location matched up with the door's location (In this case, it is (5,6)).
If you're on the same map and location as the door, then you will be sent to Map 6, x=7 and y=8.
[/code]
Back to top
View user's profile Send private message Send e-mail AIM Address
msw188




Joined: 02 Jul 2003
Posts: 1041

PostPosted: Mon Nov 26, 2007 6:24 pm    Post subject: Reply with quote

Hmm, I was afraid that this is what you meant. Twinhamster's script is the right idea, but there is no need for a currentmap check. And this will not be an each step script, because the hero is not the one stepping. This block of code will need to go in your keypress script that is moving the NPC like so:

[pseudocode]
#your current movement code
waitfornpc(player)
if(npcx(player)==whatever, and, npcy(player)==whatever),then
begin
teleporttomap(whatever,whatever,whatever)
waitforhero(me)
createnpc(player,relevant coordinates on new map)
end
[/pseudocode]

The main problems will occur if you allow the two players to move at the same time. If they both try to activate two different doors at once, I'm not sure what will be the best way to resolve this problem.
_________________
My first completed OHR game, Tales of the New World:
http://castleparadox.com/gamelist-display.php?game=161

This website link is for my funk/rock band, Euphonic Brew:
www.euphonicbrew.com
Back to top
View user's profile Send private message Visit poster's website
Moogle1
Scourge of the Seas
Halloween 2006 Creativity Winner
Halloween 2006 Creativity Winner



Joined: 15 Jul 2004
Posts: 3377
Location: Seattle, WA

PostPosted: Mon Nov 26, 2007 10:01 pm    Post subject: Reply with quote

Yes, you'll need to check the current map. You don't want to use the ice dungeon's doors when you're in the town.
_________________
Back to top
View user's profile Send private message Visit poster's website AIM Address
msw188




Joined: 02 Jul 2003
Posts: 1041

PostPosted: Tue Nov 27, 2007 7:35 am    Post subject: Reply with quote

I was thinking that this would be a different script on every map. I guess it would just be personal preference how to organize it all, unless there are other problems I am not thinking of right now.
_________________
My first completed OHR game, Tales of the New World:
http://castleparadox.com/gamelist-display.php?game=161

This website link is for my funk/rock band, Euphonic Brew:
www.euphonicbrew.com
Back to top
View user's profile Send private message Visit poster's website
Display posts from previous:   
Post new topic   Reply to topic    Castle Paradox Forum Index -> HELP! All times are GMT - 8 Hours
Page 1 of 1

 
Jump to:  
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