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 → Mat Change
Mat Change
2004-05-22, 7:06 PM #1
I was wondering, multiple times when im making different levels, if you can select a surface or thing, (preferably a thing), and have a mat change thats in the level. If this is possible, plz help.

------------------
Your Owners Clan Leaader,
_yo_wasup_
-=__/¯¯l¤¥Ø¤l¯¯\__\/\/ª≤uÞ_=-
http://www.TeamYo.org
2004-05-22, 7:55 PM #2
Try this. It's been parsed, but not tested.
Code:
# Jedi Knight Cog Script
#
# when console is activated, all instances of a
#  specified mat in the level are changed to another.
#
# [Darth Slaw] - darthslaw@cox.net
# 5/23/04
# =======================================================================
symbols

message   activated

thing     console

material  daOldMat
material  daNewMat

int       i           local

end
# =======================================================================
code
# .......................................................................
activated:
	if(GetSenderRef() != console) Return;
	for(i = 0; i < GetSurfaceCount(); i = i + 1)
	{
		if(GetSurfaceMat(i) == daOldMat) SetSurfaceMat(i, daNewMat);
	}

Return;
# .......................................................................
end


------------------
for(i = 0; i < 00; i = i + 1) Print("massassi is good");
PrintInt(i); //print the integer value of infinity
May the mass times acceleration be with you.
2004-05-24, 12:57 PM #3
hey nice job, the mat changes really nice.
cept can you make it so whenever you hit the switch it changes back?

i hit it once, and that was sweet cause my mat did change. but activating the switch again didn't do anything, so if its possible can you fix that? thanks. btw ill credit you in readme.

------------------
Your Owners Clan Leaader,
_yo_wasup_
-=__/¯¯l¤¥Ø¤l¯¯\__\/\/ª≤uÞ_=-
http://www.TeamYo.org
2004-05-24, 6:46 PM #4
No problem!

Code:
# Jedi Knight Cog Script
#
# when console is activated, all instances of a
#  specified mat in the level are changed to another.
#
# [Darth Slaw] - darthslaw@cox.net
# 5/24/04
# =======================================================================
symbols

message   activated

thing     console

material  daMat0
material  daMat1

int       i           local
int       frame=0     local 

end
# =======================================================================
code
# .......................................................................
activated:
	if(GetSenderRef() != console) Return;
	for(i = 0; i < GetSurfaceCount(); i = i + 1)
	{
		if(GetSurfaceMat(i) == daMat[frame]) SetSurfaceMat(i, daMat[1 - frame]);
	}
	frame = 1 - frame;

Return;
# .......................................................................
end


------------------
for(i = 0; i < 00; i = i + 1) Print("massassi is good");
PrintInt(i); //print the integer value of infinity

[This message has been edited by Darth Slaw (edited May 24, 2004).]
May the mass times acceleration be with you.
2004-05-25, 11:34 AM #5
oop, that crashes the game when i select the console now.. lol, but hey thats good when you need a cog to crash the game.. right?

lets try this again lol

------------------
Your Owners Clan Leaader,
_yo_wasup_
-=__/¯¯l¤¥Ø¤l¯¯\__\/\/ª≤uÞ_=-
http://www.TeamYo.org
2004-05-25, 12:24 PM #6
Looks like Slaw forgot a character, lol...
Try this code:

Code:
# Jedi Knight Cog Script
#
# when console is activated, all instances of a
#  specified mat in the level are changed to another.
#
# [Darth Slaw] - darthslaw@cox.net
# 5/24/04
# =======================================================================
symbols

message activated

thing console

material daMat0
material daMat1

int i local
int frame=0 local

end
# =======================================================================
code
# .......................................................................
activated:
if(GetSenderRef() != console) Return;
for(i = 0; i < GetSurfaceCount(); i = i + 1)
{
if(GetSurfaceMat(i) == daMat0[frame]) SetSurfaceMat(i, daMat0[1 - frame]);
}
frame = 1 - frame;

Return;
# .......................................................................
end


You messed up on the arrays Slaw. In JK you have to write the full name of the first variable, which in this case is daMat0... Small mistake, lol. Otherwise your code seems fine.

------------------
_ _ _____________ _ _
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
2004-05-27, 12:32 PM #7
alright, the game doesn't crash on this one, but it doesn't change back to the first mat when you select it again.

(to conclude: select 1st time- 2nd mat, select 2nd time- 1st mat, select 3rd time- 2nd mat, select 4nd time- 1st mat)

just keep repeating it if possible,

THX!

------------------
Your Owners Clan Leaader,
_yo_wasup_
-=__/¯¯l¤¥Ø¤l¯¯\__\/\/ª≤uÞ_=-
http://www.TeamYo.org
2004-05-27, 2:08 PM #8
Code:
# Jedi Knight Cog Script
#
# when console is activated, all instances of a
#  specified mat in the level are changed to another.
#
# [Darth Slaw] - darthslaw@cox.net
# and Lord Tiberius Grismath.
# =======================================================================
symbols

message   activated

thing     console

material  daOldMat
material  daNewMat

int       i           local

int	warg=0	local

end
# =======================================================================
code
# .......................................................................
activated:
if(GetSenderRef() == console) {
if(warg==0) {
 for(i = 0; i < GetSurfaceCount(); i = i + 1) {
 if(GetSurfaceMat(i) == daOldMat) SetSurfaceMat(i, daNewMat);
 }
 warg=1;
 return;
} else {
 for(i = 0; i < GetSurfaceCount(); i = i + 1) {
 if(GetSurfaceMat(i) == daNewMat) SetSurfaceMat(i, daOldMat);
 }
 warg=0;
 return;
}
}
Return;
# .......................................................................
end


Crude but effective. (I hope.)
Cordially,
Lord Tiberius Grismath
1473 for '1337' posts.
2004-05-28, 8:52 PM #9
hey dude that works perfectly, thx lots!

------------------
Your Owners Clan Leaader,
_yo_wasup_
-=__/¯¯l¤¥Ø¤l¯¯\__\/\/ª≤uÞ_=-
http://www.TeamYo.org
2004-05-31, 6:04 AM #10
Quote:
<font face="Verdana, Arial" size="2">Originally posted by LKOH_SniperWolf:
You messed up on the arrays Slaw. In JK you have to write the full name of the first variable, which in this case is daMat0... Small mistake, lol. Otherwise your code seems fine.
</font>

Oops. Heh heh. Too much java (or maybe just ignorance [http://forums.massassi.net/html/redface.gif])

I don't know why the code I posted (with sniperwolf's fix, that is) wasn't changing the mats back. Oh well.
But I guess it's not really all that important though, since grismath's version works fine. [http://forums.massassi.net/html/smile.gif]

------------------
for(i = 0; i < 00; i = i + 1) Print("massassi is good");
PrintInt(i); //print the integer value of infinity
May the mass times acceleration be with you.

↑ Up to the top!