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 → Simpler cog: Damaging material
Simpler cog: Damaging material
2004-06-17, 11:09 AM #1
grrr... suddenly Im having all these cog problems, but if someone could solve this quickie it would be great:

I am having many surfaces that will damage the player when touched, and they are all the same mat. So, instead of using the 00_damagewall.cog and inputing EVERY SINGLE surface, how about something where if you touch a certain mat you get hurt?

Sorta like combining 00_damagewall and 00_matanim. Like this except it doesnt function:

Code:
# Jedi Knight cog Script
#
# Whenever a player touches a material, he gets hurt
#
# [F-Body]
#
# This cog is not made or endorsed by LucasArts Entertainment Co.
# ========================================================================================

symbols

message		touched

material	damagemat		desc=damaging_material

flex		maxDamage=10.0
flex		minDamage=5.0

int		victim=-1	local
flex		damage=0	local
flex		garbage=0	local
end

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

code

touched:
	If(GetSurfaceMat(GetSenderRef())!=damagemat) return;
	victim = GetSourceRef();
	damage = (rand() * (maxDamage - minDamage)) + minDamage;
	garbage = DamageThing(victim, damage, 0x2, victim);		// self-inflicted damage
	return;
end


------------------
nil nip nada zip zero naught lip zil
This is retarded, and I mean drooling at the mouth
2004-06-17, 1:38 PM #2
Well, the GetSenderRef() only tests for the surfaces you've added to the symbols. As there is no surface, there is nothing to test. Try this:

Code:
surface    i    local

code
touched:
        for(i=0; i<=GetSurfaceCount(); i=i+1)
        {
            If(GetSurfaceMat(i)!=damagemat) return;
            Hurt_Me(waytoomuch);   [http://forums.massassi.net/html/tongue.gif]
return;
end


/Edward


[This message has been edited by Edward (edited June 17, 2004).]
Edward's Cognative Hazards
2004-06-17, 4:59 PM #3
Thanks for the response, but Im still getting the same response. Heres what I have now:
Code:
#Jedi Knight cog Script
#
# Whenever a player touches a material, he gets hurt
#
# This cog is not made or endorsed by LucasArts Entertainment Co.
# ========================================================================================

symbols

message		touched

material	damagemat
surface		i    	local

flex		maxDamage=10.0
flex		minDamage=5.0

int		victim=-1	local
flex		damage=0	local
flex		garbage=0	local
end

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

code

touched:
	for(i=0; i<=GetSurfaceCount(); i=i+1)
	{       
	      If(GetSurfaceMat(i)!=damagemat) return;
	      victim = GetSourceRef();
	      damage = (rand() * (maxDamage - minDamage)) + minDamage;
	      garbage = DamageThing(victim, damage, 0x2, victim);
	}
	return;
end


[This message has been edited by F-Body (edited June 17, 2004).]
This is retarded, and I mean drooling at the mouth
2004-06-18, 12:03 AM #4
Have you tried using the "entered" message instead of "touched"? Give this a whirl, as I believe this could be the solution to your quandry [http://forums.massassi.net/html/wink.gif] - either way, let us know the outcome [http://forums.massassi.net/html/smile.gif]

Hope this helps [http://forums.massassi.net/html/biggrin.gif]

-Jackpot

------------------
"lucky_jackpot is the smily god..." - gothicX
"jackpot is an evil evil man... so evil, in fact, that he's awesome." - Seb

"Life is mostly froth and bubble, but two things stand in stone,
Kindness in another's trouble, courage in your own"
("Ye Wearie Wayfarer" - by Adam Lindsay Gordon)
"lucky_jackpot is the smily god..." -gothicX
"Life is mostly froth and bubble, but two things stand in stone,
Kindness in another's trouble, courage in your own"
- "Ye Wearie Wayfarer"
|| AI Builder: compatible with both JK & MotS || My website ||
2004-06-18, 5:39 AM #5
Well its not like is just a bunch of sectors, but there are many surfaces in the map that will damage. Thx for the idea though

------------------
nil nip nada zip zero naught lip zil
This is retarded, and I mean drooling at the mouth
2004-06-18, 5:59 AM #6
*cough* [http://forums.massassi.net/html/wink.gif]
Quote:
<font face="Verdana, Arial" size="2">
Originally posted by GBK:
there is a valuable lesson to be learned here:
Walking on something (when its flagged as walkable), NEVER triggers Touched.

If you walk onto a surface, it sends ENTERED. If you walk onto a thing, it sends ENTERED. If you spit at a thing, it sends ENTERED. An object or surface will only, ONLY, ONLY send TOUCHED if you actully touch it, IE, from the side or bottom, or from the top if the object or surface are not flagged as walkable. ... Touched is not the answer in this case, and never is when the floor is concerned.
</font>


See this thread for more info: http://forums.massassi.net/html/Forum4/HTML/003953.html - this is why I suggested for you to try the "entered" message, as it isn't solely confined to sectors [http://forums.massassi.net/html/wink.gif] [http://forums.massassi.net/html/smile.gif]

Hope this helps [http://forums.massassi.net/html/biggrin.gif]

-Jackpot

------------------
"lucky_jackpot is the smily god..." - gothicX
"jackpot is an evil evil man... so evil, in fact, that he's awesome." - Seb

"Life is mostly froth and bubble, but two things stand in stone,
Kindness in another's trouble, courage in your own"
("Ye Wearie Wayfarer" - by Adam Lindsay Gordon)
"lucky_jackpot is the smily god..." -gothicX
"Life is mostly froth and bubble, but two things stand in stone,
Kindness in another's trouble, courage in your own"
- "Ye Wearie Wayfarer"
|| AI Builder: compatible with both JK & MotS || My website ||
2004-06-18, 9:59 AM #7
Way to bring back memories jackpot [http://forums.massassi.net/html/wink.gif]

Oh, how I remember those words... I'll be darned should I ever forget them [http://forums.massassi.net/html/redface.gif]

------------------
nytfyre m0d || f33l t3h p0w3r || t3h l0st c0gz || OMF > *
May the mass times acceleration be with you.
2004-06-18, 10:22 AM #8
Well thanks for that, it's the first I've heard on the subject. I'll check it out as soon as I get a chance. Gee, it sounds like GBK was unusually *touchy when writing that. (pun intended [http://forums.massassi.net/html/wink.gif] )

------------------
nil nip nada zip zero naught lip zil
This is retarded, and I mean drooling at the mouth
2004-06-18, 7:41 PM #9
Just one question [in a slightly sarcastic tone] how is entered: or touched: going to be called without declaring any surfaces to call the message? [/sarcastic tone]

What I'm saying is that as far as I know, you can't call a message from a surface without declaring the surface first. You have the surface declarations after the message is called.

------------------
Sam: "Sir we can't call it 'The Enterprise'"
Jack: "Why not!"
Sam: "Sir we can't call it 'The Enterprise'"
Jack: "Why not!"
2004-06-21, 4:58 AM #10
I'm guessing (because I haven't tested Slaw's suggestion - lack of time and all in the real world... [http://forums.massassi.net/html/wink.gif]) that although not identifying a surface to run the "entered" message, any surface that is assigned the "damagemat" material will be used as a damaging surface. Whilst this implementation should work, you do have the overhead that you have to iterate through all the surfaces in the level (which could take a while depending on level size). Whilst a linkid for the surface would be my preference for this type of thing, Slaw's will work equally well, so I guess it's a "horses for courses" decision [http://forums.massassi.net/html/smile.gif] [http://forums.massassi.net/html/biggrin.gif]

-Jackpot

NB: Sorry about dregding up those immortal words Slaw [http://forums.massassi.net/html/redface.gif] [http://forums.massassi.net/html/wink.gif] - it was just that it was the last thread I could remember where a really detailed discussion of this nature occured... [http://forums.massassi.net/html/biggrin.gif]

------------------
"lucky_jackpot is the smily god..." - gothicX
"jackpot is an evil evil man... so evil, in fact, that he's awesome." - Seb

"Life is mostly froth and bubble, but two things stand in stone,
Kindness in another's trouble, courage in your own"
("Ye Wearie Wayfarer" - by Adam Lindsay Gordon)
"lucky_jackpot is the smily god..." -gothicX
"Life is mostly froth and bubble, but two things stand in stone,
Kindness in another's trouble, courage in your own"
- "Ye Wearie Wayfarer"
|| AI Builder: compatible with both JK & MotS || My website ||
2004-06-21, 12:15 PM #11
If this did work, it'd be something of a waste of resources. This would have JK checking and rechecking every surface in the level. The simpler cog F-Body mentioned, modified to take care of more surfaces would probably be the more efficient alternative, though it'd take more work to set up.

------------------
_ _ _____________ _ _
Wolf Moon
Cast Your Spell On Me
Beware
The Woods At Night
The Wolf Has Come
_ _ _____________ _ _
Wolf Moon
Cast Your Spell On Me
Beware
The Woods At Night
The Wolf Has Come

↑ Up to the top!