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 → Is it possible for cogs not to work...
Is it possible for cogs not to work...
2006-08-03, 4:29 PM #1
...when near the thing limit? I ask because I've tried many varients on a surface being damaged and a door opening, and none of them work.

If somebody could help me with this little problem, Negative Gain will be released faster :)

ps: below is just a cog I quickly made as an example, just to show what the jist of what I'm doing is. I haven't checked for errors...


Code:
# Jedi Knight Cog Script
#
# 

symbols

message     damaged

surface     switch             linkid=1                 
thing       door

end

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

code

damaged:

if ((GetWallCel(switch) == 0) && (GetSenderId() == 1))
   {
Print("This is working?");
      SetWallCel(switch,1);
MoveToFrame(door, 1, 5);
         }
   return;

end

Magrucko Daines and the Crypt of Crola (2007)
Magrucko Daines and the Dark Youth (2010)
Magrucko Daines and the Vertical City (2016)
2006-08-03, 11:27 PM #2
I'm not good with level cogs, but don't you have to add a mask to the surface, so it sends the damaged message to the cog?
"Häb Pfrässe, süsch chlepfts!" - The coolest language in the world (besides Cherokee)
2006-08-04, 4:16 AM #3
Yeah I forgot the mask. However, I'm puzzled to why this won't work;

Code:
# Jedi Knight Missions Cog Script
#
#
# Barrel blows up, switch is triggered, door opens
#
#=========================================================
symbols

message      damaged                                                          
message      timer                                                            
message      activated                                                        

surface      panel                              mask=0x008                    
thing        barrel                             mask=-1                       linkid=1

thing        sparkspot                          nolink                        

template     spark=+sparks                      local                         
template     barrel_exp=+xtank3_exp                                           

thing        door                               linkid=2                      


sound        sparksound                                                       
sound        kylelocked                                                       
sound        wav0=lvrclik2.wav                                                

flex         minimumDelay=2.0                                                 
flex         maximumDelay=4.0                                                 
flex         nextSpark=0.5                      local                         

end                                                                           

#=========================================================
code
   
activated:
        if (GetSenderId() == 2)
        {
                PlaySoundLocal(kylelocked, 1, 0, 0);
                PlaySoundLocal(wav0, 1, 0, 0);
        }
        return;        


damaged:

if (GetSenderId() == 1)
       {
       sleep(0.8);   		
       SetWallCel(panel , 1);
     		     		
     		 CreateThing(spark, sparkspot);
     	        PlaySoundThing(sparksound, sparkspot, 1, -1, -1, 0);
                
               SetTimer(nextspark);

	MoveToFrame(door, 1, 1.5);
	}
  	return;

#............................................................
timer:
	CreateThing(spark, sparkspot);
     	PlaySoundThing(sparksound, sparkspot, 1, -1, -1, 0);

        nextSpark = minimumDelay + (Rand() * (maximumDelay - minimumDelay));
	SetTimer(nextSpark);
	return;


end



It works until I put the linkid stuff in, which I need otherwise the player just... shoots the door and doesn't go through my nifty puzzle :)
Magrucko Daines and the Crypt of Crola (2007)
Magrucko Daines and the Dark Youth (2010)
Magrucko Daines and the Vertical City (2016)
2006-08-04, 5:14 AM #4
Yes -- cogs have a tendency to stop working when you hit the thing limit.
And when the moment is right, I'm gonna fly a kite.
2006-08-04, 5:34 AM #5
I'm not completely sure, but maybe you can use if(GetSenderRef() == panel) to filter out the surface. Might be worth a try.
"Häb Pfrässe, süsch chlepfts!" - The coolest language in the world (besides Cherokee)

↑ Up to the top!