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 → problems with "damaged"-message
problems with "damaged"-message
2001-05-09, 5:28 AM #1
normally when i wrote a cog i was able to fix any errors. but i don't know why this cog doesn't work.
it does work if i remove the damaged message and the "return;" below the startup-section.
i hope someone can help me.

Code:
# Jedi Knight Cog Script
#
# podpuzzle.COG
#
# Written by JB
#
# moves the pod in the first hangar forward to frame 1 when the switch is hit.
# 
#
# This Cog is Not supported by LucasArts Entertainment Co

symbols

thing        pod                                nolink                        
surface      switch                                                           
int          done                               local                         

message      startup                                                          
message      damaged                                                          

sound        start=funicularstart01.wav         local                         
sound        ende=funicularstop01.wav           local                         
end                                                                           

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

code

startup:

 done=0;

return;

# ........................................................................................

damaged:

  if ( done==0 )
   {
   done=1;
   PlaySoundThing(start,pod,1,0,50,0x40);
   MoveToFrame(pod, 1,2); 
   WaitForStop(pod);
   PlaySoundThing(ende,pod,1,0,50,0x40);
  }

return;


# ........................................................................................

end

thanks


------------------
-eriamjh-
-eriamjh-
2001-05-09, 8:56 AM #2
I don't know why it doesn't work, but you can simplify it -- you don't need a startup message (see below). Also I would try adding the mask=0x448 for the switch - I think this is needed for the switch to send a damaged message when hit -- the surface will generate a message when hit by weapon (0x8), explosion (0x40), or player (0x400).
Code:
# Jedi Knight Cog Script
#
# podpuzzle.COG
#
# Written by JB
#
# moves the pod in the first hangar forward to frame 1 when the switch is hit.
# 
#
# This Cog is Not supported by LucasArts Entertainment Co
symbols
thing pod nolink
surface switch mask=0x448
int done=0 local
message damaged
sound start=funicularstart01.wav local
sound ende=funicularstop01.wav local
end
# ============================================
code
damaged:
if (!done)
  {
  done=1;
  PlaySoundThing(start,pod,1,0,50,0x40);
  MoveToFrame(pod,1,2);
  WaitForStop(pod);
  PlaySoundThing(ende,pod,1,0,50,0x40);
  }
return;
end


------------------
Sylvicolus JK homepage
If I have ever made any valuable discoveries, it has been owing more to
patient observation than to any other reason. -Isaac Newton

[This message has been edited by Sylvicolus (edited May 09, 2001).]
Sylvicolus JK homepage
If I have ever made any valuable discoveries, it has been owing more to
patient observation than to any other reason. -Isaac Newton
2001-05-09, 12:11 PM #3
thanks, now it works fine. i didn't know that mask-thing. but it seems like that was the reason.

------------------
-eriamjh-
-eriamjh-

↑ Up to the top!