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 → waypoint cog thingy
waypoint cog thingy
2003-12-12, 2:25 AM #1
I've tried to cog it myself a few times, others have tried it but nothing ever worked.
(unfortunately that was all a long time ago, and I deleted all the cog attempts + it's been a long time that I didn't cog anything)

The problem seems rather easy (at least it does that to me):
I'm in need of a cog that reacts on the player entering a sector.

we have:
- the player (obvious)
- technican (an AI controlled friend)
- a door
- four ghost waypoints (they're also saved as frames. I've tried everything...)

Once the player entered 'sector' a strifle (how much ammo does the strifle-pickup give?) is added to his weapons inventory thing.
The technican begins to move to the first position, continues to the second. Now a door opens (IMPORTANT: it has to open on playeractivation, too), he passes the door to waypoint three, and goes on to four, and then stops there... (A cutscene will be launched so he should be free to go where another cog sends him.)

sounds easy (I think) but it never worked right...

------------------
* Elmo is still Elmo

[This message has been edited by 2nd_Elmo (edited December 12, 2003).]
* Elmo is still Elmo
http://www.elmoo.com
2003-12-12, 3:27 AM #2
the following cog is untested, but should do what you want. if your nice to it..

Code:
#----------------------------------jk cog scrpit---------------------------------
#-------------------------------------[PJB]--------------------------------------
#--- move a actor about, open a door, and just incase.. give the palyer a ST rifle


symbols
thing       powerup                          local
thing       player                           local
int         bin=3                            local
int         ammobin=11                       local
sound       pickupsnd=thrmlpu2.wav           local
sound       respawnsnd=Activate01.wav        local
flex        amount                           local

int         bin_contents=0                   local
int         autopickup=0                     local
int         autoselect_weapon=-1             local
sector trig
message entered
message startup
vector pos1
vector pos2
vector pos3
vector pos4
flex sleep1
flex sleep2
flex sleep3
thing waypoint1
thing waypoint2
thing waypoint3
thing waypoint4
thing	actor
thing	door
end
code
startup:
pos1=GetThingPos(waypoint1); 
pos2=GetThingPos(waypoint2); 
pos3=GetThingPos(waypoint3); 
return;

entered:
//--st rifle
   player = GetSourceRef();
   powerup = GetSenderRef();

   // Do effects.
   PlaySoundThing(pickupsnd, powerup, 1.0, -1, -1, 0);
   AddDynamicTint(player, 0.0, 0.0, 0.2);

   if(GetInv(player, bin) == 0)
   {
      // Pickup gun and ammo.
      // Print("Stormtrooper Rifle");
      jkPrintUNIString(player, bin);

      ChangeInv(player, bin, 1.0);

      // store the old bin contents
      bin_contents = GetInv(player, ammobin);
      ChangeInv(player, ammobin, 24.0);

      // Check for Auto Pickup
      autopickup = GetAutoPickup();
      if(autopickup & 1)
      {
         if(!((autopickup & 4) && (GetWeaponPriority(player, GetCurWeapon(player), 0) >= GetWeaponPriority(player, bin, 0))))
         {
            if(!((autopickup & 8) && (GetCurWeapon(player) == 10)))
            {
               SelectWeapon(player, bin);
               Return;
            }
         }
      }

      // Check for Auto Reload
      if(GetAutoReload() & 1)
      {
         if(!bin_contents)
         {
            if(!((GetAutoReload() & 2) && (GetCurWeapon(player) == 10)))
            {
               // Try to autoselect and see if the best weapon is an energy cell weapon
               autoselect_weapon = AutoSelectWeapon(player, 2);
               if((autoselect_weapon == 2) || (autoselect_weapon == 3))
                  SelectWeapon(player, autoselect_weapon);
            }
         }
      }
   }
   else
   if(GetInv(player, ammobin) < GetInvMax(player, ammobin))
   {
      // Pickup ammo only.
      // Print("Energy Cells");
      jkPrintUNIString(player, ammobin);

      // store the old bin contents
      bin_contents = GetInv(player, ammobin);

      ChangeInv(player, ammobin, 24.0);

      // Check for Auto Reload
      if(GetAutoReload() & 1)
      {
         if(!bin_contents)
         {
            if(!((GetAutoReload() & 2) && (GetCurWeapon(player) == 10)))
            {
               // Try to autoselect and see if the best weapon is an energy cell weapon
               autoselect_weapon = AutoSelectWeapon(player, 2);
               if((autoselect_weapon == 2) || (autoselect_weapon == 3))
                  SelectWeapon(player, autoselect_weapon);
            }
         }
      }
   }
//-end strifle
AISetMovePos(actor, pos1); 
AISetMoveThing(actor, waypoint1);
sleep(sleep1);
AISetMovePos(actor, pos2); 
AISetMoveThing(actor, waypoint2);
movetoframe(door,1,5);
sleep(sleep2);
AISetMovePos(actor, pos3); 
AISetMoveThing(actor, waypoint3);
movetoframe(door,0,5);
sleep(sleep3);
AISetMovePos(actor, pos4); 
AISetMoveThing(actor, waypoint4);
return;
end


------------------
I am pjb.
Another post......
another moment of my life wasted.....
at least i made a level.
PJB's JK page's

-the PJB jedi rule book-
rule one, "never trust a bartender with bad grammar"-kyle katarn in JO

Rule Two, "Gravity is a crule misstress" -kyle katarn in MotS, and the alternatior MK I in AJTD
I am Darth PJB!
well, go on, run away!

i have a plastic lightsaber and a jedi cape.. am i a nerd?

If gravity is a crule mistress, and bar tenders with bad grammar are untrustworthy, what is air?
2003-12-12, 3:32 AM #3
oh, and if you want the door to open by a palyer too. just give it the following door cog (to prevent HOM)

Code:
 Jedi Knight Cog Script
#
# 00_Door.cog
#
# Generic Door Script
#
# [IS]
# [PJB]
#	
# modifed by PJB on the 12, december, 2003 to NOt change sector adjoins.
#
# (C) 1997 LucasArts Entertainment Co. All Rights Reserved
# ========================================================================================

symbols
	message	startup		
	message	activate	
	message	arrived		
	message	timer		
	message	blocked		

	thing		door0		linkid=0 mask=0x405
	thing		door1		linkid=1 mask=0x405
	thing		door2		linkid=2 mask=0x405
	thing		door3		linkid=3 mask=0x405

	float		moveSpeed=8.0
	float		sleepTime=2.0
	float		lightValue=0.5

	sector	doorSector	local
	int		numDoors=0	local
	int		doorStatus	local
	int		moveStatus	local
	int		i				local
end

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

code

startup:
	for (i=0; i<=3; i=i+1)
		if (door0 >= 0) numDoors = numDoors + 1;

	doorSector = GetThingSector(door0);
	SetSectorLight(doorSector, lightValue, 0.0);		// add some light to door sector
	return;

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

activate:
	call CheckStatus;
	if (moveStatus) return;
	if (doorStatus == 0) {					// all pieces are at frame 0
		call OpenDoors;
	}
	return;

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

arrived:
	call CheckStatus;
	if (moveStatus) return;
	if (doorStatus == numDoors) {				// all pieces are at frame 1
		SetTimer(sleepTime);
	} else if (doorStatus == 0) {				// all pieces are at frame 0

	}
	return;

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

blocked:
	call OpenDoors;
	return;

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

timer:
	call CloseDoors;
	return;

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

OpenDoors:
	for (i=0; i<=3; i=i+1)
		if (door0 >= 0) MoveToFrame(door0, 1, moveSpeed);
	return;

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

CloseDoors:
	for (i=0; i<=3; i=i+1)
		if (door0 >= 0) MoveToFrame(door0, 0, moveSpeed);
	return;

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

CheckStatus:
	moveStatus = 0;
	doorStatus = 0;

	for (i=0; i<=3; i=i+1) {
		if (door0 >= 0) {
			moveStatus = moveStatus + IsThingMoving(door0);
			doorStatus = doorStatus + GetCurFrame(door0);
		}
	}
	return;

end


------------------
I am pjb.
Another post......
another moment of my life wasted.....
at least i made a level.
PJB's JK page's

-the PJB jedi rule book-
rule one, "never trust a bartender with bad grammar"-kyle katarn in JO

Rule Two, "Gravity is a crule misstress" -kyle katarn in MotS, and the alternatior MK I in AJTD
I am Darth PJB!
well, go on, run away!

i have a plastic lightsaber and a jedi cape.. am i a nerd?

If gravity is a crule mistress, and bar tenders with bad grammar are untrustworthy, what is air?
2003-12-12, 6:34 AM #4
just looking at it I'd say, yes that would make the actor move... the player blocking (even accidently) the actor would screw it all up.

[EDIT]okay, tested it now... I get the weapon, but then nothing happens, the technican doesn't move AND the door doesn't open. I told you it's strange... [/EDIT]

------------------
* Elmo is still Elmo

[This message has been edited by 2nd_Elmo (edited December 12, 2003).]
* Elmo is still Elmo
http://www.elmoo.com
2003-12-12, 9:40 AM #5
Is the technician out of sight? That would do so that the technician doesn't move...
Edward's Cognative Hazards
2003-12-12, 10:03 AM #6
You and the technican are teleported in the "sector" after a cutscene was played. The technican starts walking and you're supposed to follow him.

[EDIT]Got the technican moving, but the door doesn't open. Now all I need is a cog that opens the door when the technican enters the "door sector". (the player must be able to open the door at any time).[/EDIT]

------------------
* Elmo is still Elmo

[This message has been edited by 2nd_Elmo (edited December 13, 2003).]
* Elmo is still Elmo
http://www.elmoo.com

↑ Up to the top!