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 → Same level different cog...
Same level different cog...
2001-11-09, 7:14 AM #1
here's the other cog, it was originally the sectorthrust cog, but you probly noticed that at first glance.
I wanted to alter it so that you don't get sucked in a specific direction like (1/0/0) but instead you get sucked in the direction of the thing(fan)

it didn't work...

can anyone help me?


Code:
# Jedi Knight Cog Script
#
#
# [YB]
#
# (C) 1997 LucasArts Entertainment Co. All Rights Reserved
# generic sector thrust script
#
# This script will control 1-8 sector thrust sectors thrusting in the same direction
# and with the same velocity.  The thrusts run continuously.

symbols
message		startup	


thing			fan
float		speed=1.0	desc=thrust_speed

sector		sector0	
sector		sector1	
sector		sector2	
sector		sector3	
sector		sector4	
sector		sector5	
sector		sector6	
sector		sector7	
end


code

//-----------------------------------------------------------------------------

startup:
	if (sector0 >= 0) SectorThrust(sector0, GetThingPos(fan), , speed);
	if (sector1 >= 0) SectorThrust(sector1, GetThingPos(fan), , speed);
	if (sector2 >= 0) SectorThrust(sector2, GetThingPos(fan), , speed);
	if (sector3 >= 0) SectorThrust(sector3, GetThingPos(fan), , speed);
	if (sector4 >= 0) SectorThrust(sector4, GetThingPos(fan), , speed);
	if (sector5 >= 0) SectorThrust(sector5, GetThingPos(fan), , speed);
	if (sector6 >= 0) SectorThrust(sector6, GetThingPos(fan), , speed);
	if (sector7 >= 0) SectorThrust(sector7, GetThingPos(fan), , speed);
	return;
end


------------------
SDÅ_Lªkútí
SDÅ_Lªkútí
2001-11-09, 8:15 AM #2
The problem with using 'Getthingpos()' for sectorthrust is, world coords start at the center of the level, and the pos of an object is a world coord. The only way the thrust would be straight up/down/left/right is if thats what the pos of the fan is, relitive to the xyz plane. Your better off using straight vectors...


Just keep tweaking them till you get it right.



------------------
Success is the inverse relationship between effort, gain, and loss.
And when the moment is right, I'm gonna fly a kite.
2001-11-09, 8:35 AM #3
well, the reason i wanted to d oit this way was because the main sector is larger the the width of hte fan, so it is obious that the fan isn't suckign you in, when you are stuck the wall right next to it.. :-\ and i can't really cut up the level cuz i've already had HOM probs..

------------------
SDÅ_Lªkútí
SDÅ_Lªkútí
2001-11-09, 11:50 AM #4
Even if your level were built specifically for that cog, it still wouldnt do what you need. It would still produce a sectorthrust in a single direction. The only way to solve your problem is to cleave the level, or make some round invisible 3d0 funnel that the player would be guided through.

------------------
Success is the inverse relationship between effort, gain, and loss.
And when the moment is right, I'm gonna fly a kite.
2001-11-12, 10:57 AM #5
I think this should do what you want... might have to change the pulse speed tho.

Code:
# Jedi Knight Cog Script
#
# fan_thrust.cog
#
# [RISHKA]
#

symbols

message		startup
message		pulse

thing		fan
float		speed=1.0	desc=thrust_speed

int		i		local
int		type		local
int		thrust_thing	local

sector		sector0
sector		sector1
sector		sector2
sector		sector3
sector		sector4
sector		sector5
sector		sector6
sector		sector7

end

code

//-----------------------------------------------------------------------------

startup:
	SetPulse(0.1);
	return;

pulse:
	thrust_thing = -1;

	for (i = 0; i < 8; i = i + 1)
 	   if (sector0 >= 0)
	   {
		thrust_thing = FirstThingInSector(sector0);
		while (thrust_thing != -1)
		{
			type = GetThingType(victim);
			// If we have an actor (2) or a player (10)
			if ((type==2) || (type==10))
			{
				Print("Thrust the player!");
				DetachThing(thrust_thing);
				SetThingVel(thrust_thing, VectorScale(VectorSub(GetThingPos(fan), GetThingPos(thrust_thing)), speed));
			}

			thrust_thing = NextThingInSector(thrust_thing);
		}
	   }

	return;

end

↑ Up to the top!