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 → C/S cog help
C/S cog help
2001-10-31, 5:17 PM #1
Ok, i've written a cog which should stop the player from taking falling damage from anything without editing kyle.cog(because you cant flag 3do's as no impact damage and i cant edit kyle.cog because it would effect all the other levels in the pack). The problem is, that it worked in SP but not in MP, so i wrote a c/s cog to do it, but that doesnt work, could someone tell me what i'm doing wrong?

Server side cog:
Code:
# Jedi Knight Cog Script
#
# server_nofalldamage.cog
#
# This cog will prevent the player from taking falling damage without editing
# kyle.cog (Server side).
#
# [E3 - 31/10/2001] 
#
#

symbols

thing		player

message		damaged

end

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

code

damaged:

player = GetLocalPlayerThing();

SendTrigger(-1, 18881, 0, 0, 0, 0);

Return;

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

end


Client side cog:
Code:
# Jedi Knight Cog Script
#
# client_nofalldamage.cog
#
# This cog will prevent the player from taking falling damage without editing
# kyle.cog (Client side).
#
# [E3 - 31/10/2001] 
#
#

symbols

thing		player

message		trigger

end

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

code

trigger:

If(GetSourceRef()==18881)
{
player = GetLocalPlayerThing();

if(GetSenderRef() != player) Return;

if(GetParam(1) == 0x1) ReturnEx(0);
}

Return;

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

end



------------------
Generating Electro Vibes™ for the masses on Massassi
Go To: EL3CTROPROSE or DEEPMATRIX or L3CY's Topsites
Boba Jules: You ever read the bible TK-421?
TK-421: No?
Boba Jules: Oh, ok...
*BLAM BLAM BLAM BLAM*
<EL3CTRO> EXCAUSE ME MISTAR CAERV BUT I LIEK MY PHORUMPHS!

[This message has been edited by Electro (edited October 31, 2001).]
Generating Electro Vibes™ for the masses on Massassi
Go To: BiTsToRm Forums or L3CY's Topsites
Boba Jules: You ever read the bible TK-421?
TK-421: No?
Boba Jules: Oh, ok...
*BLAM BLAM BLAM BLAM*
&lt;EL3CTRO&gt; EXCAUSE ME MISTAR CAERV BUT I LIEK MY PHORUMPHS!
2001-10-31, 5:20 PM #2
No, I didn't mean making it a client/server cog. I meant fooling around with mask to make it run correctly.
Capitalization
Commas
Periods
Question Marks
Apostrophes
Confusable Words
Plague Words
2001-10-31, 5:31 PM #3
If it's just for one level, then just edit the walkplayer template, change cog=kyle.cog to something like cog=kylenodamage.cog, edit kyle.cog, save as kylenodamage.cog, and it will only affect that one level.
-Hell Raiser
2001-10-31, 5:51 PM #4
Vader, i havent got a clue about masks, all i found in the cog spects were some hex values..

Hell raiser, i cant do that because the kyle.cog has special programming.

Here is the original cog

Code:
# Jedi Knight Cog Script
#
# nofalldamage.cog
#
# This cog will prevent the player from taking falling damage without editing
# kyle.cog
#
# [E3 - 31/10/2001] 
#
#

symbols

thing		player

message		damaged

end

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

code

damaged:


player = GetLocalPlayerThing();

if(GetSenderRef() != player) Return;

if(GetParam(1) == 0x1) ReturnEx(0);

Return;

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

end


------------------
Generating Electro Vibes™ for the masses on Massassi
Go To: EL3CTROPROSE or DEEPMATRIX or L3CY's Topsites
Boba Jules: You ever read the bible TK-421?
TK-421: No?
Boba Jules: Oh, ok...
*BLAM BLAM BLAM BLAM*
<EL3CTRO> EXCAUSE ME MISTAR CAERV BUT I LIEK MY PHORUMPHS!
Generating Electro Vibes™ for the masses on Massassi
Go To: BiTsToRm Forums or L3CY's Topsites
Boba Jules: You ever read the bible TK-421?
TK-421: No?
Boba Jules: Oh, ok...
*BLAM BLAM BLAM BLAM*
&lt;EL3CTRO&gt; EXCAUSE ME MISTAR CAERV BUT I LIEK MY PHORUMPHS!
2001-10-31, 5:54 PM #5
Just add "flags=0x240" before "symbols" and try that Electro... another option would be to do like Hell Raiser said, and copy kyle.cog (rename it to kylenodamage.cog or similiar) and just change the damaged: part in there. Then change the walkplayer template to use kylenodamage.cog instead of kyle.cog.
2001-11-01, 5:33 AM #6
Well, the kyle.cog im really talking about is arena_client.cog, and i dont think brian would let me have my own version like that. Also, those flags dont work, i have also tried 0x100 too. They don't work. I would really like someone too see if my C/S cog (above) would work because that the only idea i have left, and if it doesnt work, fix it or tell me how to. I might be able to do it in the template but i havent found anything in there yet, and also, putting a surfect 0.0005JKU's above the 3do is not fesable abecause the other 3do's around it will get the problem when a 3do crosses an ajoin.

------------------
Generating Electro Vibes™ for the masses on Massassi
Go To: EL3CTROPROSE or DEEPMATRIX or L3CY's Topsites
Boba Jules: You ever read the bible TK-421?
TK-421: No?
Boba Jules: Oh, ok...
*BLAM BLAM BLAM BLAM*
<EL3CTRO> EXCAUSE ME MISTAR CAERV BUT I LIEK MY PHORUMPHS!
Generating Electro Vibes™ for the masses on Massassi
Go To: BiTsToRm Forums or L3CY's Topsites
Boba Jules: You ever read the bible TK-421?
TK-421: No?
Boba Jules: Oh, ok...
*BLAM BLAM BLAM BLAM*
&lt;EL3CTRO&gt; EXCAUSE ME MISTAR CAERV BUT I LIEK MY PHORUMPHS!
2001-11-01, 5:58 AM #7
The c/s cog won't work with triggers like that b/c damaged: has to return a value (the amount of damage) not trigger:. (ReturnEx() returns a value to the calling function, which would be damaged: in the case of the trigger: function...). I don't see why it shouldn't work personally but I might just be missing something. I'll try messing around with it when I get back home.
2001-11-01, 6:06 AM #8
You might want to try adding your snipit of code to item_sheilds.cog as shown below:

Code:
code

damaged:
      player = GetSenderRef();
      shields = GetInv(player, 60);
      damage = GetParam(0);

      if(GetParam(1) == 0x1)
      {
      ReturnEx(0);
      Return;
      }
// I'd leave rest of this cog code as normal



------------------
- Wisdom is 99% experience, 1% knowledge. -
- Wisdom is 99% experience, 1% knowledge. -
2001-11-01, 7:47 AM #9
Ok, that shields modification didnt work eather... i tried it without putting it in the cog window in jed, and with it in the cog window, both ways didnt work, here's the cog, did i do it right?

Code:
# Jedi Knight Cog Script
#
# ITEM_SHIELDS.COG
#
# ITEM Script - Shields
#  Bin 60
#
# [YB]
#
# (C) 1997 LucasArts Entertainment Co. All Rights Reserved


symbols

thing			player

flex			shields
flex			shieldsLeft
flex			damage
flex			halfdamage
flex			type

sound			hitsnd=KShieldHit01.wav

message		damaged

end

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

code

damaged:

	player = GetSenderRef();
	shields = GetInv(player, 60);
	damage = GetParam(0);
	
	if(GetParam(1) == 0x1)
	{
	ReturnEx(0);
	Return;
	}

	if(shields > 0)
	{
		type = GetParam(1);
		shieldsLeft = shields;
	
		// If damage from energy or fire.
		if((type == 2) || (type == 4))
		{
			AddDynamicTint(player, 0, damage/50, 0);
			PlaySoundThing(hitsnd, player, 1.0, -1, -1, 128);
	
			// Shields do full protection until they are at 50 or less.
			shieldsLeft = shields - damage;
			if(shieldsLeft > 50)
			{
				damage = 0;
			}
			else
				if(shields > 50)
			{
				damage = damage - (shields - 50);
			}
	
			// Scale what damage is left by shields.
			if(damage > 0)
			{
				damage = damage * (1 - shieldsLeft / 50);
			}
	
			// Inventory system will minimize shields at 0.
			SetInv(player, 60, shieldsLeft);
		}

		// If damage from saber.
		if(type == 16)
		{
			AddDynamicTint(player, 0, damage/50, 0);
         PlaySoundThing(hitsnd, player, 1.0, -1, -1, 0);
	
         // Shields do half protection
			halfdamage = damage / 2;
			damage     = halfdamage;
			
			shieldsLeft = shields - damage;
			if(shieldsLeft > 50)
			{
				damage = 0;
			}
			else
				if(shields > 50)
			{
				damage = damage - (shields - 50);
			}
	
			// Scale what damage is left by shields.
			if(damage > 0)
			{
				damage = damage * (1 - shieldsLeft / 50);
			}
	
			// Inventory system will minimize shields at 0.
			SetInv(player, 60, shieldsLeft);

			// add the original half damage back
			damage = damage + halfdamage;
		}
	}

	ReturnEx(damage);
	Return;

end
Generating Electro Vibes™ for the masses on Massassi
Go To: BiTsToRm Forums or L3CY's Topsites
Boba Jules: You ever read the bible TK-421?
TK-421: No?
Boba Jules: Oh, ok...
*BLAM BLAM BLAM BLAM*
&lt;EL3CTRO&gt; EXCAUSE ME MISTAR CAERV BUT I LIEK MY PHORUMPHS!
2001-11-01, 8:58 AM #10
If this is for JKA, why not just flag all your level's floors as "no damage from falls" in JED?

..Or am I missing something?

-TIE
2001-11-01, 9:21 AM #11
OK try this.

I think the 0x1 impact flag refers to a weapon striking, so make it:

Code:
if(GetParam(1) == 64) 
{
ReturnEx(0);
Return;
}


I'd stick with items_shields.cog still, just to minimize the number of cogs that respond to damage messages.

------------------
- Wisdom is 99% experience, 1% knowledge. -
- Wisdom is 99% experience, 1% knowledge. -
2001-11-01, 3:10 PM #12
You don't need the second 'Return' right after 'ReturnEx()'. ReturnEx does the same thing as Return except it returns a value to the calling function (whatever handles the damage in this case).
2001-11-02, 3:20 AM #13
Is that Return; extranous in the cog above?, yes.

But,

If you meant ReturnEx(); also functions as a normal Return; you are incorrect.

Try this:

Code:
damaged:

ReturnEx(0);

Print("Huh? Wasnt the code halted?");

Return;


Go into a game. Hurt yourself. The Text
"Huh? Wasnt the code halted?" will be displayed.

ReturnEx(); does not halt the execution of cog code. The code continues running until it encounters a Return;

BTW: Nice work on the Mortal Kombat Style Camera Cogs.

------------------
- Wisdom is 99% experience, 1% knowledge. -
- Wisdom is 99% experience, 1% knowledge. -
2001-11-02, 7:53 AM #14
YEEEESSSSSSSSS!!!!!!! OHHHHHHHH YEEEEEEESSSSSSSSSSSSS! IT WORKS NOW!!!! THANKYOUTHANKYOUTHANKYOUTHANKYOUTHANKYOUTHANKYOUTHANKYOUTHANKYOUTHANKYOUTHANKYOUTHANKYOUTHANKYOUTHANKYOUTHANKYOUTHANKYOUTHANKYOUTHANKYOUTHANKYOUTHANKYOUTHANKYOUTHANKYOUTHANKYOU
Generating Electro Vibes™ for the masses on Massassi
Go To: BiTsToRm Forums or L3CY's Topsites
Boba Jules: You ever read the bible TK-421?
TK-421: No?
Boba Jules: Oh, ok...
*BLAM BLAM BLAM BLAM*
&lt;EL3CTRO&gt; EXCAUSE ME MISTAR CAERV BUT I LIEK MY PHORUMPHS!
2001-11-02, 10:08 AM #15
CRAPCRAPCRAPCRAPCRAPCRAPCRAPCRAPCRAPCRAPCRAPCRAPCRAPCRAPCRAPCRAPCRAPCRAPCRAPCRAPCRAPCRAPCRAPCRAPCRAPCRAPCRAPCRAPCRAPCRAPCRAPCRAPCRAPCRAPCRAPCRAP

It works when i use kyle.cog, but it doesnt work when i use arena_client.cog!! and i cant post arena_client.cog here cause im not allowed! It seems as though i will never get this working.
Generating Electro Vibes™ for the masses on Massassi
Go To: BiTsToRm Forums or L3CY's Topsites
Boba Jules: You ever read the bible TK-421?
TK-421: No?
Boba Jules: Oh, ok...
*BLAM BLAM BLAM BLAM*
&lt;EL3CTRO&gt; EXCAUSE ME MISTAR CAERV BUT I LIEK MY PHORUMPHS!
2001-11-02, 11:48 AM #16
BUGGER !

Can't you just post little sections of the cog here ?
2001-11-02, 12:31 PM #17
Well, i guess i could if you knew what parts you needed to see, and if they didnt show any arena coding... its a modified kyle.cog so its probably a lot like that...
Generating Electro Vibes™ for the masses on Massassi
Go To: BiTsToRm Forums or L3CY's Topsites
Boba Jules: You ever read the bible TK-421?
TK-421: No?
Boba Jules: Oh, ok...
*BLAM BLAM BLAM BLAM*
&lt;EL3CTRO&gt; EXCAUSE ME MISTAR CAERV BUT I LIEK MY PHORUMPHS!
2001-11-02, 12:52 PM #18
The only things changed in arena_client Electro are from init_kyle on down (and also some variables were added in the symbols section). If you want, I'll make you an arena_client_nofall.cog for your level (I have all the arena cogs b/c I am helping Bri with some things) and you would just change the walkplayer templates in your level to use arena_client_nofall instead of just arena_client.
2001-11-02, 1:23 PM #19
I want to try to get my pack in the level pack for JKA, so i'll talk to brian first, but yeah you could do that.
Generating Electro Vibes™ for the masses on Massassi
Go To: BiTsToRm Forums or L3CY's Topsites
Boba Jules: You ever read the bible TK-421?
TK-421: No?
Boba Jules: Oh, ok...
*BLAM BLAM BLAM BLAM*
&lt;EL3CTRO&gt; EXCAUSE ME MISTAR CAERV BUT I LIEK MY PHORUMPHS!

↑ Up to the top!