couple of questions
Moderator: InsideQC Admins
9 posts
• Page 1 of 1
couple of questions
Hello everyone. Ineed some help.
1. I want player to be unable to move and take damage. And is ingored by monsters when downed. I tryed to edit clien thing to look like this: (EDIT FIXED)
2. I need to know how to do time triggered function like this:
Function -> time -> new function/effect
thank you allready
1. I want player to be unable to move and take damage. And is ingored by monsters when downed. I tryed to edit clien thing to look like this: (EDIT FIXED)
- Code: Select all
if (self.health > 50)
{
self.takedamage = DAMAGE_AIM;
}
else
{
self.takedamage = DAMAGE_NO;
}
self.solid = SOLID_SLIDEBOX;
if (self.health > 50)
{
self.movetype = MOVETYPE_WALK;
}
else
{
self.movetype = MOVETYPE_NONE;
}
2. I need to know how to do time triggered function like this:
Function -> time -> new function/effect
thank you allready
- Jukki
- Posts: 214
- Joined: Wed Apr 07, 2010 4:59 am
Looks like l4d is the new counter-strike, huh ?
I haven't examined your code in depth, but looks to me you're in the right way. You will need to change ImpulseCommands() to check for player health before processing any attack/weapon change impulse.
I haven't examined your code in depth, but looks to me you're in the right way. You will need to change ImpulseCommands() to check for player health before processing any attack/weapon change impulse.
I know FrikaC made a cgi-bin version of the quakec interpreter once and wrote part of his website in QuakeC
(LordHavoc)
-

frag.machine - Posts: 2090
- Joined: Sat Nov 25, 2006 1:49 pm
In my opinion, you provided too little information for us to help you, without us having to be all-encompassing. We need to know more specifically what you want help with.
"clien thing" and "I need to know how to do time triggered function like this: Function -> time -> new function/effect" are not very specific.
One very typical way to trigger a function at a given time is to use a timer entity.
You would have a function that you want executed at X time. Some where in the code you would create a timer entity to do that.
Inside FunctionYouWantToRun() you'll want to remove the timer entity, to free up the memory it occupies, as it is no longer needed. self will be the timer entity when that function runs. So, somewhere in that function you'll want: remove(self);
Another way to trigger something at a given time is via a function that runs very often, like the player post and pre-think functions. You set a float variable for a given entity with the time you want that entity to do something. And during that fast iterating function somewhere you continuously check whether time has reached the time in that variable.
Check out the code that decides when it's time to take away 666/quad/biosuit effects.
"clien thing" and "I need to know how to do time triggered function like this: Function -> time -> new function/effect" are not very specific.
One very typical way to trigger a function at a given time is to use a timer entity.
You would have a function that you want executed at X time. Some where in the code you would create a timer entity to do that.
- Code: Select all
local entity timer; // pointer to an entity
timer = spawn(); // entity is created; 'timer' now actually points to an entity
timer.nextthink = time + X;
timer.think = FunctionYouWantToRun; // think runs when time (>)= the current time + X
Inside FunctionYouWantToRun() you'll want to remove the timer entity, to free up the memory it occupies, as it is no longer needed. self will be the timer entity when that function runs. So, somewhere in that function you'll want: remove(self);
Another way to trigger something at a given time is via a function that runs very often, like the player post and pre-think functions. You set a float variable for a given entity with the time you want that entity to do something. And during that fast iterating function somewhere you continuously check whether time has reached the time in that variable.
Check out the code that decides when it's time to take away 666/quad/biosuit effects.
Last edited by Pulseczar on Tue May 18, 2010 1:54 pm, edited 1 time in total.
-

Pulseczar - Posts: 37
- Joined: Sat Aug 12, 2006 6:45 pm
frag.machine wrote:Looks like l4d is the new counter-strike, huh ?
I haven't examined your code in depth, but looks to me you're in the right way. You will need to change ImpulseCommands() to check for player health before processing any attack/weapon change impulse.
no. This is not for cs mod. It is for nazi zombies mod. AND i allready got that working
Pulseczar wrote:In my opinion, you provided too little information for us to help you, without us having to be all-encompassing. We need to know more specifically what you want help with.
"clien thing" and "I need to know how to do time triggered function like this: Function -> time -> new function/effect" are not very specific.
One very typical way to trigger a function at a given time is to use a timer entity.
You would have a function that you want executed at X time. Some where in the code you would create a timer entity to do that.
- Code: Select all
local entity timer; // pointer to an entity
timer = spawn(); // entity is created; 'timer' now actually points to an entity
timer.nexthink = time + X;
timer.think = FunctionYouWantToRun; // think runs when time (>)= the current time + X
Another way to trigger something at a given time is via a function that runs very often, like the player post and pre-think functions. You set a float variable for a given entity with the time you want that entity to do something. And during that fast iterating function somewhere you continuously check whether time has reached the time in that variable.
Check out the code that decides when it's time to take away 666/quad/biosuit effects.
oh sory. I meaned that when command is executed it takes (ex.) 5 seconds to start. After 5 secs, command is executed.
- Jukki
- Posts: 214
- Joined: Wed Apr 07, 2010 4:59 am
Jukki wrote:oh sory. I meaned that when command is executed it takes (ex.) 5 seconds to start. After 5 secs, command is executed.
Create a new entity (this isn't always necessary, for reasons I can't explain in a one-liner). Give it nextthink of time + 5, and a think function of what you want it to do. In 5 seconds time, it will happen.
Roaming status: Testing and documentation
-

Lardarse - Posts: 266
- Joined: Sat Nov 05, 2005 1:58 pm
- Location: Bristol, UK
- Code: Select all
entity (void() think_function, float think_time) event =
{
local entity event;
event = spawn ();
event.owner = self;
event.nextthink = (time + think_time);
event.think = think_function;
return (event);
};
local entity toe_jam_football;
if (self.health < 50)
{
self.takedamage = DAMAGE_NO;// never die
self.movetype = MOVETYPE_NONE;
toe_jam_football = event(BakeMeaCake, 5.0);
}
else
{
self.takedamage = DAMAGE_AIM;
self.movetype = MOVETYPE_WALK;
please not that somewhere in the function called (bakemeacake), at the end you need to remove(self); as self has become the toejamfootball entity... and should be destroyed after use.
with a little more info about what your event should be we can customize this...
- r00k
- Posts: 1110
- Joined: Sat Nov 13, 2004 10:39 pm
warning: if an ent is free()d, it can be re-spawn()ed after 2 seconds. This means that if you have timers on entities that can be free()d, you should make your event function tick multiple times before the final trigger, to make sure that its actually affecting the entity its meant to be affecting, and not an entity that was reused for something else.
- Spike
- Posts: 2892
- Joined: Fri Nov 05, 2004 3:12 am
- Location: UK
9 posts
• Page 1 of 1
Who is online
Users browsing this forum: No registered users and 1 guest
