Jump to content

More Breaking dual and/or Staff saber script + *(add idle stances)


Recommended Posts

All of this is about singleplayer.

 

Want all staff sabers to be breaking in dual saber stance during a battle and all dual saber stance could be break in one saber stance in combat!

 

 

 

 

*I use Clone wars v6 stance and i was wandering if  there is a way to add or replace idles stances?

Link to comment

You can cut the staffs in half already but there is no code supporting the destruction of a weapon. The staff cutting is very rare, timing is everything, the game didn't have "broken" sabers by default it would make the NPC use 2 stinger (reborn) hilts. I made a file that fixes that but to break a left handed saber some coding would have to be done.

 

Link to comment

You're right, it only breaks the lightsaber if:

1) The .saber ext_data file specifies a "brokensaber" for the saber you hit

AND

2) They're not in a transition animation or in the middle of an attack

AND

3) You hit their lightsaber model

 

If all are true, it's 100%

 

from WP_BreakSaber():

 

if ( !ent->client->ps.saber[0].brokenSaber1 ) 
{//not breakable into another type of saber
     return qfalse;
}
 
if ( PM_SaberInStart( ent->client->ps.saberMove ) //in a start
|| PM_SaberInTransition( ent->client->ps.saberMove ) //in a transition
|| PM_SaberInAttack( ent->client->ps.saberMove ) )//in an attack
{//don't break when in the middle of an attack
     return qfalse;
}
 
if ( Q_stricmpn( "w_", surfName, 2 ) 
&& Q_stricmpn( "saber", surfName, 5 ) //hack because using mod-community made saber
&& Q_stricmp( "cylinder01", surfName ) )//hack because using mod-community made saber
{//didn't hit my weapon
     return qfalse;
}
Link to comment

3) You hit their lightsaber model*

 

Somethink like a kick can do it?

 

 

*It's only  one hit right?...

I know they have already made a script for it!

Can i change the conditions?

Level health for example?

 

It only works with damage from a lightsaber.

 

In G_GetHitLocFromSurfName() inside g_combat.cpp:

 

else if ( mod == MOD_SABER && WP_BreakSaber( ent, surfName, saberType ) )
{//saber hit and broken
*hitLoc = HL_HAND_RT;
}

 

You could change that to ( mod == MOD_SABER || mod == MOD_MELEE ), or add whatever other damage types you want (MOD_ = "method of damage/death").

 

However, I'm not sure our melee damage traces look for specific body parts as that is a more expensive trace to do.  I think our melee traces (like kicks) only check to see if they hit the player/NPC's bounding box, not where on their actual model they hit.  But you could change that if you want.

 

Alternatively, you could fake it.  Detect when someone has been kicked in the front when idling and use a probability to decide if the hit broke their saber (you could do a distance check between the attacker's foot bone and the victim's saber origin).

 

Look in G_KickTrace() inside g_active.cpp.  When it calls G_Damage() in there, you can check to see if you should break their saber, then call WP_BreakSaber and pass in the surfName of the saber (you can just fake the surfName by passing in "saber").

 

BTW, set g_debugMelee to 1 to be able to do an extended set of melee moves any time you want - kicks, punches, grapples and throws.  I think you press the activate/use key and a direction at the same time?

DT85 and Dexter987 like this
Link to comment

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...