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 → Cogs cogs everywhere and none that I can use!
Cogs cogs everywhere and none that I can use!
2002-07-08, 11:44 AM #1
I know there's alot of expert Coggers around here, and ALOT of very very nice people [http://forums.massassi.net/html/biggrin.gif] I'd like to ask if anyone knows how to make a cog that will allow u to explode a barrel, but when u do, it locks the door to the secter and won't let u open it, while it drains ur health until ur dead, then it regenerates the barrel and unlocks the door.

I hope it's possible, I hope it's feasible, and I hope there's some really nice people here who would help me!

Thanx!
2002-07-08, 4:47 PM #2
I wouldn't say there's alot of expert coggers, because even I don't consider myself one (just an advanced one [http://forums.massassi.net/html/wink.gif] ). But there are alot of nice people here. [http://forums.massassi.net/html/biggrin.gif] I think this cog should work for you.
Code:
# Demo cog for DaCrazyOne
#
# Not a class cog
#
# [DP]
#
symbols
thing      barrel
thing      door
int        shooter                     local
int        doorSector                  local
int        barrelSector                local
int        moveStatus=0                local
int        garbage=-1                  local
int        dummy=0                     local
int        locked                      local
vector     pos                         local
vector     pyr                         local
flex       moveSpeed=8.0
flex       sleepTime=2.0
flex       lightValue=0.5
flex       pulseRate
flex       pulseDamage
sound      lockSound=df_door2-3.wav    local
template   barrelTemplate              local
message    startup
message    activated
message    arrived
message    blocked
message    damaged
message    pulse
end
# ........................................................................................
code
startup:
   doorsector = GetThingSector(door);
   SectorAdjoins(doorSector, 0);
   SectorLight(doorSector, lightValue, 0.0);
   locked = 0;
   Return;

# ........................................................................................
Activated:
   If(locked)
   {
      dummy = PlaySoundLocal(lockSound, 1, 0, 0);
   }
   Else
   {
      Call checkstatus;
      If (moveStatus) Return;
      If (GetCurFrame(door) == 0)
      {
         SectorAdjoins(doorSector, 1);
         Call open_doors;
      }
   }
   Return;
# ........................................................................................
Arrived:
   Call checkstatus;
   If(moveStatus) Return;
   If(GetCurFrame(door) == 1)
   {
      Sleep(sleepTime);
      call close_doors;
   }
   Else If(GetCurFrame(door) == 0)
   {
      SectorAdjoins(doorSector, 0);
   }
   return;
# ........................................................................................
Blocked:
   Call open_doors;
   Return;
# ........................................................................................
Damaged:
   If(GetSourceRef() != barrel) Return;
   Shooter = GetThingParent(GetSenderRef());
   SetPulse(pulseRate);
   locked = 1;
   pos = GetThingPos(barrel);
   pyr = GetThingLVec(barrel);
   barrelSector = GetThingSector(barrel);
   barrelTemplate = GetThingTemplate(barrel);
   DestroyThing(barrel);
   Return;
# ........................................................................................
Pulse:
   DamageThing(shooter, damage, 0x1, shooter);
   If(GetThingHealth(shooter) < 1) Call replace;
   Return;
# ........................................................................................
replace:
   barrel = CreateThingAtPos(barrelTemplate, barrelSector, pos, pyr);
   locked = 0;
   Return;
open_doors:
   MoveToFrame(door, 1, moveSpeed);
   Return;
close_doors:
   MoveToFrame(door, 0, moveSpeed);
   Return;
checkstatus:
   moveStatus = IsMoving(door);
   Return;
end
Big one, isn't she. [http://forums.massassi.net/html/wink.gif] Hope this helps. Any questions about what anything does, just ask. I wonder where GBK is?

------------------
The Sniper Missions. Current project, The Sniper Missions

[This message has been edited by Descent_pilot (edited July 08, 2002).]
Major projects working on:
SATNRT, JK Pistol Mod, Aliens TC, Firearms

Completed
Judgement Day (HLP), My level pack
2002-07-09, 4:28 AM #3
Welcome to Massassi, CrazyOne. [http://forums.massassi.net/html/wink.gif]

Pilot, there were some fatal flaws in your cog, so I fixed it up some:

Code:
# deathbarrel.cog
#
# Locks a door when a barrel is destroyed and damages the player
# who destroys it.
#
# [DP + SM]
#==============================================================#
symbols

thing     barrel
thing     door

int       shooter                    local
int       doorSector                 local
int       locked=0                   local

flex      damage                     local
flex      doorSpeed=8.0
flex      openWait=2.0
flex      lightValue=0.5
flex      pulseRate
flex      barrelHull
flex      pulseDamage
flex      hull                       local

template  barrel_exp=+xtank3_exp

sound     lockSound=df_door2-3.wav

message   startup
message   activated
message   arrived
message   blocked
message   damaged
message   pulse
message   timer

end
#==============================================================#
code
#------------------------------------------------------
startup:
	CaptureThing(barrel);
	doorSector = GetThingSector(door);
	SetThingUserData(barrel, barrelHull);
	SectorAdjoins(doorSector, 0);
	SectorLight(doorSector, lightValue, 0);

Return;
#------------------------------------------------------
activated:
	if(locked)
	{
		PlaySoundThing(lockSound, door, 1, -1, -1, 0x0);
	}
	else
	{
		if(IsMoving(door) || GetCurFrame(door) == 1) Return;
		SectorAdjoins(doorSector, 1);
		MoveToFrame(door, 1, doorSpeed);
	}

Return;
#------------------------------------------------------
arrived:
	if(GetCurFrame(door) == 1)
	{
		Sleep(openWait);
		MoveToFrame(door, 0, doorSpeed);
	}
	else if(GetCurFrame(door) == 0)
	{
		SectorAdjoins(doorSector, 0);
	}

Return;
#------------------------------------------------------
blocked:
	MoveToFrame(door, 1, doorSpeed);

Return;
#------------------------------------------------------
damaged:
	if(GetSenderRef() != barrel || GetParam(1) == 1 || locked) Return;
	damage = GetParam(0);
	hull = GetThingUserData(barrel);
	if(hull <= damage)
	{
		SetTimerEx(0.80, 1, 0, 0);
		shooter = GetThingParent(GetSourceRef());
		SetPulse(pulseRate);
		locked = 1;
	}
	else SetThingUserData(barrel, hull - damage);

Return;
#------------------------------------------------------
pulse:
	DamageThing(shooter, pulseDamage, 0x1, shooter);
	if(GetThingHealth(shooter) <= 0) call replace;

Return;
#------------------------------------------------------
replace:
	SetPulse(0);
	SetThingCurGeoMode(barrel, GetThingGeoMode(barrel));
	SetThingUserData(barrel, barrelHull);
	locked = 0;

Return;
#------------------------------------------------------
timer:
	KillTimerEx(1);
	CreateThing(barrel_exp, barrel);
	SetThingCurGeoMode(barrel, 0);

Return;
#------------------------------------------------------
end


Did you want this to work in MP? The cog will have to be modified for that. As it is, it will work in SP, though reseting the barrel is kind of useless as the level will be restarted anyway. So tell me what you want, and I'll modify the cog if need be. [http://forums.massassi.net/html/wink.gif]

------------------
Author of the JK DataMaster, Parsec, and the EditPlus Cog Files.
Visit Saber's Domain.
Author of the JK DataMaster, Parsec, Scribe, and the EditPlus Cog Files.
2002-07-09, 6:28 AM #4
Quote:
<font face="Verdana, Arial" size="2">Originally posted by Descent_pilot:
I wonder where GBK is?</font>


Im here, I just figured Id give this one to you . . for, err, practice... [http://forums.massassi.net/html/wink.gif]

------------------
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-07-09, 8:05 AM #5
First off I want to thank everyone of you for being so nice and helping me with my COG problems! I came to Massassi alot when Jedi Knight was first released under another name that I really don't want to say right now. But thank yall just the same [http://forums.massassi.net/html/wink.gif]

The Cog is for an MP level that I'm making. I've had this idea for quite a long time. And I finally decided to get off my butt and make it! I got the idea from the Young Jedi Knight series that I read. I modified the idea a little bit to make it a little bit more exciting, but I think that I can make it work. [http://forums.massassi.net/html/wink.gif]

Thanks again for all the help yall are giving me. If anyone ever needs nething just e-mail me or something and I'll do nething I can for you.

Thanks!
2002-07-09, 9:56 AM #6
SaberMaster, ok, so I'm backwards on the GetSender/SourceRef(), I never could remember what the thing was for the Damaged message. I also see you did a major overhaul on the door part cog, I spliced the barrel cog with LEC's 00_lockeddoor.cog. I think my version of the barrel part should work in MP (execpt for that missing Pulse(0); in the replace [http://forums.massassi.net/html/redface.gif] ).

GBK, I have a cog here, in my possession and only mine, that I'm still working on. I was thinking of kindly asking you and SaberMaster to look over it in a week or so. It's extremly tough on how I'm going to make it all work. [http://forums.massassi.net/html/frown.gif] More info over on the Rbots forum, see my thread. I want to keep this somewhat silent. [http://forums.massassi.net/html/wink.gif] Reply over there if you're interested.

------------------
The Sniper Missions. Current project, The Sniper Missions

[This message has been edited by Descent_pilot (edited July 09, 2002).]
Major projects working on:
SATNRT, JK Pistol Mod, Aliens TC, Firearms

Completed
Judgement Day (HLP), My level pack
2002-07-09, 10:26 AM #7
You're welcome, CrazyOne. The cog may not require changes for MP - try it and see. [http://forums.massassi.net/html/wink.gif]



------------------
Author of the JK DataMaster, Parsec, and the EditPlus Cog Files.
Visit Saber's Domain.
Author of the JK DataMaster, Parsec, Scribe, and the EditPlus Cog Files.
2002-07-09, 4:19 PM #8
Aight, Thank yall!
I'll sure try it if I can ever get these damn nonconvex secters fixed lol

laterz thanx!
2002-07-09, 4:50 PM #9
Ok I'm having some problems.

Pulse Rate, barrelhull, and pulse damage what values would go in those? Thanks again for ur help!
2002-07-09, 5:11 PM #10
PulseRate is how often the pulse message is called, BarrelHull is how much damage the barrel can sustain before destruction, and PulseDamage is how much damage you get every time the pulse message is called. You can use a positive decimal number for each of those (flex = decimal) ex. 52.156533, but others, like thing barrel, you have to use a whole number (int = whole) -1 is null for things, 0, 5, 4, 5134...

------------------
The Sniper Missions. Current project, The Sniper Missions
Major projects working on:
SATNRT, JK Pistol Mod, Aliens TC, Firearms

Completed
Judgement Day (HLP), My level pack

↑ Up to the top!