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 → SuperNerd_IJ's big 'ol list of quin-n-easy cogs he needs
SuperNerd_IJ's big 'ol list of quin-n-easy cogs he needs
2001-12-18, 4:01 PM #1
I am in need a a few quick cogs, so if anybody has the time, could you PLEASE do them? i would be ever so grateful.

1)
Door onley open when you have the Imperial Stronghold key. Otherwise, plays 2 soudns, a click, and a "locked sound" locked sound is customiseable (also prints "locked" on top of screen)

2)
Same as above, except you need a "prybar key" to open it. The "click" sound doesent happen, though.(prints: stupid door!! on top of screen)

3)
COg that begins once you enter a sector: ghost camera one is the view, and an object animates, while a line of text appears. then the view goes to ghost camera 2. an object goes to a ghost object (walks) while explosions erupt from 8 different spots. Then the level ends.

4)
cog begins once you enter a sector. an object runs to a ghost object (off a ledge, so it might have to jump) once it reaches the object, explosions are generated at 8 ghost positions.

5) this one might not be possible:
take this cog and make it so each thing (variable in time, diff object generated, dif ghost position, diff time, EVERYTHING) is repeated 10 times, so its like 10 cogs in one?

Code:
# Jedi Knight Cog Script
#
# 00_GENERATOR.COG
#
# Generic Dark Forces like enemy generator.
#
# [YB]
#
# 8/29 - RKD, added trapdoor, in case generator doesn't appear on certain difficulties
# 04/06/01 - Aglar, modified to destroy the generated things after delay is reached
# (C) 1997 LucasArts Entertainment Co. All Rights Reserved

symbols
thing			generator_pos							desc=generator_ghost
template		enemy_tpl								desc=enemy_to_generate
flex			initial_delay=300.0					desc=initial_delay
flex			generate_delay=30.0					desc=generate_delay
int			generate_num=5							desc=generate_number
int			max_alive=3								desc=max_alive
flex			min_dist=0.0							desc=min_dist
flex			max_dist=1000.0						desc=max_dist
int			enemy										local
int			cur_num=0								local
int			cur_alive=0								local
flex			distance=0.0							local
int			delay
message		startup
message		user0
message		timer
message		pulse
message		killed									mask=0xfff
end
## Code Section
code
//-------------------------------------------------------------------------------------------------
startup:
	// if initial_delay == -1 then the generator will be started by SendMessage
	// user0 from another COG. Much like the WAKEUP message in DF...
	if (generator_pos == -1) return;	// if generator doesn't appear on this difficulty, quit
	
	if(initial_delay != -1) SetTimer(initial_delay);
	Return;
//-------------------------------------------------------------------------------------------------
user0:	
//-------------------------------------------------------------------------------------------------
timer:
	SetPulse(generate_delay);
//-------------------------------------------------------------------------------------------------
pulse:
	if((cur_alive < max_alive))
	{
		distance = VectorDist(GetThingPos(generator_pos), GetThingPos(jkGetLocalPlayer()));
		if((distance >= min_dist) && (distance <= max_dist))
		{
			if(!HasLOS(player, generator_pos))
			{
				enemy = CreateThing(enemy_tpl, generator_pos);
				CaptureThing(enemy);
				cur_num   = cur_num + 1;
				cur_alive = cur_alive + 1;
				SetLifeLeft(enemy, delay);
				// If we have generated enough enemies, end the pulse
				if(cur_num >= generate_num) SetPulse(0);
			}
		}
	}
	Return;
//------------------------------------------------------------------------------------------------
killed:
	// Note that this script is generic, so generated enemies won't drop powerups.
	// If dropped powerups are necessary, one script per enemy must be done...
	cur_alive = cur_alive - 1;
	Return;
end
The Situation:
The Sv_SetBrushModel: Null error has occurred in my map. This means that somewhere in my level, there is a paper-thin prush that needs to be deleted. There are 2888 brushes in my level. That's chances of 1/2888 of finding the correct brush. The statistics say I have a .035% chance of finding it.
Did I find it?
You bet I did.
2001-12-18, 5:24 PM #2
This cog will handle the first 2 requests.


Code:
# 11/2001 GBK
Symbols
Message Activated
Message Arrived
Message Blocked
Message Timer
Thing Door
Thing Player   Local
Flex Door_speed=4.0
Flex Door_sleep=4.0
Int Key_num=43
Int UNI_num=101		#UNI string number.  Take this number from your cog strings file.
Sound Locked
Sound Click
Int Play_click=1		#Play click sound?  0/1 = no/yes
End
Code
Activated: Player = JKGetlocalplayer();
If(Getsenderref() == Door) { If(Getinv(Player, Key_num) == 1) { 
If(Getcurframe(Door) == 0 && Isthingmoving(Door) == 0) {
Movetoframe(Door, 1, Door_speed); } }
Else { JKPrintunistring(Player, UNI_num);
Playsoundthing(Locked, Player, 1.0, -1, 10, 0);
If(Play_click != 0) {
Playsoundthing(Click, Door, 1.0, -1, 100, 0); } } } Stop;
Arrived: If(Getcurframe(Door) == 1) { Settimer(Door_sleep); } Stop;
Blocked: Movetoframe(Door, 1, Door_speed); Stop;
Timer: Movetoframe(Door, 0, Door_speed); Stop;
End


The variables:


Key_num: This is the BIN number of the required key. It is preset to the 'Imperial key', but you can set it as anything.

UNI_num: The UNI string number for the outputted message.

Play_click: Determines wheter or not to play the 'Clicking' noise. 0/1 = no/yes

To set the UNI string:


Hit F8 to bring up the episode editor.

Click on 'Edit strings'.

Type 'COG_101' into the 'Key' box.

Type the message you want to appear into the 'String' box.

Click on 'Add/Update'.

Close the strings editor, and save the episode.

 

If you used a different number, other than 101, update it accordingly into the 'UNI_num' variable.


------------------
Success is the inverse relationship between effort, gain, and loss.
And when the moment is right, I'm gonna fly a kite.
2001-12-18, 11:34 PM #3
GBK...you're a stud [http://forums.massassi.net/html/biggrin.gif]

------------------
-There are easier things in life than finding a good woman, like nailing Jello to a tree, for instance

-Tazz
-There are easier things in life than finding a good woman, like nailing Jello to a tree, for instance

Tazz
2001-12-19, 2:13 PM #4
I found it SuperNerd. I didn't realize you had this new of a post. I was thinking of the old one. There are cogs already in MotS for the first two (unless I'm misunderstanding something, which I probably am). I will see what I can do on the lever cutscene you were talking about.

------------------
Ohh Crap! - Darien Fawkes (The Invisible Man)
Ohh Crap! - Darien Fawkes (The Invisible Man)

↑ Up to the top!