Announcement: Be excellent to each other.


Caravel Forum : DROD RPG Boards : RPG Architecture : Monster That Chases the Player (Differently)
New Topic New Poll Post Reply
Poster Message
Niborius
Level: Goblin
Rank Points: 17
Registered: 10-23-2011
IP: Logged
icon Monster That Chases the Player (Differently) (0)  
Hey,

I want to create a monster, that only chases the player when the player is looking at the opposite direction. So if the player looks back at the monster, it just stays still.

Is this going to be possible to make?

Thanks! :thumbsup
02-10-2012 at 05:41 PM
View Profile Send Private Message to User Show all user's posts Quote Reply
skell
Level: Legendary Smitemaster
Avatar
Rank Points: 3734
Registered: 12-28-2004
IP: Logged
icon Re: Monster That Chases the Player (Differently) (0)  
Niborius wrote:
Is this going to be possible to make?
Yes, I am pretty sure that it is possible. Now go on and try to do it! ;)

____________________________
My website | Facebook | Twitter

[Last edited by skell at 02-10-2012 06:14 PM]
02-10-2012 at 06:13 PM
View Profile Send Private Message to User Send Email to User Visit Homepage Show all user's posts High Scores This architect's holds Quote Reply
Niborius
Level: Goblin
Rank Points: 17
Registered: 10-23-2011
IP: Logged
icon Re: Monster That Chases the Player (Differently) (0)  
Really? Awesome.

I've been trying for a while now actually, but really can't figure it out. There isn't any event for that, so how would I do it?

Thanks for your quick reply though!
02-10-2012 at 06:26 PM
View Profile Send Private Message to User Show all user's posts Quote Reply
Chaco
Level: Smitemaster
Rank Points: 3626
Registered: 10-06-2005
IP: Logged
icon Re: Monster That Chases the Player (Differently) (0)  
There's two different parts you'll need in order to script this monster:

The first part is a metric that determines whether the player is to the South of the monster, to the Southeast, to the East, etc. This can be done the same way roaches do it (player is to the South only if he's in the same column and South of the monster) or the same way guards do it (player is to the South only if he's within the 45-degree arc centered about the southern column), which is tougher.

The other part is just to take that direction between the monster and the player, and see if the player is facing that direction or not (for example, if player is to the southeast, test if they are facing southeast or not). If he is facing that direction, the monster moves 1 step towards the player; if not, then the monster stays still.

With that, you should probably be able to do the actual coding work, but post again if you run into any other problems.

____________________________
Quick links to my stuff (in case you forgot where it was):
Click here to view the secret text


[Last edited by Chaco at 02-10-2012 07:12 PM]
02-10-2012 at 07:11 PM
View Profile Send Private Message to User Send Email to User Show all user's posts High Scores This architect's holds Quote Reply
Niborius
Level: Goblin
Rank Points: 17
Registered: 10-23-2011
IP: Logged
icon Re: Monster That Chases the Player (Differently) (0)  
Argh I've been trying and trying, but just cannot even get close to it.

I can partly do it when I design it to use it for a single room, but I need this monster to appear in more rooms.

I think I need to use the guard way, since he must also follow the player when I am not exactly south\north etc of the monster, but like you said, on a 45 degree arc.

I cannot seem to find out how to let the game know if I am south of the monster (and north\east\west)
02-12-2012 at 12:01 PM
View Profile Send Private Message to User Show all user's posts Quote Reply
mxvladi
Level: Smitemaster
Rank Points: 2505
Registered: 02-11-2008
IP: Logged

File: Cowardish monster.drh (1.1 KB)
Downloaded 48 times.
License: Public Domain
icon Re: Monster That Chases the Player (Differently) (0)  
To check the if player's position is to the south/west/east/north of monster, you compare "_X" with "_MyX" vars(and "_Y" with "_MyY"). "_X" and "_Y" - coordinates of player; "_MyX" and "_MyY" - coordinates of NPC.

For example, if player is directly to the south of monster, then _X equals _MyX, and _Y is greater than _MyY.

I've tried to do what I think you want, and the attached hold contains the result(can't say it's very good script, but I made sure it works properly). Basically, if player is to northwest of monster and faces SE, or if player is to the north of monster and faces S, etc, the monster won't chase him, otherwise it will. Once you understand how the scripting works, I think it's pretty easy to tweak it as you prefer.

[Last edited by mxvladi at 02-12-2012 01:10 PM]
02-12-2012 at 01:08 PM
View Profile Send Private Message to User Show all user's posts High Scores This architect's holds Quote Reply
Niborius
Level: Goblin
Rank Points: 17
Registered: 10-23-2011
IP: Logged
icon Re: Monster That Chases the Player (Differently) (0)  
Thanks! That's actually what I meant indeed.

The only thing is that if you walk with your sword pointing at a diagonal angle, you have a better chance the monster won't be chasing after you. If you know what I mean.

But this will do! :)
02-19-2012 at 08:23 AM
View Profile Send Private Message to User Show all user's posts Quote Reply
New Topic New Poll Post Reply
Caravel Forum : DROD RPG Boards : RPG Architecture : Monster That Chases the Player (Differently)
Surf To:


Forum Rules:
Can I post a new topic? No
Can I reply? No
Can I read? Yes
HTML Enabled? No
UBBC Enabled? Yes
Words Filter Enable? No

Contact Us | CaravelGames.com

Powered by: tForum tForumHacks Edition b0.98.8
Originally created by Toan Huynh (Copyright © 2000)
Enhanced by the tForumHacks team and the Caravel team.