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 → Simple 00_generator cog modification needed
Simple 00_generator cog modification needed
2001-06-04, 10:18 AM #1
I need this cog:
It needs to be like the 00_generator cog except that each object will be destroyed after a changeable amount of seconds
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-06-04, 11:56 AM #2
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

That should do it.
2001-06-04, 12:43 PM #3
Thanks Aglar! Ill go see if it works right now!
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-06-04, 12:58 PM #4
Alright, to be honest I don't know if it will, I didn't test it.
2001-06-05, 4:23 AM #5
I tested it 3 minutes ago!! it works just right!! Thanx, Aglar!!!
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-06-05, 9:17 AM #6
Really? I didn't think it..
I mean, yeah, I knew it would work [http://forums.massassi.net/html/biggrin.gif]
You're welcome.
2001-06-05, 4:19 PM #7
Uh-oh, bad news for you aglar:

it was working fine, but now certain generators arent generating anything, and they aerent in any order....
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-06-06, 1:20 AM #8
Hmm. I had expected a problem, but it was totaly different.
2001-06-09, 2:30 AM #9
Turns out it was a template problem on all but one...but this one...it still wont work...
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-06-09, 5:22 AM #10
A template problem?
2001-06-09, 10:56 AM #11
Yeah, i deleted some things, and then renamed a few, so it kindof messed the cogs up, all i had to do was delete and replace them
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-06-09, 11:06 AM #12
I see, so it works?

↑ Up to the top!