PDA

View Full Version : coding the punch to do other stuff to them


Markaine
03-07-2003, 08:53 AM
I'm trying to get the "other" guy to do a certain animation after I punch him. I can't get it to work. I know I can't make him do anything because certain animations need the player in a certain state right? I needed it to be random so I tried:

if (other && other->inuse && other->client)
{
if (Q_irand(0,2))
{
// 668 is to make him barf or what ever I want the "other" to do
StandardSetBodyAnim(other, 668, SETANIM_FLAG_OVERRIDE|SETANIM_FLAG_HOLD|SETANIM_FL AG_HOLDLESS);
}
else
{
StandardSetBodyAnim(other, 116, SETANIM_FLAG_OVERRIDE|SETANIM_FLAG_HOLD|SETANIM_FL AG_HOLDLESS);
other->client->ps.saberMove = LS_NONE;
other->client->ps.saberBlocked = 0;
other->client->ps.saberBlocking = 0;
G_Damage( other, ent, ent, NULL, NULL, Q_irand(1,5), 0, MOD_MELEE )

Wudan
03-08-2003, 12:38 PM
What file is this in? What function?

Markaine
03-10-2003, 10:59 AM
Its in g_cmds.c. Its from a mod.

razorace
03-10-2003, 02:38 PM
That's still not helping. Under what function? And why is it in g_cmd.c?

Markaine
03-10-2003, 03:23 PM
I don't really know what you mean by function but, I'll try...
It's one of the emotes in Jedimod/Omnimod. I still don't understand what the "116" means either. Sorry but my computer is acting strange (can't make it look neater) here's the original code:

if (mod_emotes.integer && (mod_lockemotes.integer || ent->client->ps.saberLockTime < level.time ))
{
if (Q_stricmp(cmd, "punch") == 0 && mod_boxing.integer && ent->client->ps.pm_type != PM_SPECTATOR && ent->client->ps.pm_type != PM_DEAD )
{
trace_t tr;
vec3_t fPos;
knownCmd = qtrue;

if ((ent->client->ps.legsAnim&~ANIM_TOGGLEBIT) != 116 &&
(ent->client->ps.legsAnim&~ANIM_TOGGLEBIT) != 131 &&
(ent->client->ps.legsAnim&~ANIM_TOGGLEBIT) != 130)
{

if (Q_irand(0,2))
{
StandardSetBodyAnim(ent, 131, SETANIM_FLAG_OVERRIDE|SETANIM_FLAG_HOLD|SETANIM_FL AG_HOLDLESS);
}
else
{
StandardSetBodyAnim(ent, 130, SETANIM_FLAG_OVERRIDE|SETANIM_FLAG_HOLD|SETANIM_FL AG_HOLDLESS);
}
ent->client->ps.saberMove = LS_NONE;
ent->client->ps.saberBlocked = 0;
ent->client->ps.saberBlocking = 0;

AngleVectors(ent->client->ps.viewangles, fPos, 0, 0);

fPos[0] = ent->client->ps.origin[0] + fPos[0]*40;
fPos[1] = ent->client->ps.origin[1] + fPos[1]*40;
fPos[2] = ent->client->ps.origin[2] + fPos[2]*40;

trap_Trace(&tr, ent->client->ps.origin, 0, 0, fPos, ent->s.number, ent->clipmask);

if (tr.entityNum < MAX_CLIENTS && tr.entityNum != ent->s.number)
{
gentity_t *other = &g_entities[tr.entityNum];

if (other && other->inuse && other->client)
{
StandardSetBodyAnim(other, 116, SETANIM_FLAG_OVERRIDE|SETANIM_FLAG_HOLD|SETANIM_FL AG_HOLDLESS);
other->client->ps.saberMove = LS_NONE;
other->client->ps.saberBlocked = 0;
other->client->ps.saberBlocking = 0;
G_Damage( other, ent, ent, NULL, NULL, Q_irand(1,5), 0, MOD_MELEE );

Markaine
03-11-2003, 10:05 AM
I guess that didn't help either?

Wudan
03-11-2003, 12:18 PM
Well, it would probably be better to get rid of that structure entirely.

I haven't worked with the JediMod code AT ALL, so I'm of very little use to you. I replaced the Stun Baton with Fists, that was pretty cool, if I were to make the punch do additional things, I'd make some cool changes in g_combat.c, probably. Your punch ... does it actually hurt people?

Markaine
03-11-2003, 06:22 PM
Yeah, they do damage.
The plus side of it (in my opinion) is that you don't have to switch weapons.

I've always wanted to kick or sucker punch someone in a Saber fight....Like the movies and such.

When I punch them it breaks their attack in mid swing too. I think thats the "116".

What I want to do now is randomly cause the other guy to do a certain animation.
Maybe fall down or something... But I can't seem to make them do anything else.
Lets say I want to force another player to "do something", what are some of the animations I could use? Like some animations won't play unless "whatever". Dam i have no Idea how to put it...

BTW, what happen to the NRG forums? Still down?

razorace
03-11-2003, 06:23 PM
It looks like his current format is to make punch a damaging emot.

Markaine
03-11-2003, 06:27 PM
On the nose...
Punch, Kick, and maybe one more emote in the g_cmd.c have damage coding.

razorace
03-11-2003, 06:36 PM
Originally posted by Markaine
When I punch them it breaks their attack in mid swing too. I think thats the "116".

One of the punch animations stops mid punch. It's a bug with the animation.

What I want to do now is randomly cause the other guy to do a certain animation.
Maybe fall down or something... But I can't seem to make them do anything else.
Lets say I want to force another player to "do something", what are some of the animations I could use? Like some animations won't play unless "whatever". Dam i have no Idea how to put it...

Use Modview to determine which animations you want. Check out http://66.227.96.58/showthread.php?s=&threadid=76081 for some good information on how to do animations.


BTW, what happen to the NRG forums? Still down?
As far as I know. They went over their bandwidth limit.

Markaine
03-11-2003, 06:42 PM
Dam, I like those forums too. Never posted anything though.

I think I going to have to find another way to "force the other's animation. I tried a few animations already, so it must be my bad coding. Thanks for the link, heading there now...