Hi all,
I want to add shoving in my mod (like on shrubet), to prevent doorblockers and people like that.
Does someone has the code to make it work.
Hi all,
I want to add shoving in my mod (like on shrubet), to prevent doorblockers and people like that.
Does someone has the code to make it work.
You can push players in stock ET… (OR not? , when I run into the stock ET bot , he will move backwards ,I am not sure that I can push players too…)
Isn’t in stock ET, in mods like shrubet and fortymod it is added.
I would like to add it aswell.
the bot pushing is buggy if you try to use it for clients… the end result will be the client crashing
But i mean pushing players.
Shrubet has got a great feature that makes it possible.
You even can set the distance of the push.
I know what you mean , this curently work only on bots in Stock ET … I will look at that.
ok, thanks a lot, didn’t knew that was already in the source for bots.
Why it causes falling clients?
Is it because bot command other bots , or because other things?
I still haven´t tried that , but allowing that is very simple.
If anyone can post new push part code for noobs (impact detection don´t have any problems I think)
Well it´s falling when you touch switch or other things like that , you can I get it work only for player , what flag should I use?
Edit : !(SVF_NOCLIENT)
Ok , used that , but still tested only on bots , wanna anyone try Way for Victory 0.06?
(sorry for tripple post)
Ok Shadow , this is was done a many days ago , but i have forgotten to share it…
There is a easy option to use bot pushing code , I don´t know if it will fall clients , because there is similar code in revive pushing…(don´t know what that does…)
Ok this is new client impacts (backup old , if there will be problems , cut this…)
(g_active.c)
/*
ClientImpacts // Modifed by JaquboSS , see it!
*/
void ClientImpacts( gentity_t *ent, pmove_t *pm ) {
int i, j;
gentity_t *other;
trace_t trace;memset( &trace, 0, sizeof(trace) );
for (i=0 ; i<pm->numtouch ; i++) {
for (j=0 ; j<i ; j++) {
if (pm->touchents[j] == pm->touchents[i] ) {
break;
}
}
if (j != i) {
continue; // duplicated
}
other = &g_entities[ pm->touchents[i] ];if ( ent->client && ent->touch ) { ent->touch( ent, other, &trace ); } if (other->client) { if (ent->client && other->client) { PushPlayer( ent, other ); } if (ent->client && other->client ) { CheckBotImpacts( ent, other ); } } if ( !other->touch) { continue; } other->touch( other, ent, &trace );}
}
there is also need to do void (g_active.c)
/*
==============
PushPlayer //Based on SD work , just removed bot based things , JaquboSS
==============
*/
void PushPlayer( gentity_t *ent, gentity_t *other ) {
vec3_t dir, ang, f, r;
float oldspeed;
//
oldspeed = VectorLength( other->client->ps.velocity );
if (oldspeed < 200)
oldspeed = 200;
//
VectorSubtract( other->r.currentOrigin, ent->r.currentOrigin, dir );
VectorNormalize( dir );
vectoangles( dir, ang );
AngleVectors( ang, f, r, NULL );
f[2] = 0;
r[2] = 0;
//
VectorMA( other->client->ps.velocity, 200, f, other->client->ps.velocity );
VectorMA( other->client->ps.velocity, 100 * ((level.time+(ent->s.number*1000))%4000 < 2000 ? 1.0 : -1.0), r, other->client->ps.velocity );
//
if (VectorLengthSquared( other->client->ps.velocity ) > SQR(oldspeed)) {
VectorNormalize( other->client->ps.velocity );
VectorScale( other->client->ps.velocity, oldspeed, other->client->ps.velocity );
}
}
g_func_desc.h need
extern void PushPlayer ( gentity_t * ent , gentity_t * other ) ;
g_funcs.h
{"PushPlayer", (byte *)PushPlayer},
Thats all , maybe it will be unstable or not working , I have not testet it…
Problem was in falling when touched not-clients…(Flags , switches …)
But I couldn´t delete it from code (you need to touch flags)
So I have made this code…
Maybe there is much more better ways , so You can try them …
Jaquboss, thanks a lot, tested it today, and it works fine.
It is stable and the game doesn’t crash.
Thanks for testing, so problem was only with old code pushed bots , and don´t resolved clients or just active things (levers , triggers …)
also you can play with this part to get cvar controlled distances and etc…
VectorMA( other->client->ps.velocity, 200, f, other->client->ps.velocity );
VectorMA( other->client->ps.velocity, 100 * ((level.time+(ent->s.number*1000))%4000 < 2000 ? 1.0 : -1.0), r, other->client->ps.velocity );
I used the pushbot code and did a trace in Cmd_Activate_f and if client found I runned the pushbot from there since it didn’t have any bots anyway. Though there’s no idea to post code since it does more than just pushing, I used it for “tackles” in the Domination mod.
Ah sorry, no you don’t need to do so, these files were supposed to be used for saving game, but it was never enabled in ET, also there was program extractfunc for doing these files automaticly
But how should my code be then?
where do i have to put the code from func & func_des??