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 → Mats changing when stepped on
Mats changing when stepped on
2003-11-25, 1:04 PM #1
i need a cog that will allow a mat to change when stepped on. if I need to make an animated mat, tell me, but the cog that makes that move is like animat.cog and its always persistant. i need a cog that will change to the 2nd mat when stepped on and it will go back to the first when you step off.

------------------
Your Owners Clan Leaader,
_yo_wasup_
-=__/¯¯l¤¥Ø¤l¯¯\__\/\/ª≤uÞ_=-
http://www.TeamYo.org
2003-11-25, 5:42 PM #2
Code:
# Cog to change a surface's mat what it gets stepped on.
#
# 11/2003 gbk
Symbols
Message Entered
Message Exited

Surface Floor

Material Mat0
Material Mat1

End
Code
Entered:
Setsurfacemat(Floor, Mat1);
Stop;

Exited:
Setsurfacemat(Floor, Mat0);
Stop;
End



Im a little rusty . . .so . . I make no promises...

------------------
Fight the future.
And when the moment is right, I'm gonna fly a kite.
2003-11-26, 9:47 AM #3
GBK's code is the type of cogging you want to use, though you'll probably want to use a "Touched" message for this instead of "Entered" message for a sector. Just a thought.
Sidenote: YourOwners had a similar topic about a giant piano that plays sounds when a surface is stepped on (accidentally posted in the General Editing forum). This topic MAY be of some use to you (not promising anything!).

------------------
We are Slaw of Borg.
You will be assimilated.
Resistance is futile.
-Darth Slaw, Dark Lord of the Borg
May the mass times acceleration be with you.
2003-11-26, 11:47 AM #4
Actually, GBK's COG is quite accurate...
Don't you know, if you want a surface to be "touched" in the sence of stepped on, you have to use Entered!

/Edward
Edward's Cognative Hazards
2003-11-26, 11:58 AM #5
Ooops! I just found out that YourOwners posted this topic, too (never bothered to look at the topic starter's name [http://forums.massassi.net/html/redface.gif])
Apparently, the other thread was not helpful.

Nope, Edward, I did not. I'm not an expert cogger in the level-editing area. I was just summarizing the info on the other post, which was to use a "Touched" message. I gave a sample code for an "Entered" message cog on the other topic, with some command execution errors, but essentially the same format as GBK's. But no, I didn't know that.
I was thinking that if the player entered the sector up high in the air (without touching the actual surface), then the color would change. And YO wants it to change only when it's touched, and airborne players can't touch it.
------------------
We are Slaw of Borg.
You will be assimilated.
Resistance is futile.
-Darth Slaw, Dark Lord of the Borg

[This message has been edited by Darth Slaw (edited November 26, 2003).]
May the mass times acceleration be with you.
2003-11-26, 12:46 PM #6
I try to make my cogs as simple as possible... [http://forums.massassi.net/html/wink.gif]

------------------
Fight the future.
And when the moment is right, I'm gonna fly a kite.
2003-11-27, 3:52 PM #7
hey, that cog is great, except could someone add in a feature that would work on a 3do? i need the mat to change when its on a 3do too. so you cant write the surface number. on the animated mat cog, it works on 3do's, but its going constantly and u need to make a custom ani. mat.
somehow, enabel the mat to change when stepped on.
thx.

------------------
Your Owners Clan Leaader,
_yo_wasup_
-=__/¯¯l¤¥Ø¤l¯¯\__\/\/ª≤uÞ_=-
http://www.TeamYo.org
2003-11-27, 4:33 PM #8
I think this is the proper place for implementation of a touched message, though with my luck, I'm probably wrong somewhere and will be beaten for it [http://forums.massassi.net/html/tongue.gif].
Anyway, here's a code base for you to get started with (checked by CogWriter for syntax errors)
Code:
# Jedi Knight Cog Script
# THIS CODE HAS JUST BEEN WRITTEN AND HAS NOT
# BEEN TESTED YET TO SEE IF IT WORKS CORRECTLY
#
# Changes cel of mat every time a specified thing is touched
#
# This Cog is Not supported by LucasArts Entertainment Co

symbols

thing        thingie                                                          
material     themat                                                           

thing        player                             local                         
int          frame                              local                         

message      touched                                                          

end                                                                           

# ========================================================================================
code
touched:

if(thingie != GetSenderRef())  //touched thing is not our thing
	return; 

frame = 1 - frame;
SetMaterialCel(themat, frame);

return;
# ........................................................................................
end

This code will switch the specified surface to the next frame (either 1 or 0) every time a specified thing is touched, and it also checks to see if the touched thing is the specified one (a practice I picked up from looking at some cogs I d/led from the COG section of Massassi)

Also, you need a multi-celled mat (aka: animated) with at least 2 cels for this code to work

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

------------------
We are Slaw of Borg.
You will be assimilated.
Resistance is futile.
-Darth Slaw, Dark Lord of the Borg

[This message has been edited by Darth Slaw (edited November 27, 2003).]
May the mass times acceleration be with you.
2003-11-27, 6:26 PM #9
Slaw, 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. And 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.


Hrm, I didnt means to rant . . but you guys are just . . .wrong. Touched is not the answer in this case, and never is when the floor is concerned.

------------------
Fight the future.
And when the moment is right, I'm gonna fly a kite.
2003-11-27, 6:33 PM #10
Code:
# Cog to change a surface's mat what it gets stepped on.
#
# 11/2003 gbk
Symbols
Message Entered
Message Exited

Thing Floor

Material Mat

End
Code
Entered:
Setmaterialcel(Mat, 1);
Stop;

Exited:
Setmaterialcel(Mat, 0);
Stop;
End


Modified to work for 3d0s... Notice the complete lack of the Touched message? Yeah, thats the way its suppose to be.


/me beats Darth Slaw.

BTW, Slaw, you didnt need to check the sender of the message, nor did you need the 'player' variable. And 'frame' should have been set to 0 on startup...

------------------
Fight the future.
And when the moment is right, I'm gonna fly a kite.
2003-11-27, 7:29 PM #11
Yeah, really. This is nothing new. There are some old CA elevator COGs from like 1998 that use entered.

------------------
Bassoon, n. A brazen instrument into which a fool blows out his brains.
Bassoon, n. A brazen instrument into which a fool blows out his brains.
2003-11-28, 3:01 PM #12
I'll remember that, GBK. I've mostly edited weapon cogs, and have not had much experience editing level cogs. So anyone who has read my touched cogs can forget it, as they have no use.
I was acting on my experiance with weapon projectile cogs (which are things--the projectiles, not their cogs), etc that I was experimenting with from Millennium, not to mention that I've rarely looked at elevator cogs. Also, I wrote a door cog that opened the doors when touched or activated and used a touched message. I guess I just never learned the entire concept of the touched/entered messages.
Thanks for informing me, GBK, and sorry I didn't actually help much, YourOwners. Hope you get it to work, though.

------------------
We are Slaw of Borg.
You will be assimilated.
Resistance is futile.
-Darth Slaw, Dark Lord of the Borg

[This message has been edited by Darth Slaw (edited November 28, 2003).]
May the mass times acceleration be with you.
2003-11-28, 4:34 PM #13
GBK, your cog does not indicate which mat it should change to when u jump on the 3do's surface. could you fix that part?

------------------
Your Owners Clan Leaader,
_yo_wasup_
-=__/¯¯l¤¥Ø¤l¯¯\__\/\/ª≤uÞ_=-
http://www.TeamYo.org
2003-11-29, 5:09 AM #14
That's because it changes cells in one mat file, it doesn't replace the mat. Just make a new mat and have the first cell what you want it to be when you're not on it, and the second cell what you want it to be when you are standing on it.

------------------
Look for my current project, The Force in Your Soul.
Last week I cudn't evn spel grajuat, but now I is one.

*Takes out his blaster and fires shots at the wall, the blastmarks leave the words "S-TROOPER WUZ 'ERE!!!"

↑ Up to the top!