Jump to content

Home

coding the punch to do other stuff to them


Markaine

Recommended Posts

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_FLAG_HOLDLESS);

}

else

{

StandardSetBodyAnim(other, 116, SETANIM_FLAG_OVERRIDE|SETANIM_FLAG_HOLD|SETANIM_FLAG_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 )

Link to comment
Share on other sites

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_FLAG_HOLDLESS);

}

else

{

StandardSetBodyAnim(ent, 130, SETANIM_FLAG_OVERRIDE|SETANIM_FLAG_HOLD|SETANIM_FLAG_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_FLAG_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 );

Link to comment
Share on other sites

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?

Link to comment
Share on other sites

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?

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

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...

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...