Jump to content

Adding Force Fall to Outcast sp


Guest Redemption
Go to solution Solved by Guest Redemption,

Recommended Posts

Guest Redemption

Hi everyone, obviously this can be done for Academy sp with serenity's tutorial, but I'm having difficulty implementing it in Outcast. You see, most of the code for Academy goes under the wall grab segment in pm_addevent but when I put the Force Fall code under pm_addevent in Outcast, it fails compiling. Anyone able/willing to shed light or help me with this?

Link to comment
Guest Redemption

I got 4 errors I'm hoping someone can help me with.

 

 

if (FFDebounce + FORCEFALLDEBOUNCE < pm->cmd.serverTime)
{
if (pm->ps->velocity[2] < FORCEFALLVELOCITY)
{
if ((FORCEFALLVELOCITY - pm->ps->velocity[2]) < ForceFallBrakeRate[pm->ps->forcePowerLevel[FP_LEVITATION]])
{
pm->ps->velocity[2] = FORCEFALLVELOCITY;
}
else
{
pm->ps->velocity[2] += ForceFallBrakeRate[pm->ps->forcePowerLevel[FP_LEVITATION]];
}
}
}

// is it time to reduce the players force power
if (pm->ps->forcePowerDebounce[FP_LEVITATION] < pm->cmd.serverTime)
{// FP_LEVITATION drains force mana only when player
// has an upward velocity, so I used FP_HEAL instead

WP_ForcePowerDrain(pm->gent, FP_HEAL, FM_FORCEFALL + ForceManaModifier);


 
2 of them is "forcefallbreakrate" undeclared identifier.
WP_forcepowerdrain, identifier not found.
Last one is "Intellisense, forcefallbreakrate, undefined.
 
Could someone help me please :)

Link to comment

ForceFallBrakeRate seems to be some variable that controls (surprise) the braking rate of the force power. I think it's a float array, but I'm not sure.

 

Anyway, what file is this in? Whatever it's in, try adding this:

float ForceFallBrakeRate[] = {
   0.9,
   0.8,
   0.7,
   0.6,
   0.5
}
Those values aren't guaranteed and you might need to tweak them.

P.S. this is precisely why I hate copy-paste tutorials like that one, that literally don't explain anything.

Link to comment
Guest Redemption

HAHAHAHHAAHAHAHAHAHAHAHAHAHAHAHAHAHAHAH!!!!!!!!!!!!!!!!!!!!!!!!!!!!!

 

I did it :)

 

There has seem to be a problem with the code. So, what I've had to do is remove the force power drain bit from it and walla, its in, but I still want it to drain mana when used :(

 

Code snipped:

 

// // is it time to reduce the players force power

if (pm->ps->forcePowerDebounce[FP_LEVITATION] < pm->cmd.serverTime)

{// FP_LEVITATION drains force mana only when player 

// has an upward velocity, so I used FP_HEAL instead

WP_ForcePowerDrain(pm->gent, FP_HEAL, FM_FORCEFALL + ForceManaModifier);

 

// removes force power at a rate of 0.1 secs * force jump level

pm->ps->forcePowerDebounce[FP_LEVITATION] = pm->cmd.serverTime + (pm->ps->forcePowerLevel[FP_LEVITATION] * 100);

}

 

 

Link to comment

Well if you add that code back, and change the third argument of WP_ForcePowerDrain, it will work correctly. The third argument should be however much force power you want to drain from the player (FP_HEAL here is ignored).

 

Try this:

 

// // is it time to reduce the players force power
if (pm->ps->forcePowerDebounce[FP_LEVITATION] < pm->cmd.serverTime)
{// FP_LEVITATION drains force mana only when player 
// has an upward velocity, so I used FP_HEAL instead
WP_ForcePowerDrain(pm->gent, FP_HEAL, 1); // Change this 1 to some other number to increase/decrease how much force power gets drained.
 
// removes force power at a rate of 0.1 secs * force jump level
pm->ps->forcePowerDebounce[FP_LEVITATION] = pm->cmd.serverTime + (pm->ps->forcePowerLevel[FP_LEVITATION] * 100);
}
Link to comment
Guest Redemption

Alright pal, thanks again for you're time. I'll give it a shot and get back to you with the result.

 

:( Still gives an error, won't work at all.

Edited by Redemption
Link to comment
Guest Redemption

@@eezstreet - I know that you're not much fond of people blindly figuring things out from trial and error but, at least I got it to work :) I have had a look through you're tutorial of the basics of c/c++, so picking it up step-by-step.

 

 

qboolean PM_InForceFall()
{
int ForceManaModifier = 0;
int FFDebounce = pm->ps->forcePowerDebounce[FP_LEVITATION] - (pm->ps->forcePowerLevel[FP_LEVITATION] * 100);

// can player force fall?
if (PM_CanForceFall())
{
// play special animation when player has the saber or melee
if (pm->ps->weapon == WP_MELEE || pm->ps->weapon == WP_SABER)
{
PM_SetAnim(pm, SETANIM_LEGS, BOTH_FORCEINAIR1, SETANIM_FLAG_OVERRIDE, 150);
}
else
{
PM_SetAnim(pm, SETANIM_LEGS, BOTH_FORCEINAIRBACK1, SETANIM_FLAG_OVERRIDE, 150);
}

// reduce falling velocity to a safe speed at set intervals
//Warning: Dirty Hack ahead!
if (FFDebounce + FORCEFALLDEBOUNCE < pm->cmd.serverTime)
{
if (pm->ps->velocity[2] < FORCEFALLVELOCITY)
{
if ((FORCEFALLVELOCITY - pm->ps->velocity[2]) < ForceFallBrakeRate[pm->ps->forcePowerLevel[FP_LEVITATION]])
{
pm->ps->velocity[2] = FORCEFALLVELOCITY;
WP_ForcePowerDrain(pm->gent, FP_HEAL, FM_FORCEFALL + ForceManaModifier);
pm->ps->forcePowerDebounce[FP_LEVITATION] = pm->cmd.serverTime + (pm->ps->forcePowerLevel[FP_LEVITATION] * 100);
}
else
{
pm->ps->velocity[2] += ForceFallBrakeRate[pm->ps->forcePowerLevel[FP_LEVITATION]];
WP_ForcePowerDrain(pm->gent, FP_HEAL, FM_FORCEFALL + ForceManaModifier);
pm->ps->forcePowerDebounce[FP_LEVITATION] = pm->cmd.serverTime + (pm->ps->forcePowerLevel[FP_LEVITATION] * 100);
}
}
}
return qtrue;
}
// player is not force falling
return qfalse;
}

 

 

But yeah, this was just me reckoning if "I put that in with the velocity check, it might work." It now works accordingly to plan :)

Link to comment

@@eezstreet - I know that you're not much fond of people blindly figuring things out from trial and error but, at least I got it to work :) I have had a look through you're tutorial of the basics of c/c++, so picking it up step-by-step.

 

 

qboolean PM_InForceFall()

{

int ForceManaModifier = 0;

int FFDebounce = pm->ps->forcePowerDebounce[FP_LEVITATION] - (pm->ps->forcePowerLevel[FP_LEVITATION] * 100);

 

// can player force fall?

if (PM_CanForceFall())

{

// play special animation when player has the saber or melee

if (pm->ps->weapon == WP_MELEE || pm->ps->weapon == WP_SABER)

{

PM_SetAnim(pm, SETANIM_LEGS, BOTH_FORCEINAIR1, SETANIM_FLAG_OVERRIDE, 150);

}

else

{

PM_SetAnim(pm, SETANIM_LEGS, BOTH_FORCEINAIRBACK1, SETANIM_FLAG_OVERRIDE, 150);

}

 

// reduce falling velocity to a safe speed at set intervals

//Warning: Dirty Hack ahead!

if (FFDebounce + FORCEFALLDEBOUNCE < pm->cmd.serverTime)

{

if (pm->ps->velocity[2] < FORCEFALLVELOCITY)

{

if ((FORCEFALLVELOCITY - pm->ps->velocity[2]) < ForceFallBrakeRate[pm->ps->forcePowerLevel[FP_LEVITATION]])

{

pm->ps->velocity[2] = FORCEFALLVELOCITY;

WP_ForcePowerDrain(pm->gent, FP_HEAL, FM_FORCEFALL + ForceManaModifier);

pm->ps->forcePowerDebounce[FP_LEVITATION] = pm->cmd.serverTime + (pm->ps->forcePowerLevel[FP_LEVITATION] * 100);

}

else

{

pm->ps->velocity[2] += ForceFallBrakeRate[pm->ps->forcePowerLevel[FP_LEVITATION]];

WP_ForcePowerDrain(pm->gent, FP_HEAL, FM_FORCEFALL + ForceManaModifier);

pm->ps->forcePowerDebounce[FP_LEVITATION] = pm->cmd.serverTime + (pm->ps->forcePowerLevel[FP_LEVITATION] * 100);

}

}

}

return qtrue;

}

// player is not force falling

return qfalse;

}

 

 

 

But yeah, this was just me reckoning if "I put that in with the velocity check, it might work." It now works accordingly to plan :)

I got  alittle question for you redemption, when kyle use force fall by a very high roof and he hurt the land, if the force fall is again active he take damage from falling or not? because in my SP code mod force fall work, but when player touch the land get however damage by the falling (and if i not shield my jedi with force protect before jump and use force fall in pit, he can die on impact with ground) .

Link to comment
Guest Redemption

@@Asgarath83 - At force rank 2 in my mod at the moment, you still do take damage but, at rank 3 there is no damage whatsoever, none at all; even when not even activating the Force Fall power :\ I'm going to have a go at somehow making it so that you still take damage, if you don't activate the power at rank 3, but not tonight... Maybe tomorrow :)

 

@@Circa - Thank you.

Link to comment

@@Asgarath83 - At force rank 2 in my mod at the moment, you still do take damage but, at rank 3 there is no damage whatsoever, none at all; even when not even activating the Force Fall power :\ I'm going to have a go at somehow making it so that you still take damage, if you don't activate the power at rank 3, but not tonight... Maybe tomorrow :)

 

@@Circa - Thank you.

 

Oh thanks! Yes, this can be very helpful. you mean the ranks of Force jump FP_LEVITATION right?  D:

i am pretty curious. i know how to make a rank force power if else function, but i not know how remove damage for this specific case.

i will wait for you :)

Link to comment
Guest Redemption

@@Asgarath83 - Hello, I've not had the pleasure of speaking with you as of yet, but I am appreciative of you're contributions and I am glad you are passionate about adding to these great games :). There seems to be a little confusion; on you're part or that of mine. I added Force Fall via Serenity's tutorial and also looking at OJP's code of it - My effort was tinkering with it so that it would work in Outcast's SP game. If you take a look at his tutorial you will know most of what you need to know.

 

Yes, the ranks of FP_LEVITATION.

I think the level of damage taken, is determined by the velocity, but that's a hunch I've got for the time being.

 

Kind Regards :) 

Link to comment

@@Asgarath83 - Hello, I've not had the pleasure of speaking with you as of yet, but I am appreciative of you're contributions and I am glad you are passionate about adding to these great games :). There seems to be a little confusion; on you're part or that of mine. I added Force Fall via Serenity's tutorial and also looking at OJP's code of it - My effort was tinkering with it so that it would work in Outcast's SP game. If you take a look at his tutorial you will know most of what you need to know.

 

Yes, the ranks of FP_LEVITATION.

I think the level of damage taken, is determined by the velocity, but that's a hunch I've got for the time being.

 

Kind Regards :)

 

well, i have the hobby of modding JKA by 12 years... but i did ever this as self didactic learning with try and error and following some tutorials. basically psykosith tutorial for models and rich diesal for mapping.

only in 2013 i found this beatiful community and my modding skill boosted up. also, learning the basic of coding allow me to really deep change the gameplay. now i can really make the dream of my project: a conversion of JKA for revive the deleted legacy of kain series, i am a big fan of kain and raziel histories.

the unique code issue i get is just some little crash again to fix and the force falling, force falling emulate the vampiric skill of jump of blood omen 2 game. it's identical, so when serenity up that code, i add in the mod immediatly.

but i need again to fix the factor of the damage on the crash land. mmm i will check the things related to damage and the pm_crashland function. maybe the answer is here.

 

for the rest, i have alls for my project: models and code are ready. i need just to make a large amount of visual effects for elemental projectiles and spells and .... Maps... argh, this is my damnation! How can i recreate in 3d nosgoth world with the radiant poly limitation? maps of JKA need to be LOW poly. MD3 helps for building and i am okay for houses and trees etc.

but lands... uff... make terrains on JKA is nasty >.<

i discover a procedure for convert Blood Omen level maps into heightmap and realize 3d terrain but these height map that are the same aspect of nosgoth scturutale lands, but is very long as process...

mmm, maybe another solution is to find MD3 prefab of cliff, montains, hills, gorges, etc etc... o.o

Link to comment
Guest Redemption

@@Asgarath83 - Admiral, I also enjoyed the Legacy of Kain games/story, all the best with you're endeavours :-)

 

That problem about falling damage is perplexing me :- Can anybody assist me with my next idea/attempt at solving this?

The idea is too implement the force fall code like how when you roll before you land it diminishes the damage you take. I've seen the code for this but failed at making the force fall version of it. Next idea is to check the OJP code, any help?

Asgarath83 likes this
Link to comment

@@Asgarath83 - Admiral, I also enjoyed the Legacy of Kain games/story, all the best with you're endeavours :-)

 

That problem about falling damage is perplexing me :- Can anybody assist me with my next idea/attempt at solving this?

The idea is too implement the force fall code like how when you roll before you land it diminishes the damage you take. I've seen the code for this but failed at making the force fall version of it. Next idea is to check the OJP code, any help?

 

maps are the baddest problem. JA map material is too sci - fi for nosgoth ambientation.

awww... interessing idea. reduce after rolling D:

well maybe something like if NPC_setanim blablabla rolling animation

                                             damage \ = 

mmm for reduce damage check into g_combat the code related to hazardtrooper saber resistance. search in g_combat.cpp

MOD_SABER \= 10  and you see an example of damage reduction.

also demp2 code offer an example, but in the opposite sense

 

damage *= 7 ;

 

you can set something like damage \= 3; or MOD_FALLING \= 3 or MOD_IMPACT, i not know what kind of MOD is applied to impact with land.

the problem is not the dmg, is the IF field. because i not know how to make something AFTER an animation. is possible to make during an animation, but after... you need a little more expert help.

Link to comment
Guest Redemption

@@Asgarath83 - Thanks again friend, Its MODCRUSH I believe. Where the code to reduce damage if you roll on landing, there is also a jump statement as well but the roll one would be the one I'm looking at. I'll post the roll code up in a wee while, cause I think you could figure a way to make it work as when in force jumping animation, we reduce falling damage there :-)

Asgarath83 likes this
Link to comment

Well, i am not an expert but i see if there is some suggest i can tell you. by the way, remember : when you not understand the function check the definition when the function is defined

example: problem with G_damage? for understand how work, check void G_damage, or something like that ^^

Link to comment
Guest Redemption

Hello again :) This is the roll code and under it is what I've attempted. Not tried it yet but just uploading so you can see the code.

// FIXME: if duck just as you land, roll and take half damage

if ( (pm->ps->pm_flags&PMF_DUCKED) && (level.time-pm->ps->lastOnGround)>500 )
{//must be crouched and have been inthe air for half a second minimum
if( !PM_InOnGroundAnim( pm->ps ) && !PM_InKnockDown( pm->ps ) )
{//roll!
if ( PM_TryRoll() )
{//absorb some impact
delta /= 2;
}
}
}

if ((pm->ps->pm_flags&PMF_JUMPING) && (level.time - pm->ps->lastOnGround)>500)
{//must be in force fall and have been inthe air for half a second minimum
if (!PM_InForceFall(pm->ps))
{//forcefall!
if (PM_InForceFall())
{//absorb some impact
delta = 0;
}
}
}

 

 

And this is the in force jump code just above the roll code that I'd prefer to implement the damage reduction when using force fall :)

 

 

if ( pm->ps->jumpZStart && (pm->ps->forcePowerLevel[FP_LEVITATION] >= FORCE_LEVEL_1||!pm->ps->clientNum) )
{//we were force-jumping
if ( pm->ps->origin[2] >= pm->ps->jumpZStart )
{//we landed at same height or higher than we landed
if ( pm->ps->forceJumpZStart )
{//we were force-jumping
forceLanding = qtrue;
}
delta = 0;
}
else
{//take off some of it, at least
delta = (pm->ps->jumpZStart-pm->ps->origin[2]);
float dropAllow = forceJumpHeight[pm->ps->forcePowerLevel[FP_LEVITATION]];
if ( dropAllow < 128 )
{//always allow a drop from 128, at least
dropAllow = 128;
}
if ( delta > forceJumpHeight[FORCE_LEVEL_1] )
{//will have to use force jump ability to absorb some of it
forceLanding = qtrue;//absorbed some - just to force the correct animation to play below
}
delta = (delta - dropAllow)/2;
}
if ( delta < 1 )
{
delta = 1;
}
}

 

 

Edit: Scratch that, got an error when compiling, but at least you can see what I'm up to :) 

Link to comment

Hello again :) This is the roll code and under it is what I've attempted. Not tried it yet but just uploading so you can see the code.

// FIXME: if duck just as you land, roll and take half damage

if ( (pm->ps->pm_flags&PMF_DUCKED) && (level.time-pm->ps->lastOnGround)>500 )

{//must be crouched and have been inthe air for half a second minimum

if( !PM_InOnGroundAnim( pm->ps ) && !PM_InKnockDown( pm->ps ) )

{//roll!

if ( PM_TryRoll() )

{//absorb some impact

delta /= 2;

}

}

}

 

if ((pm->ps->pm_flags&PMF_JUMPING) && (level.time - pm->ps->lastOnGround)>500)

{//must be in force fall and have been inthe air for half a second minimum

if (!PM_InForceFall(pm->ps))

{//forcefall!

if (PM_InForceFall())

{//absorb some impact

delta = 0;

}

}

}

 

 

And this is the in force jump code just above the roll code that I'd prefer to implement the damage reduction when using force fall :)

 

 

if ( pm->ps->jumpZStart && (pm->ps->forcePowerLevel[FP_LEVITATION] >= FORCE_LEVEL_1||!pm->ps->clientNum) )

{//we were force-jumping

if ( pm->ps->origin[2] >= pm->ps->jumpZStart )

{//we landed at same height or higher than we landed

if ( pm->ps->forceJumpZStart )

{//we were force-jumping

forceLanding = qtrue;

}

delta = 0;

}

else

{//take off some of it, at least

delta = (pm->ps->jumpZStart-pm->ps->origin[2]);

float dropAllow = forceJumpHeight[pm->ps->forcePowerLevel[FP_LEVITATION]];

if ( dropAllow < 128 )

{//always allow a drop from 128, at least

dropAllow = 128;

}

if ( delta > forceJumpHeight[FORCE_LEVEL_1] )

{//will have to use force jump ability to absorb some of it

forceLanding = qtrue;//absorbed some - just to force the correct animation to play below

}

delta = (delta - dropAllow)/2;

}

if ( delta < 1 )

{

delta = 1;

}

}

 

 

Edit: Scratch that, got an error when compiling, but at least you can see what I'm up to :)

 

well, for what i see seems fine. have you tryied in game? try to force fall by a big cliff, like tatooine cliff of t2_surprise  or the top of t3_hevil tower. or the top of taspir buildings

Link to comment
Guest Redemption

No, I got an error after compiling so I need to figure out what needs to be fixed. It's for Jedi Outcast and I usually just load up pit to test things out :-)

Link to comment
Guest Redemption

Hello again :) Hope all is well with you're worlds. Okay, The force fall tutorial doesn't really work as it should. The part where you add:

 

if (PM_InForceFall()) 

return;

 

... to "static void PM_CrashLand( void )" doesn't nullify fall damage. I think the damage decision for jumping is maybe located here:

if ( pm->ps->pm_flags&PMF_TRIGGER_PUSHED )
	{
		delta = 21;//?
		forceLanding = qtrue;
	}
	else
	{
		if ( pm->gent && pm->gent->NPC && pm->gent->NPC->aiFlags & NPCAI_DIE_ON_IMPACT )
		{//have to do death on impact if we are falling to our death, FIXME: should we avoid any additional damage this func?
			PM_CrashLandDamage( 1000 );
		}

		if (pm->ps->jumpZStart && (pm->ps->forcePowerLevel[FP_LEVITATION] >= FORCE_LEVEL_1 || !pm->ps->clientNum))
		{//we were force-jumping
			if (pm->ps->origin[2] >= pm->ps->jumpZStart)
			{//we landed at same height or higher than we landed
				if (pm->ps->forceJumpZStart)
				{//we were force-jumping
					PM_CrashLandDamage(delta);// was forceLanding = qtrue;
				}
				delta = 0;
			}
			else
			{//take off some of it, at least
				delta = (pm->ps->jumpZStart - pm->ps->origin[2]);
				float dropAllow = forceJumpHeight[pm->ps->forcePowerLevel[FP_LEVITATION]];
				if (dropAllow < 1024)// 128
				{//always allow a drop from 128, at least
					dropAllow = 1024;// 128
				}
				
				if (delta > forceJumpHeight[FORCE_LEVEL_1])
				{//will have to use force jump ability to absorb some of it
					PM_CrashLandDamage(delta);//absorbed some - just to force the correct animation to play below// was forceLanding = qtrue;
				}
				delta = (delta - dropAllow) / 3;
			}
			
			if ( delta < 1 )
			{
				delta = 1;
			}
		}

		if ( !delta )
		{
			delta = PM_CrashLandDelta( pml.previous_velocity, pm->waterlevel );
		}
	}

Now I've messed with this problem since my last posting here. My idea is either (a) add the force fall return code before the jump stuff under PMF_TRIGGER_PUSHED; but don't know how to do it properely due to the else thing-wee-majif being there or (b) this:

if (pm->ps->jumpZStart && (pm->ps->forcePowerLevel[FP_LEVITATION] >= FORCE_LEVEL_1 || !pm->ps->clientNum))
		{//we were force-jumping
			if (pm->ps->origin[2] >= pm->ps->jumpZStart)
			{//we landed at same height or higher than we landed
				if (pm->ps->forceJumpZStart)
				{//we were force-jumping
					PM_CrashLandDamage(delta);// was forceLanding = qtrue;
				}
				delta = 0;
			}

if (pm->ps->jumpZStart && (pm->ps->forcePowerLevel[FP_LEVITATION] >= FORCE_LEVEL_1 || !pm->ps->clientNum))
		{//we were force-jumping
                if (pm->ps->jumpZStart - pm->ps->origin[2])
			delta = (pm->ps->jumpZStart - pm->ps->origin[2]);
				float dropAllow = forceJumpHeight[pm->ps->forcePowerLevel[FP_LEVITATION]];
				if (dropAllow < 1024)// 128
				{//always allow a drop from 128, at least
					dropAllow = 1024;// 128
				}
				
				if (delta > forceJumpHeight[FORCE_LEVEL_1])
				{//will have to use force jump ability to absorb some of it
					PM_CrashLandDamage(delta);//absorbed some - just to force the correct animation to play below// was forceLanding = qtrue;
				}
				delta = (delta - dropAllow) / 3;
			}
			else
                        if (PM_InForceFall())
	                {
		            return;// or put here - forceLanding = qtrue; then delta = 0
	                }


What d'you'se think? Any thoughts/ideas?

Asgarath83 likes this
Link to comment
  • Solution
Guest Redemption

Oh... FFS, I've done it again! HAHAHAHAHAHAHAHAHAHAHAHA!!!!!!!!!!!!!!!!

 

So far, this is what seems to have done the trick :)

if (pm->ps->jumpZStart && (PM_InForceFall()) && (pm->ps->forcePowerLevel[FP_LEVITATION] >= FORCE_LEVEL_1 || !pm->ps->clientNum))
		{//we were force-jumping
			if (pm->ps->origin[2] >= pm->ps->jumpZStart)
			{//we landed at same height or higher than we landed
				if (pm->ps->forceJumpZStart)
				{//we were force-jumping
					PM_CrashLandDamage(delta);// was forceLanding = qtrue;
				}
				delta = 0;
			}

Adding "(PM_InForceFall())" in the if thingy...Argument??? Thank you all who gave me a bit of their time, thank you.

Well I think that I've answered it myself, so how do I go about marking this topic as answered??

 

Edit... Found it  :shifty: 

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