Inside3D!
     

Friendly monster that follows you
Goto page 1, 2  Next
 
Post new topic   Reply to topic    Inside3d Forums Forum Index -> QuakeC Programming
View previous topic :: View next topic  
Author Message
Freemanoid



Joined: 16 Jun 2008
Posts: 52
Location: BELARUS

PostPosted: Sat May 16, 2009 5:56 pm    Post subject: Friendly monster that follows you Reply with quote

I read tutorial about friendly monster here http://inside3d.com/showtutorial.php?id=180
But I need something else. I need a monster that follows you when you find him. For example, I place him in my map, and when I find him, he must protect me. So what I need to change in code to do something like this? Monster - soldier.
_________________
^O,..,o^
Back to top
View user's profile Send private message Visit poster's website
Wazat



Joined: 15 Oct 2004
Posts: 732
Location: Middle 'o the desert, USA

PostPosted: Sat May 16, 2009 8:32 pm    Post subject: Reply with quote

Sounds like scourge of armagon (which I'm currently running through), except instead of finding a powerup that you pick up to spawn the monster in front of you, you want the monster to spawn in the level and wait until the player gets near it, or it sees him.

A visibility test and distance test ought to be adequate. You'll also want to make sure your monster does nothing but stand or wander randomly until he sees the player; only when the player finds him can he follow. Not sure where in the code to place that though.
_________________
When my computer inevitably explodes and kills me, my cat inherits everything I own. He may be the only one capable of continuing my work.
Back to top
View user's profile Send private message MSN Messenger
Freemanoid



Joined: 16 Jun 2008
Posts: 52
Location: BELARUS

PostPosted: Thu May 21, 2009 7:44 am    Post subject: Reply with quote

So how can I do that? Rolling Eyes
_________________
^O,..,o^
Back to top
View user's profile Send private message Visit poster's website
Madfox



Joined: 15 Jan 2005
Posts: 36
Location: Holland

PostPosted: Fri Jul 17, 2009 11:55 pm    Post subject: Reply with quote

Not sure if I understand what you mean, but

why don't you add a monsterfriend outside your level, give it a teleport function to the place in your level and use a trigger at the place in the level (near the teleport destination for the monsterfriend) to spawn to?

So a small cage with a teleporter and monsterfriend and targetname to call and a target to send.
A teleportdestination with the target where you want to meet it .
And close nearby a trigger_once that calls the teleporter's targetname to spawn the monsterfriend.

You only have the monsterfriend in game on the moment you reach the trigger_once, that can only be used by you, not by other monsters.
Back to top
View user's profile Send private message Visit poster's website
r00k



Joined: 13 Nov 2004
Posts: 483

PostPosted: Sat Jul 18, 2009 5:35 am    Post subject: Reply with quote

*hint: MOVETYPE_FOLLOW Darkplaces, you 'll figure it out.... Very Happy

ok.. u can have a touch function that sets that entity to MOVETYPE_FOLLOW.
Back to top
View user's profile Send private message
Spike



Joined: 05 Nov 2004
Posts: 944
Location: UK

PostPosted: Sat Jul 18, 2009 8:50 am    Post subject: Reply with quote

MOVETYPE_FOLLOW really isn't what he wants...
_________________
What's a signature?
Back to top
View user's profile Send private message Visit poster's website
Error
Inside3D Staff


Joined: 05 Nov 2004
Posts: 558
Location: VA, USA

PostPosted: Sat Jul 18, 2009 9:06 am    Post subject: Reply with quote

MOVETYPE_FOLLOW basically attaches an entity to another with ease. that's all. you could find the cujo bot source.
_________________
Inside3D : Knowledge Is Power
Darkplaces Documentation Wiki
Back to top
View user's profile Send private message Send e-mail Visit poster's website AIM Address Yahoo Messenger MSN Messenger
r00k



Joined: 13 Nov 2004
Posts: 483

PostPosted: Sat Jul 18, 2009 4:50 pm    Post subject: Reply with quote

Ah, ya silly me. Embarassed

Looking at the cujo source they are using movetogoal builtIn.
Back to top
View user's profile Send private message
Freemanoid



Joined: 16 Jun 2008
Posts: 52
Location: BELARUS

PostPosted: Sun Jul 19, 2009 3:50 pm    Post subject: Reply with quote

Ok, look here. For example, I meet a guy in my level. Then I talk to him and he decide to follow me. That's what I want to do.
_________________
^O,..,o^
Back to top
View user's profile Send private message Visit poster's website
r00k



Joined: 13 Nov 2004
Posts: 483

PostPosted: Sun Jul 19, 2009 7:39 pm    Post subject: Reply with quote

well basically,

. the .guy has to run a findradius
. see if you are visible
. determine your direction
. jump?
or
. movetogoal
or
. idle

wash rinse repeat

google "cujo quake", download "Killer Quake Patch" from filefront, decompile the progs with frikdec, search for "cujo" in the source and then investigate from there
Back to top
View user's profile Send private message
Madfox



Joined: 15 Jan 2005
Posts: 36
Location: Holland

PostPosted: Sun Jul 19, 2009 11:54 pm    Post subject: Reply with quote

well, maybe not smart.
but what's wrong with my answer?
Back to top
View user's profile Send private message Visit poster's website
r00k



Joined: 13 Nov 2004
Posts: 483

PostPosted: Mon Jul 20, 2009 3:20 am    Post subject: Reply with quote

He wants to have a "character" standing idle on the map, so that when you walk up to it and touch it, then it will walk around the map where you lead. Not just a single place to teleport to. Just like in counterstrike, how you have to touch the hostage and then they follow you back to the rescue zone.
Back to top
View user's profile Send private message
MeTcHsteekle



Joined: 15 May 2008
Posts: 397
Location: its a secret

PostPosted: Mon Jul 20, 2009 3:50 am    Post subject: Reply with quote

shop smart, shop s-mart.....


YA GOT THAT??!!?!?
_________________
bah
Back to top
View user's profile Send private message AIM Address
MauveBib



Joined: 04 Nov 2004
Posts: 602

PostPosted: Mon Jul 20, 2009 4:06 am    Post subject: Reply with quote

Effectively you need to create an AI with two states, searching and following.

It will begin in the searching state, where every second or so it does a findradius to see if there's a player nearby. If there is it switches to the following state, where it chases after the player.

It's not too hard to code, but if you can't code it based on that breakdown you need to go off and learn so more qc first. Try a few more tutorials, especially the AI Cafe ones.
_________________
Apathy Now!
Back to top
View user's profile Send private message
xaGe



Joined: 01 Mar 2006
Posts: 329
Location: Upstate, New York

PostPosted: Mon Jul 20, 2009 5:12 am    Post subject: Reply with quote

..And for the AI Cafe tutorials you will need to go here:

http://quakewiki.net/archives/aicafe/tutorial/main.htm
Back to top
View user's profile Send private message Send e-mail Visit poster's website MSN Messenger
Display posts from previous:   
Post new topic   Reply to topic    Inside3d Forums Forum Index -> QuakeC Programming All times are GMT
Goto page 1, 2  Next
Page 1 of 2

 
Jump to:  
You cannot post new topics in this forum
You cannot 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 © 2004 phpBB Group