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 → Cog code help recuested.
Cog code help recuested.
2003-06-25, 1:08 AM #1
Code:
# Jedi Knight Cog Script

symbols
   message		startup
   message		activated
   message		killed
   message		pulse

   thing		lostghost
   thing		door0		linkid=1	
   thing		door1		linkid=1
   thing		tech0		linkid=2	
   thing		tech1		linkid=2
   thing		bot
   surface		swith0
   surface		swith1
   sector		target
   template        	spark=+sparks			local
   sound		sparksound		
   int			reparied=0 		local

end

code
startup:
   SetWallCel(swith0,2);
   SetWallCel(swith1,2);
   SetSectorAdjoins(GetThingSector(door0),0);
   SetPulse(1.0);
   return;
activated:
   if (reparied==0)
	{
Print("Sorry. Door is broken.");
	}

   if ((reparied==1) (GetSenderRef()==door0)||(GetSenderRef()==door1))
	{
   	MoveToFrame(door0, 1, 2);
	MoveToFrame(door1, 1, 2);
	waitforstop(door0);
	sleep(6);
   	MoveToFrame(door0, 0, 2);
	MoveToFrame(door1, 0, 2);
	}
  return; 
pulse:
   if (GetThingSector(bot)==target)
	{
	SetPulse(0.0);
	Print("Ok, now i can repair door");
	reparied=1;
	}
   return;
killed:
   Print("Mission Failet. Please enter menu and press restart button or load last saved");
   Player=GetLocalPlayerThing()
   Teleportthing(Player, lostghost);
   return;
end
 


i also need to add sparky blowing from door in random moment. If someone can help ..

------------------
The miners of Kiith Somtaaw sacificed much, and risked all. For their efforts they were brought into the inner most circle of Hiigaren power. Naabal, S'jet, and Sobanii bowed before them. And from that day to this, Somtaaw's children have been known to one and all as Beastslayers..
2003-06-25, 7:56 AM #2
Maybe you could tell us what the cog isn't doing right. [http://forums.massassi.net/html/wink.gif]

------------------
"The Just shall live by faith." - Galatians 3:11
To edit is human... To COG is divine!!

pegasus_1984: Stop bushing that dang suck button.
guitarofgold: NOOOOOOOOO!!!!
-------[end post]-------
Catloaf, meet mouseloaf.
My music
2003-06-25, 10:27 PM #3
oh its pretty easy [http://forums.massassi.net/html/smile.gif] It dont work [http://forums.massassi.net/html/smile.gif]

Cog should control broken door - player had to move bot to door repair sector (that with pulse) and then door get reparied and works normaly.

------------------
The miners of Kiith Somtaaw sacificed much, and risked all. For their efforts they were brought into the inner most circle of Hiigaren power. Naabal, S'jet, and Sobanii bowed before them. And from that day to this, Somtaaw's children have been known to one and all as Beastslayers..
2003-06-26, 4:24 AM #4
I think I see two problems.

1)

Original:
if ((reparied==1) (GetSenderRef()==door0)||(GetSenderRef()==door1))

seems to be missing a logical operator - either && or ||, although im not sure this could cause the cog to not work.

Corrected:
if ((reparied==1) && (GetSenderRef()==door0)||(GetSenderRef()==door1))


2)

Original:
Player=GetLocalPlayerThing()

is missing it's ending semicolon. This usually will cause problems like total cog failure.

Corrected:
Player=GetLocalPlayerThing();


------------------
- Wisdom is 99% experience, 1% knowledge. -

[This message has been edited by The_New_Guy (edited June 26, 2003).]
- Wisdom is 99% experience, 1% knowledge. -
2003-06-26, 7:32 AM #5
Yes, the missing semicolon will probably cause the cog not to work because sometimes when I am writing cutscence cogs(those are usually long), I would accidently forget a semicolon and the whole thing would not work, and I would want to throw my computer out the window. Hehe

------------------
<MyseriousSith>(michael_kyle)

↑ Up to the top!