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.

ForumsJedi Knight and Mysteries of the Sith Editing Forum → Jump up.
Jump up.
2005-07-19, 8:18 AM #1
Nice to be back. I took a break from editing for a while.
Question: How do I make a jump command so that the longer you hold down the key, you float up. I'm, trying to make a jetpack so if anyone can help please do.
2005-07-19, 8:43 AM #2
I'm not sure, but maybe you could use the PlayerAction Verb in MotS. There's no easy way in JK, though. You might be better off using an item, instead of jump.
"Häb Pfrässe, süsch chlepfts!" - The coolest language in the world (besides Cherokee)
2005-07-19, 9:28 AM #3
You can just use the standard way of making a jetpack that uses the jump key for up as you described. That is, use the fly mode flag on the player: SetPhysicsFlag(player, 0x2000);

:)
2005-07-19, 10:41 AM #4
Yeah, but how do you determine if the jump key was pressed?
"Häb Pfrässe, süsch chlepfts!" - The coolest language in the world (besides Cherokee)
2005-07-19, 1:23 PM #5
if(VectorZ(GetThingThrust(player)) > 0.1) <jumping>

Best used in a pulse message...

It works if you're on the ground... not sure about in the air, but I'd think it'd work at least if you had the fly flag on.
May the mass times acceleration be with you.
2005-07-20, 2:05 AM #6
This way the pack would also activate when the player walked over a mine or something. Or a jumppad. Maybe even when he swam up with force speed.
"Häb Pfrässe, süsch chlepfts!" - The coolest language in the world (besides Cherokee)
2005-07-21, 9:19 AM #7
Wait. It's like jumping, or even close to Force Levitate, but i just want it so that you hold down the jump key and fly up and float. Also, I'm a really crappy cogger so any step by step instructions are 100% welcome.
2005-07-21, 9:52 AM #8
Yeah, we know. The only way to determine if the player is jumping or not (in JK), is to check his upward thrust. This is very inaccurate, though, since you can also have upward thrust while swimming up, or while getting blown in the air from a railcharge that xplodes under your feet.
"Häb Pfrässe, süsch chlepfts!" - The coolest language in the world (besides Cherokee)
2005-07-21, 6:18 PM #9
You could possible use the ApplyForce() command. Although, it only works as long as you hold a hotkey down. For example, something I wrote for a project i'm working on:

# Kyle Switzer
# 25/06/2005
# Cog to create in game jump jets

# [[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[

symbols

int checkflight=0 local
int upforce=0 local

message activated local
message deactivated local
message newplayer local
message pulse local
message startup local

thing player local

end

# ]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]
# [[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[

code

startup:
# determine the player that sent the message, set fuel to full
player = GetLocalPlayerThing();
SetInv(player, 117, 200);

return;

activated:
if (checkflight == 0) {
checkflight = 1;
SetPulse(0.1);
}

Return;

deactivated:
if (checkflight == 1) {
checkflight = 0;
upforce=0;
}

Return;

newplayer:
checkflight = 0;
upforce = 0;

SetInv(player, 117, 200);
SetPulse(0);

Return;

pulse:
if (checkflight == 0) {
# if fuel is full shut off the pulse message
if (GetInv(player, 117) >= 200) {
SetPulse(0);
}
# otherwise begin refilling fuel
else {
ChangeInv(player, 117, 1);
}
}
else {
# if fuel is empty shut off jump jets
if (GetInv(player, 117) <= 0) {
checkflight = 0;
upforce = 0;
}
# otherwise create the jet effects
else {
upforce = ApplyForce(player, '0 0 80');
ChangeInv(player, 117, -5);
}
}

Return;

end

# ]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]

This "pushes" the player up off the ground. Though the player immediately starts to fall and will die when the hotkey is released... Bin 17 has a max value of 200 in case you're wondering, it stores the "fuel" left

**Edit: You're welcome to use this if you want
2005-07-22, 10:42 AM #10
Okay, I'll see if that'll work. In fact, that's just what I wanted. One other little problem. I know how it works but I have a horrible handicap when it comes to implementing Cogs and linking to hotkeys. Could someone help? I just wnat to see so I can learn.
2005-07-23, 4:06 PM #11
Wait. I tried that cog, and had to change the inventory values (117 to 116) for it to work and even then, all I did was shoot up. I cannot float or even fall back down and it doesn't use fuel so I'm stuck up there until I use kill 1 to save me. Any ideas???
2005-07-24, 10:51 AM #12
You can download the Bountyhunt mod and extract it's cogs. One of them simulates a jumppack using batteries as power, iirc.
"Häb Pfrässe, süsch chlepfts!" - The coolest language in the world (besides Cherokee)
2005-07-24, 11:28 AM #13
Great minds think alike. I already did, but couldn't take out just the jetpack part. All the armor and bountyhunt 'you kill me, you're the hunter now' stuff was also written into one cog which was for the yellow key. If I could get those out, I'd use it.
2005-07-24, 12:23 PM #14
Alright, I might write something up, if I got time tomorrow (and don't forget about it).
"Häb Pfrässe, süsch chlepfts!" - The coolest language in the world (besides Cherokee)
2005-07-25, 4:38 PM #15
Actually, I did some jetpack searching and found that the one from ATST v7.0 is the best one. Most jetpacks accelerate you when you move forward, but this one has an extra cog to keep you at a reasonable speed during straight accelerations. Bountyhunt will be fine though. I can't do it myself and beggars can't be choosers.
2005-07-26, 12:16 PM #16
Here's a quick cog to test:
Code:
flags=0x240

symbols

//template	jet_fx=+smoke			local

thing		local_player			local

//sound		jet_sound=crowenginewhine02.wav	local

float		total_thrust=80			local
float		force_delay=0.1			local
float		battery_cost=0.5		local

//float		jet_volume=1			local
//float		jet_minrad=1			local	// Minimum sound distance (~ meters)
//float		jet_maxrad=20			local	// Maximum sound distance (~ meters)

int		active				local
//int		jet_channel			local

message		startup
message		activated
message		deactivated
message		killed

end

code

startup:
	// Get a handle for the local player
	local_player = GetLocalPlayerThing();

	// Make this item available to the local player
	SetInv(local_player, 46, 1);
	SetInvAvailable(local_player, 46, 1);

	// Initialize helper variables
	active = 0;

	Return;

activated:
	// Only handle your own actions
	if(GetSourceRef() != local_player)
		Return;

	if(GetInv(local_player, 13) > 0)
		active = 1;

	while(active)
	{
		DetachThing(local_player);
		ApplyForce(local_player, VectorScale('0 0 1', total_thrust));
		ChangeInv(local_player, 13, -battery_cost);
		if(GetInv(local_player, 13) <= 0)
			call deactivated;
		Sleep(force_delay);
	}

	Return;

deactivated:
	// Only handle your own actions
	if(GetSourceRef() != local_player)
		Return;

	if(active)
	{
		active = 0;
	}

	Return;

killed:
	// Only handle your own actions
	if(GetSourceRef() != local_player)
		Return;

	if(active)
		call deactivated;

	Return;

end

No fx yet. Not sure about MP compatibility.
"Häb Pfrässe, süsch chlepfts!" - The coolest language in the world (besides Cherokee)
2005-07-26, 12:26 PM #17
Hey, while we're here, do you know anyone that could help me make new keys for my walkplayer? Everyone in my other thread was quick to give me programs, but I cna't figure them out. If you can help refer me or spread it around that I need help, feel free to. Oh and thanks for the cog.

↑ Up to the top!