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 → In need of a very complicated cog for the levelboss of APT
In need of a very complicated cog for the levelboss of APT
2002-09-01, 3:28 AM #1
At the end of the A Pirate's Tale series for mots you will have to defeat a levelboss.
And making the cog for this baby is a bit out of my league...

Ok, we have a square hall, and the boss is stationary and constantly plays a specific key.
The player has to stay on the side, on which he will find a circular way up, at some place he'll be protected by walls, machinery or pipes, but mostly he's in plane sight of the boss.
The boss should fire lighting beams to various directions all arround him, at very small random intervalls, these should do a certain ammount of damage (to your shield first and when that is out to your health).
Then their should be one beam of lighting which will home at the player, at random somewhat bigger intervals. (same thing with the damage)

I was experimentating a bit with the homing beam, but I found out that it has a maximum range, which by long doesn't make it through the entire hall, how can that be fixed?

At the begin of the cog the enemy should be created at a ghost position after a defineble ammount of time (before this boss will be a small cutscene). And when a certain switch is pressed the entire cog will stop.

Explanatory pic:
[http://www.massassi.net/ec/images/6784.jpg]



[This message has been edited by ZOOIkes (edited September 01, 2002).]
APT 1, 2, 3/4, 5/6
TDT
DMDMD

http://veddertheshredder.com
2002-09-02, 10:06 AM #2
complicated huh? [http://forums.massassi.net/html/smile.gif]
APT 1, 2, 3/4, 5/6
TDT
DMDMD

http://veddertheshredder.com
2002-09-02, 10:59 AM #3
But not too complicated. [http://forums.massassi.net/html/wink.gif]

Do you want the boss to fire at the player only, to random locations in the room, or both? Are there any special effects when the boss starts / stops?

If you could send me the boss-chamber part of your level, it would make writing the cog much easier. [http://forums.massassi.net/html/smile.gif]

------------------
Author of the JK DataMaster, Parsec, Scribe, and the EditPlus Cog Files.

[This message has been edited by SaberMaster (edited September 02, 2002).]
Author of the JK DataMaster, Parsec, Scribe, and the EditPlus Cog Files.
2002-09-02, 11:13 AM #4
Well, I assume that SaberMaster has this one covered. Grismath moving out.
Cordially,
Lord Tiberius Grismath
1473 for '1337' posts.
2002-09-03, 4:27 AM #5
Both, fire at random locations AND fire towards the player.

It's completely finished yet, but I'll implent/build the basic architecture ASAP, and then I'll mail it to you.

Thanks.
APT 1, 2, 3/4, 5/6
TDT
DMDMD

http://veddertheshredder.com
2002-09-03, 6:23 AM #6
Alright, I'll await your email. [http://forums.massassi.net/html/wink.gif]

------------------
Author of the JK DataMaster, Parsec, Scribe, and the EditPlus Cog Files.
Author of the JK DataMaster, Parsec, Scribe, and the EditPlus Cog Files.
2002-09-06, 5:32 AM #7
I probably have little time comming days so it might take a while. Just so you know.
APT 1, 2, 3/4, 5/6
TDT
DMDMD

http://veddertheshredder.com
2002-09-06, 7:45 AM #8
Ok, take your time. [http://forums.massassi.net/html/wink.gif]

------------------
Author of the JK DataMaster, Parsec, Scribe, and the EditPlus Cog Files.
Author of the JK DataMaster, Parsec, Scribe, and the EditPlus Cog Files.
2002-09-08, 11:48 AM #9
I received your email, and I'll get to work on the cog. [http://forums.massassi.net/html/wink.gif]
Author of the JK DataMaster, Parsec, Scribe, and the EditPlus Cog Files.
2002-09-08, 12:32 PM #10
*Starts stopwatch*

------------------
I used to believe that we only want what we can't have. I was wrong. The truth is, the wonderful truth is, we only want what we think we can't have.

JK editing resources.
And when the moment is right, I'm gonna fly a kite.
2002-09-09, 9:58 AM #11
Ah, you should have said in advance I was going to be timed. [http://forums.massassi.net/html/tongue.gif]

Here's the code:

Code:
# boss.cog
#
# Control cog for a level boss.
#
# Variables:
#
# switch
#	This switch, when activated, will disable the boss.
#
# spawnGhost
#	A ghost at which the boss will be created.
#
# bossTemp
#	The template for the boss thing.
#
# weapBeam
#	The boss's weapon.
#
# fireSound
#	The sound played when the boss fires.
#
# startWait
#	The length of time before the boss is created.
#
# randBeamRate
#	The rate at which the boss will fire bursts of random
#	projectiles.
#
# homeBeamRate
#	The rate at which the boss will fire a homed projectile. This
#	should be a multiple of the randBeamRate so that the homed
#	weapon will be fired with the burst of random projectiles.
#
# isWeapInstant
#	If you're using a weapon that reaches its destination almost
#	instantly, then set this to 1. Otherwise, leave it at 0.
#
# numRandBeams
#	The number of random projectiles to be fired in a burst.
#
# [GBK + ZI + SM]
#==============================================================#
symbols

message   startup
message   pulse
message   timer
message   activated

surface   switch

thing     spawnGhost
thing     player          local
thing     weapon          local
thing     boss            local

vector    vec             local
vector    veldif          local
vector    moved           local
vector    meetpos         local
vector    lvec            local

template  bossTemp
template  weapBeam

sound     fireSound

flex      startWait
flex      randBeamRate
flex      homeBeamRate
flex      speed           local
flex      distance        local
flex      time            local

int       isWeapInstant
int       numRandBeams
int       i               local
int       disabled=0      local

keyframe  standKey
keyframe  fireKey

end
#==============================================================#
code
#------------------------------------------------------
startup:
	player = GetLocalPlayerThing();
	Sleep(startWait);
	boss = CreateThing(bossTemp, spawnGhost);
	DestroyThing(spawnGhost);
	PlayKey(boss, standKey, 1, 0);
	SetPulse(0.1);
	SetTimerEx(randBeamRate, 1, 0, 0);
	SetTimerEx(homeBeamRate, 3, 0, 0);

Stop;
#------------------------------------------------------
pulse:
	AISetLookPos(boss, GetThingPos(player));

Stop;
#------------------------------------------------------
timer:
	if(GetSenderID() == 1)
	{
		if(HasLOS(boss, player)) for(i = 0; i < numRandBeams; i = i + 1) SetTimerEx(Rand(), 2, 0, 0);
		SetTimerEx(randBeamRate, 1, 0, 0);
	}
	else if(GetSenderID() == 2)
	{
		if(!isWeapInstant)
		{
			weapon = FireProjectile(boss, weapBeam, fireSound, -1, '0 0 0', '0 0 0', 0, 0x0, 0, 0);
			vec = VectorNorm(VectorSet(Rand() * 2 - 1, Rand() * 2 - 1, Rand() * -2 + 1));
			speed = VectorLen(GetThingVel(weapon));
			SetThingLook(weapon, vec);
			SetThingVel(weapon, VectorScale(vec, speed));
		}
		else
		{
			weapon = FireProjectile(boss, weapBeam, fireSound, -1, '0 0 0', '0 0 0', 0, 0x0, 0, 0);
			vec = VectorNorm(VectorSet(Rand() * 2 - 1, Rand() * 2 - 1, Rand() * -2 + 1));
			SetThingLook(weapon, vec);
		}
		PlayKey(boss, fireKey, 3, 0x38);
	}
	else if(GetSenderID() == 3)
	{
		if(HasLOS(boss, player))
		{
			if(!isWeapInstant)
			{
				weapon = FireProjectile(boss, weapBeam, fireSound, -1, '0 0 0', '0 0 0', 0, 0x0, 0, 0);
				veldif = VectorSub(GetThingVel(weapon), GetThingVel(player));
				speed = VectorLen(veldif);
				distance = VectorDist(GetThingPos(player), GetThingPos(weapon));
				time = distance / speed;
				moved = VectorScale(GetThingVel(player), time);
				meetpos = VectorAdd(GetThingPos(player), moved);
				lvec = VectorNorm(VectorSub(meetpos, GetThingPos(weapon)));
				SetThingLook(weapon, lvec);
				SetThingVel(weapon, VectorScale(lvec, VectorLen(GetThingVel(weapon))));
			}
			else weapon = FireProjectile(boss, weapBeam, fireSound, -1, '0 0 0', '0 0 0', 0, 0x20, 180, 180);
			PlayKey(boss, fireKey, 3, 0x38);
		}
		SetTimerEx(homeBeamRate, 3, 0, 0);
	}

Stop;
#------------------------------------------------------
activated:
	if(GetSenderRef() != switch || disabled) Return;
	disabled = 1;
	SetWallCel(switch, 1);
	KillTimerEx(1);
	KillTimerEx(3);
	SetPulse(0);

Stop;
#------------------------------------------------------
end


It should work as it is, but reply if it needs changes.

I noticed in your cog, you used the condition:
Code:
&& Getthingsector(I) == Zone|Zone1

The '|' operator is the bitwise OR - it takes two numbers and returns a number with the bits of both numbers. Neither the logical or bitwise OR operator can be used that way. It should be done like this:
Code:
&& (GetThingSector(i) == zone || GetThingSector(i) == zone1)

The parens are used there to force the logical OR operation to be evaluated first.

The reason your beam weapons aren't reaching their targets is that either the projectiles are ranged or they have a short timer. Look in their templates for a range or timer setting. If you find a range setting, remove it and make sure that none of the template's parents have one. You could also increase the range which might be a better solution.

But if there isn't a range setting, then look at the timer setting. If it's below three seconds and your weapon would take more than three seconds to reach its target, then raise the timer.

Good luck with your project. [http://forums.massassi.net/html/wink.gif]

------------------
Author of the JK DataMaster, Parsec, Scribe, and the EditPlus Cog Files.
Author of the JK DataMaster, Parsec, Scribe, and the EditPlus Cog Files.
2002-09-10, 7:12 AM #12
Ok, thanks alot for the cog!

It's not working exactly how I want it yet, but I think that's more of an AI/template problem.
APT 1, 2, 3/4, 5/6
TDT
DMDMD

http://veddertheshredder.com
2002-09-10, 9:37 AM #13
You're welcome. [http://forums.massassi.net/html/wink.gif]

BTW, my boss template used the 0x40000 Actor Flag to keep the boss from moving around. And for the cog's AISetLookPos() command to work, the boss will need some kind of AI, though it doesn't have to be aggressive.

------------------
Author of the JK DataMaster, Parsec, Scribe, and the EditPlus Cog Files.
Author of the JK DataMaster, Parsec, Scribe, and the EditPlus Cog Files.
2002-09-11, 9:07 AM #14
Hmm, it's getting in the correct direction now. Thanks.
APT 1, 2, 3/4, 5/6
TDT
DMDMD

http://veddertheshredder.com
2002-09-13, 5:28 AM #15
It's comming out better and better. w00t [http://forums.massassi.net/html/smile.gif]

I have one little problem though. And that is the thinglimit. (gbk: and in this case it really is! [http://forums.massassi.net/html/wink.gif])

The fact is that besides the boss I have alot more lightningproducing obejects (machinery and all.)
And because of that the thingcount rises and lowers very quickly continually. I first had the 'numrandbeams' of the cog at 14 (which was a tad exaggerated anyway). and some more lightningcogs, making the thinglimit rising above 600 causing mots to crash.
I now have the numrandbeams at 7 (which is enough) and some lightningcogs and the thinglimit rises to 200+. I still have to place alot more lightningcogs so I wondered if you could change the lightning 3do, template or cog in such a way that it uses less 3do's in a beam. (by using longer 3do's for example.)

I'm using +force_lightning as the template btw.

(Hmm, this is probably not really cogrelated anymore. Should I post it at the other forum?)
APT 1, 2, 3/4, 5/6
TDT
DMDMD

http://veddertheshredder.com
2002-09-13, 1:22 PM #16
No, it can stay in this forum.

To make the lightning projectile create fewer trailthings, you'll need to modify its elementsize setting. The higher you make it, the larger JK expects the trailthing will be and the fewer it will create. You'll also need to modify force_ltpiece's model3d. You could just take ligt2.3do and make it twice as long.

------------------
Author of the JK DataMaster, Parsec, Scribe, and the EditPlus Cog Files.
Author of the JK DataMaster, Parsec, Scribe, and the EditPlus Cog Files.

↑ Up to the top!