Forum

Friendly monster that follows you

Discuss programming in the QuakeC language.

Moderator: InsideQC Admins

Friendly monster that follows you

Postby Freemanoid » Sat May 16, 2009 5:56 pm

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^
Freemanoid
 
Posts: 52
Joined: Mon Jun 16, 2008 11:25 am
Location: BELARUS

Postby Wazat » Sat May 16, 2009 8:32 pm

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.
Wazat
 
Posts: 771
Joined: Fri Oct 15, 2004 9:50 pm
Location: Middle 'o the desert, USA

Postby Freemanoid » Thu May 21, 2009 7:44 am

So how can I do that? :roll:
^O,..,o^
Freemanoid
 
Posts: 52
Joined: Mon Jun 16, 2008 11:25 am
Location: BELARUS

Postby Madfox » Fri Jul 17, 2009 11:55 pm

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.
User avatar
Madfox
 
Posts: 106
Joined: Sat Jan 15, 2005 3:13 pm
Location: Holland

Postby r00k » Sat Jul 18, 2009 5:35 am

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

ok.. u can have a touch function that sets that entity to MOVETYPE_FOLLOW.
r00k
 
Posts: 1110
Joined: Sat Nov 13, 2004 10:39 pm

Postby Spike » Sat Jul 18, 2009 8:50 am

MOVETYPE_FOLLOW really isn't what he wants...
Spike
 
Posts: 2892
Joined: Fri Nov 05, 2004 3:12 am
Location: UK

Postby Error » Sat Jul 18, 2009 9:06 am

MOVETYPE_FOLLOW basically attaches an entity to another with ease. that's all. you could find the cujo bot source.
User avatar
Error
InsideQC Staff
 
Posts: 865
Joined: Fri Nov 05, 2004 5:15 am
Location: VA, USA

Postby r00k » Sat Jul 18, 2009 4:50 pm

Ah, ya silly me. :oops:

Looking at the cujo source they are using movetogoal builtIn.
r00k
 
Posts: 1110
Joined: Sat Nov 13, 2004 10:39 pm

Postby Freemanoid » Sun Jul 19, 2009 3:50 pm

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^
Freemanoid
 
Posts: 52
Joined: Mon Jun 16, 2008 11:25 am
Location: BELARUS

Postby r00k » Sun Jul 19, 2009 7:39 pm

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
r00k
 
Posts: 1110
Joined: Sat Nov 13, 2004 10:39 pm

Postby Madfox » Sun Jul 19, 2009 11:54 pm

well, maybe not smart.
but what's wrong with my answer?
User avatar
Madfox
 
Posts: 106
Joined: Sat Jan 15, 2005 3:13 pm
Location: Holland

Postby r00k » Mon Jul 20, 2009 3:20 am

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.
r00k
 
Posts: 1110
Joined: Sat Nov 13, 2004 10:39 pm

Postby MeTcHsteekle » Mon Jul 20, 2009 3:50 am

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


YA GOT THAT??!!?!?
bah
MeTcHsteekle
 
Posts: 399
Joined: Thu May 15, 2008 10:46 pm
Location: its a secret

Postby MauveBib » Mon Jul 20, 2009 4:06 am

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!
User avatar
MauveBib
 
Posts: 634
Joined: Thu Nov 04, 2004 1:22 am

Postby xaGe » Mon Jul 20, 2009 5:12 am

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

http://quakewiki.net/archives/aicafe/tutorial/main.htm
User avatar
xaGe
 
Posts: 461
Joined: Wed Mar 01, 2006 8:29 am
Location: Upstate, New York

Next

Return to QuakeC Programming

Who is online

Users browsing this forum: No registered users and 1 guest