How would i go about creating an entity, sort of like a weapon spawn, except the player doesn't pick up the item, that can be placed on a map, and when the player touches the entity, if an impulse is entered, then a function is executed.
Thanks.
Entity that executes a function when touched.
-
DusterdooSmock
- Posts: 170
- Joined: Thu Aug 19, 2010 9:58 pm
Entity that executes a function when touched.
Last edited by DusterdooSmock on Tue Nov 16, 2010 5:58 am, edited 1 time in total.
Re: Entity that executes a function when touched.
like a pickup system..?
i used a traceline with a constant of PLAYER_PICKUP_DISTANCE.
then you can just make a pickup impulse check the trace_ent if its a pickup(i created a field item_type)
if it is.. you run a function or something.
that way you have to be looking at the entity for it to work.
probably slower with a traceline though
i used a traceline with a constant of PLAYER_PICKUP_DISTANCE.
then you can just make a pickup impulse check the trace_ent if its a pickup(i created a field item_type)
if it is.. you run a function or something.
that way you have to be looking at the entity for it to work.
probably slower with a traceline though
-
frag.machine
- Posts: 2126
- Joined: Sat Nov 25, 2006 1:49 pm
Code: Select all
float FOOBAR_IMPULSE = 99;
void () foobar_touch =
{
if (other.impulse == FOOBAR_IMPULSE)
{
// does something
other.impulse = 0;
}
};
void () foobar_trigger =
{
(...)
self.touch = foobar_touch;
(...)
};
I know FrikaC made a cgi-bin version of the quakec interpreter once and wrote part of his website in QuakeC
(LordHavoc)
-
DusterdooSmock
- Posts: 170
- Joined: Thu Aug 19, 2010 9:58 pm
-
frag.machine
- Posts: 2126
- Joined: Sat Nov 25, 2006 1:49 pm
-
Mexicouger
- Posts: 514
- Joined: Sat May 01, 2010 10:12 pm
- Contact:
-
DusterdooSmock
- Posts: 170
- Joined: Thu Aug 19, 2010 9:58 pm
-
DusterdooSmock
- Posts: 170
- Joined: Thu Aug 19, 2010 9:58 pm