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 → Generator cog....
Generator cog....
2001-07-09, 4:11 PM #1
i need a cog that can generate things..... IE bacta ... or guns
Quote Originally Posted by FastGamerr
"hurr hairy guy said my backhair looks dumb hurr hairy guy smash"
2001-07-10, 6:55 AM #2
Use a simple enemy generator already in the game, or use this one I have:

Code:
#enemygenmp.cog
#
#The thing is the number of the ghost object where the enemy is spawned
#
#The template is the enemy you want to use
#
#The gen_num is how many total enemies you want before the cog stops respawning them
#
#The max_alive is how many enemies are alive at once
#
# ====================================
					    
symbols

message	startup
message	user0
message	timer
message	pulse
message	killed	mask=0xfff

thing		generator_pos		desc=generator_ghost

template	enemy_tpl			desc=enemy_to_generate

int		initial_delay=1.0		local		desc=initial_delay
int		generate_delay=5.0	local		desc=generate_delay
int		min_dist=0.0		local		desc=min_distance
int		max_dist=1000.0		local		desc=max_distance

float		distance=1.0	local

cog		squadmaker		local

int		enemy			local
int		cur_num=0		local
int		cur_alive=0		local
int		generate_num	
int		max_alive				desc=max_alive

end

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

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(initial_delay != -1) SetTimer(initial_delay);
	Return;

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

user0:	
// FIXME!! remove next line when parsing bug is corrected
	enemy = enemy;
	// fall through on purpose

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

timer:
	SetPulse(generate_delay);
	// fall through on purpose

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

pulse:
	if((cur_alive < max_alive))
	{
		distance = VectorDist(GetThingPos(generator_pos), GetThingPos(GetLocalPlayerThing()));
		if((distance >= min_dist) && (distance <= max_dist))
		{
			if(IsThingVisible(generator_pos)==0)
			{
				enemy = CreateThing(enemy_tpl, generator_pos);
				CaptureThing(enemy);

				cur_num   = cur_num + 1;
				cur_alive = cur_alive + 1;

				// If we have generated enough enemies, end the pulse
				if(cur_num >= generate_num) SetPulse(0);
			}
		} 
	}
	return;

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

killed:
	cur_alive = cur_alive - 1;
	SendMessage(squadmaker, user0);
	return;

end


Just use whatever cog you want thats a generator, and make the template the bacta or the gun you want. In this cog I've posted, you can put how many you want to respawn from the ghost at one time (but 1 would work for objects) and how many you want it to make total, and that sort of stuff. So try this one or another cog thats already in JK. Does that answer your question?



------------------
"Let my life cry Holy, Holy. Let my life scream Holy, Holy. I do believe that Your the only Way so let my life cry Holy..."

The Bible is the only religious book to actually state that it is the truth and the only way. Thats why I'm a Christian.

_-=MaTRiX=-_
In my mind I can see your face, as Your love pours down in a shower of grace. Some people tell me that Your just a dream, but my faith is the evidence of things unseen.

Once upon a time God spoke to me, and then I was never the same again.

_-=MaTRiX=-_
2001-07-10, 10:36 AM #3
Yea thanks ... i'll try this one.....

Quote Originally Posted by FastGamerr
"hurr hairy guy said my backhair looks dumb hurr hairy guy smash"

↑ Up to the top!