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 → playeraction help
playeraction help
2006-07-04, 5:47 PM #1
Hi. I need some help. I want to make an attack with the saber that checks if the player just jumped and is holding or if easier, just pressed the crouch key. Then a .key will show a nice overhead axe chop :) For a battleaxe in my mots fantasy project...
There is no emotion; there is peace. There is no ignorance; there is knowledge. There is no passion; there is serenity. There is no death; there is the Force

-The Jedi Code
2006-07-07, 4:19 PM #2
Oh please! Can someone at least guide me to some cog verbs? Can't find any
There is no emotion; there is peace. There is no ignorance; there is knowledge. There is no passion; there is serenity. There is no death; there is the Force

-The Jedi Code
2006-07-08, 2:14 AM #3
Ok, on the first look, I do believe this is possible. But I'm dead tired right now.
You'll basically use the playeraction message to find out if the player hits the jump key, then if he does, you'll have a variable change from 0 to 1 and start a timer for however many seconds you want to allow the player between the jump and the crouch. (do they need to fire too?) the timer message will reset the jump variable back to 0.
then you have another check in the playeraction section on whether the player is crouching. it too will set its own variable and timer as well.
finally you'd have a third check in the playeraction section on whether the player has pressed the fire button (and has the saber activated) which will then check if the jump and crouch variables are both true. if they are, then it plays your key.
Sam: "Sir we can't call it 'The Enterprise'"
Jack: "Why not!"
2006-07-08, 3:39 AM #4
Thanks!
Will try, but I still need cog verbs :)
I couldn't find much of it in the JK Specs, DataMaster or CogWriter.
There is no emotion; there is peace. There is no ignorance; there is knowledge. There is no passion; there is serenity. There is no death; there is the Force

-The Jedi Code
2006-07-08, 8:24 AM #5
Obsidian created a playeraction tutorial hosted here on Massassi, try taking a look at that.
_ _ _____________ _ _
Wolf Moon
Cast Your Spell On Me
Beware
The Woods At Night
The Wolf Has Come
2006-07-10, 2:55 PM #6
Just change the variable "jumptimeout" for the amount of time (seconds) the player has to fire from the time they jump. Also change the "axechop" variable to whatever your keyframe is named.
Finally, I didn't put in anything for actually causing damage, it's just the keyframe for now. I want you to test this with your key first to make sure it all works.
This code is untested, so if there's any bugs or if it doesn't work I'll take another look at it.

Code:
# MOTS Cog Script
#
# axechop.cog
#
# This cog checks if the player is jumping while holding the crouch key and attacking with the saber (axe)
#
# 7/10/06
#
# SG-fan
#
# THIS COG IS NOT SUPPORTED BE LEC
# ===============================================
flags=0x240

symbols

message startup
message playeraction
message timer


flex jumptimeout=2	local

int isjumping=0		local
int iscrouching=0	local
int player		local

keyframe axechop=axechop.key	local
end

code
startup:
player=GetLocalPlayerThing();
SetActionCog(GetSelfCog(), 0x7FFFFFFF);

return;

playeraction:

   if (GetParam(0) == 0.0)             // Jump
   {
	if(GetParam(2)==1)
	{
		isjumping=1;
		SetTimerEx(jumptimeout, 1, 0, 0);
	}
   }

   if (GetParam(0) == 1.0)             // Crouch
   {

	if(GetParam(2)==2)
	{
		iscrouching=1;
	}
	else
		iscrouching=0;
   }

   if (GetParam(0) == 3.0)             // Fire
   {
	if(GetCurWeapon(player) == 10 && isjumping==1 && iscrouching==1)
	{
		PlayKey(player, axechop, 3, 0x2);
		// insert attack code here
	}
      ReturnEx(0.0);
   }

return;

timer:
   if (GetSenderID() == 1)
   {
	isjumping=0;
	return;
   }
return;
end
Sam: "Sir we can't call it 'The Enterprise'"
Jack: "Why not!"
2006-07-18, 1:29 AM #7
so... I'm not too good at working without feedback... and I like knowing if my cogs are working or not...
Sam: "Sir we can't call it 'The Enterprise'"
Jack: "Why not!"
2006-07-18, 3:21 PM #8
Sorry. Something happened in my life. That something was GTA:SA :-)
I'm going to test it. Have to write it off the wap phone
There is no emotion; there is peace. There is no ignorance; there is knowledge. There is no passion; there is serenity. There is no death; there is the Force

-The Jedi Code
2006-07-19, 2:14 PM #9
OK. I tried the cog now. It seems like I need to add sleep at the startup to make the cog work at all.
Apparently it can't check if the player crouches mid-air.
A hotkey can replace the crouch in the combo.
But most importantly... It won't perform the attack.
I put the returnex(0.0) inside the brackets to let me use the weapon at all :)
I also set the timer to 4 to test it.
There is no emotion; there is peace. There is no ignorance; there is knowledge. There is no passion; there is serenity. There is no death; there is the Force

-The Jedi Code
2006-07-19, 3:11 PM #10
Originally posted by Dash:
OK. I tried the cog now. It seems like I need to add sleep at the startup to make the cog work at all.

I wasn't sure if the cog needed that or not. I guess it did. The reason for it is that startup is actually called before the objects are loaded in the level.

Quote:
Apparently it can't check if the player crouches mid-air.
A hotkey can replace the crouch in the combo.

If you wanted, I could make the check whether or not the player crouched right before the jump. so he crouches down then jumps and attacks.

Quote:
But most importantly... It won't perform the attack.
I put the returnex(0.0) inside the brackets to let me use the weapon at all :)
I also set the timer to 4 to test it.


uh... whoops. the returnex should have been in the brackets. I managed to disable ALL weapons, didn't I... heh. As for it not doing the attack are you meaning it doesn't play the key? or that it doesn't cause damage? or that it doesn't do anything?

it probably wouldn't do anything right now because of the crouching problem. but if you were asking about causing damage, well it doesn't do that because there's no code for that at the moment...
Sam: "Sir we can't call it 'The Enterprise'"
Jack: "Why not!"
2006-07-19, 3:35 PM #11
I put in print verbs in the cog to test what worked.
That's how I know the attack didn't work.
But wouldn't both crouch and jump be true when I press the fire key?
Because I set the flex to 4, the fire should work when I'm crouching. Or would crouch need a timer as well?
Yes, you can try crouching then jumping.
There is no emotion; there is peace. There is no ignorance; there is knowledge. There is no passion; there is serenity. There is no death; there is the Force

-The Jedi Code
2006-07-19, 3:51 PM #12
ok, I found the error keeping it from firing, I had the getcurweapon check for 10, it should actually be 11.
Sam: "Sir we can't call it 'The Enterprise'"
Jack: "Why not!"
2006-07-19, 4:12 PM #13
ok. now it works. changed it to crouch then jump.
now i need to stop the player while the key plays.
shouldn't be difficult :)
There is no emotion; there is peace. There is no ignorance; there is knowledge. There is no passion; there is serenity. There is no death; there is the Force

-The Jedi Code

↑ Up to the top!