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 → Random material cell when activated..
Random material cell when activated..
2002-02-01, 12:46 PM #1
Code:
symbols

thing       player            local
thing       door
thing       ghost
int         randsky           local
material    box=stroombox.mat local
message     activated
message     trigger

end


code

activated:
   door == GetSenderRef();
   player == GetSourceRef(); 
   SendTrigger(-1, 56789123, player, 0, 0, 0);
   TeleportThing(player,ghost);  
   Return;

trigger:
if(GetSourceRef() == 56789123)
{
   randsky == (Rand()*10);
   If(randsky > 5)
   {randsky == (randsky - 5);}
   SetMaterialCel(box,randsky); 
}
Return;
end


When activated, this is sposed to change a material to a random cell between 1 and 5. but it wont change the cell [http://forums.massassi.net/html/confused.gif]

Whats wrong? Oh, you can ignore the teleport stuff, that works fine..

[This message has been edited by Shred18 (edited February 01, 2002).]
Jedi Knight Enhanced
Freelance Illustrator
2002-02-01, 12:53 PM #2
Oh, i see a problem now that i posted it, the player is defined as the source reference early on for the teleport...


[edit]
Bah, I eliminated the triggering and it still wont work. Help?[/edit]

[This message has been edited by Shred18 (edited February 01, 2002).]
Jedi Knight Enhanced
Freelance Illustrator
2002-02-01, 3:28 PM #3
Try something like this:

Code:
Randsky = Rand()*10;
While(Randsky > 4) {
Randsky = Rand()*10; }
Setmaterialcel(Box, Randsky);



NOTE: Material cels are numberd from 0.

------------------
Success is the inverse relationship between effort, gain, and loss.
And when the moment is right, I'm gonna fly a kite.
2002-02-01, 5:03 PM #4
Errrrr I think I see alot of mistakes in that cog ...... lets see if this does the trick.

Code:
symbols
thing       player            local
thing       door
thing       ghost
int         randsky           local
material    box=stroombox.mat local
message     activated
message     trigger

end

code

activated:   

door = GetSenderRef();   
player = GetSourceRef();    
SendTrigger(-1, 567823, player, 0, 0, 0);   
TeleportThing(player, ghost);    
 
Return;

trigger:

if(GetSourceRef() == 567823)
{   
randsky = Rand()*10;   
If(randsky > 5)   
{
randsky = randsky-5;
}   

SetMaterialCel(box, randsky); 

Return;

end
2002-02-02, 4:42 PM #5
Well, that one works! I guess I only had a few of the brackets and things set up wrong...thanks!
Jedi Knight Enhanced
Freelance Illustrator

↑ Up to the top!