Hello everybody, I was wondering how I could increase monster's speed once they have low life, I've already added this code (http://www.inside3d.com/qctut/qctut-36.shtml) in order to change the enemy's skin but what I want is to change their speed.
-----------------------------------------------------------
if (self.health < 20) // if helath under 20 - added
{ // - added
self.skin = 1; // make the skin "1" - added
} // - added
----------------------------------------------------------
I'm not sure, but I think that I can add something else in that code in order to change their speed, Does anyone know?
Increasing monster's speed?
-
- Posts: 69
- Joined: Wed Dec 30, 2009 6:29 pm
- Location: peru
- Contact:
-
- InsideQC Staff
- Posts: 1120
- Joined: Sat Oct 16, 2004 3:34 pm
Re: Increasing monster's speed?
That mainly has to do with pain. As is, you can't increase monster speed that way.
Create something like this:
Then create:
Then all you have to do is assign self.monsterthink = monster_think;, set your self.metabolism to 0.1 or less, and place references to self.monsterthink(); in ai_run, ai_run_melee, ai_run_missile, etc.
The bonus you get from doing this is that you can now give your monsters LOTS of fun new things...Like enviromental awareness.
Create something like this:
Code: Select all
.float metabolism;
.void() monsterthink;
Code: Select all
void() monster_think =
{
self.nextthink = time + self.metabolism;
};
The bonus you get from doing this is that you can now give your monsters LOTS of fun new things...Like enviromental awareness.
Re: Increasing monster's speed?
is movement speed based on the monsters animation? maybe he could make a limping animation thats slower? would be cool.
Re: Increasing monster's speed?
Changing .think will make them think faster....they wont move faster, their reaction time will be faster. If you mean physical velocity, try:
Usually when something has low health, they move slower, not faster.
Code: Select all
if (self.health < 20)
self.velocity = self.velocity * 1.5; // 50% faster
Re: Increasing monster's speed?
You could check in t_damage () , there is a float I think .dmg , which holds the last value of damage the target sustained. You could hack into the animaiton frames of either the monster or player so that if the take is 50% of current health value, change the frame to another frame that represents alot of pain being taken...and or make the current .nextthink something like : time + (0.5 + (random () * 0.5)) .... which is a small delay of one half, to one second for example.
Limping might be accomplished a similar way, by adding the delay every walk frame, and moving the pitch angle from about 45 to -45 gradually within the frameset. I have done this with the player model with decent success. Not sure about the monsters.
Limping might be accomplished a similar way, by adding the delay every walk frame, and moving the pitch angle from about 45 to -45 gradually within the frameset. I have done this with the player model with decent success. Not sure about the monsters.
ceriux wrote:is movement speed based on the monsters animation? maybe he could make a limping animation thats slower? would be cool.
-
- Posts: 69
- Joined: Wed Dec 30, 2009 6:29 pm
- Location: peru
- Contact:
Re: Increasing monster's speed?
In fact, I want the enemies to move faster, but already tried this: "self.velocity = self.velocity * 1.5; // 50% faster", but it doesn't work seems to need something else. I wanted the enemie to get angry as the patriarch from killing floor.
hello
Re: Increasing monster's speed?
Hmm, it may have to do with the fact mosters use the walkmove () built-in in their AI. Im not familiar with too much monster AI stuff.
-
- Posts: 2126
- Joined: Sat Nov 25, 2006 1:49 pm
Re: Increasing monster's speed?
Place this in ai.qc, just after ai_run:
Then replace all calls to ai_run(value) in the monster's run code with ai_berserk(value). Be aware though, maps with too many monsters "thinking" too frequently can bog down the engine.
EDIT: for spelling
Code: Select all
void (float v) ai_berserk =
{
if (self.health > 25)
{
ai_run (v);
}
else
{
ai_run (v * 1.5); // adjust to your taste
self.nextthink = time + 0.075; // adjust to your taste
}
};
EDIT: for spelling
I know FrikaC made a cgi-bin version of the quakec interpreter once and wrote part of his website in QuakeC (LordHavoc)
-
- InsideQC Staff
- Posts: 1120
- Joined: Sat Oct 16, 2004 3:34 pm
Re: Increasing monster's speed?
Most monsters don't use self.velocity to move around, which is why speeding up their reaction time (and thus their animation time) will also make them move faster.Cobalt wrote:Changing .think will make them think faster....they wont move faster, their reaction time will be faster.
That above will work, though it's an awful lot of code to replace given how monsters are put together by default...also be careful about setting your movement value too high, otherwise it's gonna look jerky.)frag.machine wrote: Place this in ai.qc, just after ai_run:Then replace all calls to ai_run(value) in the monster's run code with ai_berserk(value). Be aware though, maps with too many monsters "thinking" too frequently can bog down the engine.Code: Select all
void (float v) ai_berserk = { if (self.health > 25) { ai_run (v); } else { ai_run (v * 1.5); // adjust to your taste self.nextthink = time + 0.075; // adjust to your taste } };
EDIT: for spelling
One would think that if a monster MOVES quicker at low health, it would also REACT faster too...but that's just me.