Index | FAQ | Search | Memberlist | Usergroups | Profile | Log in to check your private messages | Log in | Register

Detecting if player is within a func_illusionary

| Inside3d Forums Forum Index -> QuakeC Programming

View previous topic :: View next topic
Author | Message
--- | ---
dayfive Joined: 10 Nov 2006 Posts: 77 |

Posted: Thu May 03, 2007 6:40 am Post subject: Detecting if player is within a func_illusionary |

Hi inside3d, I was thinking that it would be a neat effect to have a sound play while the player is in a func_illusionary brush. Where is the best place to do detection for this ? Could you just add it to misc.c > func_illusionary

Code:
void() func_illusionary = { self.angles = '0 0 0'; self.movetype = MOVETYPE_NONE; self.solid = SOLID_NOT;
setmodel (self, self.model);
makestatic ();
if (other.classname == "player")
{
sound (self, CHAN_BODY, "misc/illusionary", 1, ATTN_NORM);
}
};

or would it be better to put in client.c > PlayerPreThink somewhere ?
What's a good way of detecting whether or not the player is within a func_illusionary brush ? I'd imagine there could be other effects too but for now I'm just interested in playing a sound

Back to top |

FrikaC Site Admin Joined: 08 Oct 2004 Posts: 947 |

Posted: Thu May 03, 2007 7:27 am Post subject: |

First off, this function is the spawn function, so there is no other. Spawn functions are called once upon map load, checking for other here has no effect and it will never be run again. Secondly, the builtin makestatic() removes the entity from the standard dynamic list of entities and moves it to the static list\. The static list is sent once when the players first connect to the server and never send updates, also they are no longer handled by the server in any way shape or form, so they can't have collisions, be found by find, findradius or nextent.
Thirdly, sound's second parameter takes the full name of the wav file, that includes the extension.
The way I would probably do this is to spawn a trigger in the func_illusionary code like func_doors do, or at the least just make the func_illusionary a trigger itself.

Back to top |

Urre Joined: 05 Nov 2004 Posts: 1073 Location: Sweden |

Posted: Thu May 03, 2007 8:08 am Post subject: |

That will however not let you collide with the brush shape, only the max/min bounds of it (effectively a box shape). There's a rather advanced trick you could do, but I don't recommend it. You could make the player move by qc-side traces (best with the tracebox builtin in newer engines), and make the func_illusionary be SOLID_BSP, and every time the players movement trace hits the brush, play the sound, make it non-solid, continue the trace until the end of the move, and make the brush solid again, and repeat every frame. I personally love doing stuff like this (tracing player movement on the qc side) cause of the control it provides. You could also do it without the tracebox builtin by multiple tracelines (seriously not recommended) or the frikbot way of throwing entities in front of you (super tricky, but doable). But considering that you seem fairly new to all of this, I wouldn't recommend any of this. Your best bet is what Frik said, even if it's limited. Just wanted to prove a point, sort of (I love doing that).
_________________
Look out for Twigboy

Back to top |

Display posts from previous:

| Inside3d Forums Forum Index -> QuakeC Programming | All times are GMT
Page 1 of 1

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