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 → Endurance
Endurance
2001-04-13, 3:31 AM #1
hey i need some way to make something like endurance. I just couldn't think of a waY. I need the cog to decrease the damage a player takes until it has worn off. I now how to make it "wear off" but i don't now how to make the damage less without increasing sheilds. So some help please?
roses are red, violets are blue, I am schizophrenic, and I am too!
2001-04-13, 3:44 AM #2
I'm assuming you have an endurance cog set up (for the fading and everything), but what you'd want to do is use CaptureThing(player) to capture the players messages, then put a damaged message in your cog, and have it use ReturnEx(0.x) where x is the amount you want it to use. And in the part where it wears off, simply put ReleaseThing(player). That should all work.

------------------
LordVirus: His pot is blacker than his kettle!

Visit Virus Productions!
"And lo, let us open up into the holy book of Proxy2..." -genk
His pot is blacker than his kettle!
2001-04-13, 4:23 AM #3
okay i think i get what u mean so it captures the damaged message and then i use a different amount of damage to the player and then i release him and he only gets the amount of damage i want and then i release the player. right? this might work but i am not too sure i will have to play around a bit with it because i want is endurance to last for lets say 30 seconds so i would need a way to capture him each atime he was damaged.
roses are red, violets are blue, I am schizophrenic, and I am too!
2001-04-13, 7:07 AM #4
Actually, CaptureThing() Captures until it is told to stop with ReleaseThing.

------------------
LordVirus: His pot is blacker than his kettle!

Visit Virus Productions!
"And lo, let us open up into the holy book of Proxy2..." -genk
His pot is blacker than his kettle!
2001-04-13, 12:46 PM #5
Okay thanks then i can get this to work. I never knew what CaptureThing really did, this will help a bunch.
roses are red, violets are blue, I am schizophrenic, and I am too!
2001-04-15, 10:14 AM #6
Okay this is the cog that i came up with from the information u said.

Code:
# Jedi Knight Cog Script
#
# ENDURANCE.COG
#
# This cog after activated makes the player get "weaker" with every amount of damage received.
# This can help the player but once his health gets low it can hurt him more than help.
#
# [Han5678]
#
# This Cog is Not supported by LucasArts Entertainment Co
 


symbols
thing        player                             local                         

message      startup                                                          
message      activated                                                        
message      deactivated                                                      
message      damaged                                                          
end                                                                           

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

code

startup:
   	player = GetLocalPlayerThing();
    Return;
# ========================================================================================
activated:
	CaptureThing(player);
    Return;
# ========================================================================================
damaged:
	if (GetThingHealth(player) = 100)
	ReturnEx(5);
	else
	if (GetThingHealth(player) > 90)
	ReturnEx(10);
	else
	if (GetThingHealth(player) > 80)
	ReturnEx(15);
	else
	if (GetThingHealth(player) > 70)
	ReturnEx(20);
	else
	if (GetThingHealth(player) > 60)
	ReturnEx(25);
	else
	if (GetThingHealth(player) > 50)
	ReturnEx(30);	
	else
	if (GetThingHealth(player) > 40)
	ReturnEx(35);	

    Return;
# ========================================================================================
deactivated:
	ReleaseThing(player);
    Return;
end

Will this method work, i haven't tested it yet but i soon will.
i wrote this from scratch so i expect some errors

[This message has been edited by Han5678 (edited April 15, 2001).]
roses are red, violets are blue, I am schizophrenic, and I am too!
2001-04-15, 10:37 AM #7
I just tested it and it didn't do anything. I added Print("adfasdf"); into activated and deactivated. Then when i tested it didn't print anything. So i am assuming i used the activated and deactivated messages wrong?
roses are red, violets are blue, I am schizophrenic, and I am too!
2001-04-15, 1:05 PM #8
Couple of things:

1: You do not need a deactivated message. Instead, do this:
Code:
 if(IsInvActivated(player, n) == 0)
      {
       //do turn on stuff
      }
      else
      {
       //do turn off stuff
      }
}


Where n=The bin # of the item.

2: You shouldn't have a startup message in an item cog (I believe), just put the player-getting in the activated message.
3: Your ReturnEx()s Could cause you some problems, specifically, you multiply the damage on all of them! Anything over 1.0 increases the damage, so just use stuff like 0.5, 0.25, etc.

------------------
LordVirus: His pot is blacker than his kettle!

Visit Virus Productions!
"And lo, let us open up into the holy book of Proxy2..." -genk
His pot is blacker than his kettle!
2001-04-15, 2:05 PM #9
Mask the "player" thing as in darkjedi cogs to get messages retrieved.

------------------
http://millennium.massassi.net/ - Millennium
2001-04-15, 3:18 PM #10
shows how weak some areas of my cogging are, thanks hopefully i can get this working. I will check out the darkjedi cogs and see what u were talking about
roses are red, violets are blue, I am schizophrenic, and I am too!
2001-04-16, 3:49 PM #11
so would it be like?
Code:
if(IsInvActivated(player, 116) == 0)
                     {
                      CaptureThing(player);
                      //other turn on stuff
                     }
                     else
                     {
                      ReleaseThing(player);
                      //other turn off stuff
                     }
               }

is that what u meant? because u told me to keep my activated message and put
player = GetLocalPlayerThing(); in there, but doesn't that little bit of code also replace the activated message along with the deactivated. i understand what u meant by the ReturnEx numbers now, thanks for being patient
roses are red, violets are blue, I am schizophrenic, and I am too!
2001-04-17, 12:35 AM #12
You must have a hotkey assigned before you can activate this... That's probably why it didn't work. The activated message is only sent when it is activated by the player (like a switch) or if a hotkey that is assigned to it is pressed.

------------------
The Bespin Star - the site for your columnist needs.

http://www.jedinights.com/bespinstar
2001-04-17, 12:38 AM #13
Oh... in the first if statement, you only have one "=", it should be two, like "==". That would cause a problem...
2001-04-17, 6:27 AM #14
What I meant by keep was to not remove the Activated message from the cog.

Oh, and you don't need to have a HotKey, it also works if you just use it like a standard inventory item.

------------------
LordVirus: His pot is blacker than his kettle!

Visit Virus Productions!

[This message has been edited by LordVirus (edited April 17, 2001).]

[This message has been edited by LordVirus (edited April 17, 2001).]
"And lo, let us open up into the holy book of Proxy2..." -genk
His pot is blacker than his kettle!
2001-04-17, 10:49 AM #15
Zecks sry your wrong i do have it as a hotkey. And even though i have it as only one = the rest would still fuction so thats not the problem. So virus i just stick that code into the activated and it will work fine? I have been busy and haven't had a chance to rewrite it so i am asking so that i will get it right the first time i redo it, and not have to play with it for too long.
roses are red, violets are blue, I am schizophrenic, and I am too!
2001-04-17, 11:03 AM #16
No, you're wrong. If there is even one syntax error it will often keep the whole cog from working.

------------------
Together we stand.
Divided we fall.
2001-04-18, 1:05 PM #17
Oh i didn't mean that he was wrong about that i meant he was wrong about the hotkey. But i didn't know that would effect the whole cog. I don't see why it shouldn't though when that part is only used if the damaged message has been sent through the player. It just seemed weird that a part that isn't even being used at the moment could cause the problem.

Oops sry it does sound like that i meant that wasn't the problem. Maybe that is what i thought at the moment but i beleived him enough to check if he was right.

[This message has been edited by Han5678 (edited April 18, 2001).]
roses are red, violets are blue, I am schizophrenic, and I am too!
2001-04-18, 11:47 PM #18
If you intend to use this in multiplayer, try using

player = GetSourceRef();

in the activated message and get rid of the whole startup message, as that will accurately get who actually pressed the button and not any player.

------------------
http://millennium.massassi.net/ - Millennium
2001-04-19, 12:43 PM #19
yeah thats a good idea. I should make this into a multiplayer thing. I have the cog fixed up now thanks to every1 and i will post it soon for any details i missed.
roses are red, violets are blue, I am schizophrenic, and I am too!
2001-04-19, 12:53 PM #20
okay here we go with the cog as it now stands

Code:
# Jedi Knight Cog Script
#
# ENDURANCE.COG
#
# This cog after activated makes the player get "weaker" with every amount of damage received.
# This can help the player but once his health gets low it can hurt him more than help.
#
# [Han5678]
#
# This Cog is Not supported by LucasArts Entertainment Co
 


symbols
thing player local

message activated
message damaged
end

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

code
activated:
	player = GetSourceRef();

	if(IsInvActivated(player, 116) == 0)
	{
	 CaptureThing(player);
	}
	 else
	{
	 ReleaseThing(player);
	}

    Return;
# ========================================================================================
damaged:
	if (GetThingHealth(player) == 100)
	ReturnEx(0.2);
	else
	if (GetThingHealth(player) > 90)
	ReturnEx(0.3);
	else
	if (GetThingHealth(player) > 80)
	ReturnEx(0.4);
	else
	if (GetThingHealth(player) > 70)
	ReturnEx(0.5);
	else
	if (GetThingHealth(player) > 60)
	ReturnEx(0.6);
	else
	if (GetThingHealth(player) > 50)
	ReturnEx(0.7);	
	else
	if (GetThingHealth(player) > 40)
	ReturnEx(0.8);
	else
	if (GetThingHealth(player) > 30)
	ReturnEx(0.9);
	else
	if (GetThingHealth(player) > 20)
	ReturnEx(1.0);	

    Return;
end


oh yeah BTW if i stuck the code from the damaged message into kyle would that work?

[This message has been edited by Han5678 (edited April 19, 2001).]
roses are red, violets are blue, I am schizophrenic, and I am too!
2001-04-19, 1:42 PM #21
Is this actually working or not?
It may not return damaged message unless you mask the player thing in the symbols section.

And also do

SetInvActivated(player, 116, 1-IsInvActivated(player, 116));

below the player declaration in the activated message, so it gets activated/deactivated each time pressed.

------------------
http://millennium.massassi.net/ - Millennium
2001-04-19, 1:46 PM #22
I do have the player in the symbols right don't i? and i will add that bit of code so it will turn on and off. i haven't tested it yet but i will in a few mins
roses are red, violets are blue, I am schizophrenic, and I am too!
2001-04-19, 1:51 PM #23
Might look like this simplified.
As for the damage, if you want to return a certain percentage of the damage retrieved by the player, use

number * GetParam(0)

Code:
symbols


thing player mask=0xfff local


message activated
message damaged


end


code


activated:


   player = GetSourceRef();
   SetInvActivated(player, 116, 1 - IsInvActivated(player, 116));


   if(!IsInvActivated(player, 116)) CaptureThing(player);
   else ReleaseThing(player);


   return;


damaged:


   ReturnEx((1.2 - GetThingHealth(player) / 100) * GetParam(0));


   return;


end


------------------
http://millennium.massassi.net/ - Millennium

[This message has been edited by Hideki (edited April 19, 2001).]
2001-04-19, 3:12 PM #24
hey well the cog doesn't work first of all. u might have to help a little more here, i have never understood how to use get param. Do i keep it as 0 or do i do something else? I understand most of it but i don't understand y u need it to be there
like the mask
and does that code in the damaged return the health number
sorry i can be a moron when it come to things i haven't tinkererd with before
roses are red, violets are blue, I am schizophrenic, and I am too!
2001-04-19, 6:09 PM #25
mask - You need this or otherwise it will not return damaged message, the flags will tell what message to retrieve but I'm not sure which is which, so I just put the full flag.


getparam - This will get the parameter passed with SendMessageEx and SendTrigger but in damaged message it's a bit unique here. Param 0 gets the amount of damage and param 1 gets the type of the damage.

The parenthesis is the param number.

SendMessageEx(cog, message, param0, param1, param2, param3);

The cog sent can get the 4 paramters by GetParam(numberHere) in that message sent.


As for the cog, does it even get activated?
Put "Print("worked");" in the activated message if you're not sure.

------------------
http://millennium.massassi.net/ - Millennium

[This message has been edited by Hideki (edited April 19, 2001).]
2001-04-20, 12:38 PM #26
okay thats my prob then. I never masked the player which is y the damaged message isn't doing anything right? Thats the main prob. I new a little about what GetParam does but not in the case of damaged so thats fixed. NO it doesnt get activated i checked it by getting it to print earlier.



[This message has been edited by Han5678 (edited April 23, 2001).]
roses are red, violets are blue, I am schizophrenic, and I am too!
2001-04-23, 3:48 PM #27
code as it stands at the moment, still doesn't work though
Code:
symbols
thing player mask=0xfff local

message activated
message damaged
end

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

code
activated:
	player = GetSourceRef();

       SetInvActivated(player, 116, 1-IsInvActivated(player, 116));
	if(IsInvActivated(player, 116) == 0)
	 CaptureThing(player);
        Print("Ednurance Activated");
	 else
	 ReleaseThing(player);
        Print("Ednurance Deactivated");

    Return;
# ========================================================================================
damaged:
	if (GetThingHealth(player) == 100)
	ReturnEx((9 - GetThingHealth(player) / 100) * GetParam(0));
	else
	if (GetThingHealth(player) > 90)
       ReturnEx((8 - GetThingHealth(player) / 100) * GetParam(0));
	else
	if (GetThingHealth(player) > 80)
       ReturnEx((7 - GetThingHealth(player) / 100) * GetParam(0));
	else
	if (GetThingHealth(player) > 70)
       ReturnEx((6 - GetThingHealth(player) / 100) * GetParam(0));
	else
	if (GetThingHealth(player) > 60)
       ReturnEx((5 - GetThingHealth(player) / 100) * GetParam(0));
	else
	if (GetThingHealth(player) > 50)
       ReturnEx((4 - GetThingHealth(player) / 100) * GetParam(0));	
	else
	if (GetThingHealth(player) > 40)
       ReturnEx((3 - GetThingHealth(player) / 100) * GetParam(0));
	else
	if (GetThingHealth(player) > 30)
       ReturnEx((2 - GetThingHealth(player) / 100) * GetParam(0));
	else
	if (GetThingHealth(player) > 20)
       ReturnEx((1 - GetThingHealth(player) / 100) * GetParam(0));	

    Return;
end


------------------
Join the army,
Visit new places,
Meet new people,
Then drop bombs on them
roses are red, violets are blue, I am schizophrenic, and I am too!

↑ Up to the top!