Massassi Forums Logo

This is the static archive of the Massassi Forums. The forums are closed indefinitely. Thanks for all the memories!

You can also download Super Old Archived Message Boards from when Massassi first started.

"View" counts are as of the day the forums were archived, and will no longer increase.

ForumsCog Forum → Force Jump/Levitate Cog
Force Jump/Levitate Cog
2001-04-02, 1:22 PM #1
I'm using the Force Jump/Lev cog from IWP. (I asked for permission, but I haven't gotten a reply)

In IWP, when you use the levitate you rise very quickly. So, I made it so you rise a little over half that. The problem is, if you are falling and you use levitate, when you hit the ground you bounce up and down. That's because of Detachthing(player); And when I take it out, levitate will still work when you hit the ground.

So, could you tell me how to fix that?

------------------
And though your very flesh and blood
..Be what your Eagle eats and Drinks,
You'll praise him for the best of birds,
..Not knowing, what the Eagle thinks. -Cassandra
Author of the JK DataMaster, Parsec, Scribe, and the EditPlus Cog Files.
2001-04-04, 2:40 AM #2
hey i can't realy help u on your cog unless i look at it but u won't be getting a reply, at least i think u won't. He retired from editing way back last year. So either he won't be answering or he will probably say yes.
roses are red, violets are blue, I am schizophrenic, and I am too!
2001-04-04, 11:07 AM #3
Here's the cog,

Code:
#================================================================================================#
# Jedi Knight Cog Script									 
#												 
# FORCE_JUMP.COG										 
#
#[SaberMaster]
#
#This COG is not supported by LEC.
#
#================================================================================================#

symbols

thing       player                           local

template    twinkle_tpl=+force_twinkle       local

vector      upVel                            local
vector      playerVel                        local
vector      newVel                           local

flex        cost1=10.0                       local
flex        cost2=0.7                        local
flex        mana                             local
flex        jump                             local
flex        duration                         local
flex        maxDuration                      local
flex        soundduration                    local

int         twinkle                          local
int         rank                             local
int         attachFlags                      local
int         channel=-1                       local

sound       levitateSound=ForceThrow01.WAV   local
sound       jumpSound=ForceJump01.wav        local
sound       jumpSound2=ForceJump02.wav       local

message     startup
message     activated
message     deactivated
message     pulse
message     newplayer
message     timer
message     killed
message     selected

end

#================================================================================================#

code

startup:

   	player = GetLocalPlayerThing();
   	SetInvActivated(player, 21, 0);
   	soundduration = GetSoundLen(jumpSound);  

   Return;

#................................................................................................#

activated:

   	if(IsInvActivated(player, 21)) Return;

	SetInvActivated(player, 21, 1);
   	mana = GetInv(player, 14);
   	attachFlags = GetAttachFlags(player);

   	if((attachFlags & 1) || (attachFlags & 2) || (GetPhysicsFlags(player) & 0x100000))
   	{
    		if(mana >= cost1)
    		{   
        		channel = PlaySoundThing(jumpSound, player, 1.0, -1, -1, 0x80);
        		ActivateBin(player, 0, 21);
    		}
   	}
   	else
   	{
    		if(mana >= cost2)
    		{
        		PlaySoundThing(levitateSound, player, 1.0, -1, -1, 0x80);
			SetInvActivated(player, 21, 1);
			SetPulse(0.01);
    		}
   	}

   Return;

#................................................................................................#

deactivated:

   	duration = DeactivateBin(player, 21);
   	if(duration < soundduration)
   	{
      		StopSound(channel, 0.1);
      		channel = -1;
   	}

   	rank = GetInv(player, 21);
   	maxDuration = rank * 0.35;

   	// Must be attached to a world surface or thing face or on the surface of water.
   	attachFlags = GetAttachFlags(player);
   	if((attachFlags & 1) || (attachFlags & 2) || (GetPhysicsFlags(player) & 0x100000))
   	{
      		mana = GetInv(player, 14);
      		if(mana >= cost1)
      		{
         		PlaySoundThing(jumpSound2, player, 1.0, -1, -1, 0x80);
     
         		if((GetInv(player, 64) != 1) && (GetInv(player, 65) != 1)) ChangeInv(player, 14, -cost1);

         		// If we tap or hold to max, then do max jump.
         		if((duration < 0.15) || (duration > maxDuration))
            		duration = maxDuration;

         		SetPulse(0.01);
         		SetTimer(1);

         		jump = duration + 2.5;
         		upVel = VectorSet(0.0, 0.0, jump);

         		playerVel = GetThingVel(player);
         		newVel = VectorAdd(upVel, playerVel);
         		DetachThing(player);
         		SetThingVel(player, newVel);

         		ClearPhysicsFlags(player, 0x100000);

         		if(!IsInvActivated(player, 23)) AddDynamicTint(player, 0.0, 0.0, 20.0);
      		}
   	}
   	else
   	{
         	call stop_power;
         	Return;
   	}

   	SetInvActivated(player, 21, 0);

   Return;

#................................................................................................#

pulse:
        if(GetInv(player, 14) < 1)
	{
		call stop_power;
		Return;
	}

   	if((attachFlags & 1) || (attachFlags & 2) || (GetPhysicsFlags(player) & 0x100000))
   	{
		twinkle = FireProjectile(player, twinkle_tpl, -1, -1, '0 0 0', '0 0 0', 1.0, 0, 5, 5);
   	}
   	else
   	{
		twinkle = FireProjectile(player, twinkle_tpl, -1, -1, '0 0 0', '0 0 0', 1.0, 0, 5, 5);
        	if(!IsInvActivated(player, 23)) AddDynamicTint(player, 0.0, 0.0, 20.0);
		DetachThing(player);
		ApplyForce(player,VectorSet(0, 0, 20));
		if((GetInv(player, 64) != 1) && (GetInv(player, 65) != 1)) ChangeInv(player, 14, -cost2);
   	}

   Return;

#................................................................................................#

selected:

   	jkPrintUNIString(player, 21);

   Return;

#................................................................................................#

killed:

   	if(GetSenderRef() != player) Return;
   	call stop_power;

#................................................................................................#

newplayer:

   	call stop_power;

   Return;

#................................................................................................#

timer:

   	if(IsInvActivated(player, 21))
   	{
     		Return;
   	} 
   	else
   	{
     		call stop_power;
   	}

   Return;

#................................................................................................#

stop_power:

	SetInvActivated(player, 21, 0);
	Setpulse(0);
	setactorextraspeed(player, 0);

   Return;

end

#================================================================================================#


It says in the readme of IWP2 that I could use parts of it only with permission from him. I guess it's ok to use it, right?

Please help with the cog. Thanks [http://forums.massassi.net/html/wink.gif]

------------------
And though your very flesh and blood
..Be what your Eagle eats and Drinks,
You'll praise him for the best of birds,
..Not knowing, what the Eagle thinks. -Cassandra
Author of the JK DataMaster, Parsec, Scribe, and the EditPlus Cog Files.
2001-04-10, 10:21 AM #4
[http://forums.massassi.net/html/confused.gif]

------------------
And though your very flesh and blood
..Be what your Eagle eats and Drinks,
You'll praise him for the best of birds,
..Not knowing, what the Eagle thinks. -Cassandra
Author of the JK DataMaster, Parsec, Scribe, and the EditPlus Cog Files.

↑ Up to the top!