PDA

View Full Version : i need a cog..



hatchyack
09-12-2003, 10:31 AM
multiplayer forcefeild cog needed.
cog must:
-be turned on/off by pressing a single switch(textured surface)
-must always be visible when turned on, not just when you touch it.
-must support textured mats
-must be turned OFF at level startup.

thank you.

lucky_jackpot
09-12-2003, 10:44 AM
Hi there http://forums.massassi.net/html/smile.gif

At the effort of trying to avoid repetition, may I refer you to the cog script I wrote fairly recently, that covers your exact criteria:

http://forums.massassi.net/html/Forum4/HTML/003864.html

All the comment code is there and it works AND I'll send you the demo level, if you want ... what more could a person ask for http://forums.massassi.net/html/biggrin.gif

Oh ... and a big "Welcome http://forums.massassi.net/html/biggrin.gif" to the Massassi forums (and the Massassi Community) http://forums.massassi.net/html/biggrin.gif

As always, feel free to post back here if you want further help/assistance/clarification with anything http://forums.massassi.net/html/wink.gif

-Jackpot

------------------
Are you feeling lucky, cuz if you are, get your hands off me... ;)

"Life is mostly froth and bubble,
But two things stand in stone,
Kindness in another's trouble,
Courage in your own"
("Ye Wearie Wayfarer" - by Adam Lindsay Gordon)

hatchyack
09-12-2003, 11:24 AM
excellent! now, can you create a cog that will:
1.Be off at start of level.
2.turned on/off by a switch(textured surface)
3.sets a surfaces flags to be visible, walkable, and make it magsealed and icy?

i need a cog that when you press a switch, the top of this lake will freeze over.
thanks.

------------------

hatchyack
09-12-2003, 11:29 AM
...AFTERTHOUGHT....
Will the forcefeild cog work for jedi knight? because at the header it says MOTS cog script, and i need it for jedi.


------------------

lucky_jackpot
09-12-2003, 05:13 PM
Yes it will work in JK - all the verbs are compatible with both engines http://forums.massassi.net/html/wink.gif

I simply wrote that, as it's (mostly) the default template that I use with the level series I'm working on (which is for MotS http://forums.massassi.net/html/biggrin.gif)

I wish that you'd have been more specific about your cog requirements http://forums.massassi.net/html/wink.gif If I'd have realised your intentions I could have modified the script specifically for you, but I'll try and see to that tomorrow (because it's late now for me) and I try not to write cog scripts when I'm tired - debugging the little swines, if you program them wrongly late at night, can be an absolute nitghtmare http://forums.massassi.net/html/wink.gif

It shouldn't take me too long to refer to the "DataMaster" to look up the various cog verbs and flags, and I could probably do that now, but it's a case of placing them in the right parts of your cog script...

Just out of curiosity, is it entirely realistic to have the top of a lake freeze over *instantly* when a player activates a switch ... or maybe I'm being pedantic - afterall - we do have real lightsabers... http://forums.massassi.net/html/wink.gif

-Jackpot

PS: Just as a quick after-thought, remove the damaged message in symbols (and in the corresponding code section) to make your icy surface not damage the player. I think the verb you want is SetSurfaceFlags(), with the flags either 0x1000 (Icy) or 0x2000 (Very Icy)...

I hope this is enough to get you started - I'll post back here when I get some spare time tomorrow - it may be later though .... because it's my birthday !!!! w00t !!! http://forums.massassi.net/html/biggrin.gif

------------------
Are you feeling lucky, cuz if you are, get your hands off me... ;)

"Life is mostly froth and bubble,
But two things stand in stone,
Kindness in another's trouble,
Courage in your own"
("Ye Wearie Wayfarer" - by Adam Lindsay Gordon)

lucky_jackpot
09-14-2003, 04:26 PM
Hi there http://forums.massassi.net/html/smile.gif

I've re-modified my code for your particular requirements, and have found this to be sufficient (although I've only been able to test it in single-player, but I see no reason why it shouldn't work in multi-player http://forums.massassi.net/html/wink.gif )...



##
# MOTS Cog Script
#
# 00_iceSurfaceSwitch.COG
#
# This cog script sets the surface for an icy lake. At the press of a switch
# the lake's surface may be frozen over *OR* thawed out... so beware....
#
# Additional bonus feature: if you want the frozen water section to damage
# the player then make "iceFreezePlayer=1" and select the sectors for your iceFreezeSector.
# This will cater for up to 8 sectors.
#
# May be switched on/off by either a console (thing) or switch (surface).
# Ice-Lake's surface starts being FROZEN (default: status=1).
# Change status=0 if you want the Ice-Lake's surface to be THAWED at start.
#
# In JED (or something similiar in JK Edit, if you're so inclined...) :
# NB-01: Set +ADJOIN FLAGS to 5
# NB-02: Set +SURFACE FLAGS to 6007
# NB-03: Set +FACE FLAGS to 2
# NB-04: Set +GEO to 4
#
# Set verbose=1, if you want to see print out messages.
# (More for test purposes than anything else...)
#
# This COG script is NOT supported by LucasArts or LEC.
#
# Permission is granted to use this script by the author, as long as credit
# is provided in the readme file for any add-on levels that use this script.
#
#
# E-mail: lucky_jackpot@hotmail.com
# [RJS]
#
##

// Make sure that the cog runs locally on each computer (0x40)
// Make sure that the cog does NOT send syncing info to other computers...
flags=0x240

symbols

message startup
message activated
message entered
message exited
message pulse

sector iceFreezeSector0 linkid=3
sector iceFreezeSector1 linkid=3
sector iceFreezeSector2 linkid=3
sector iceFreezeSector3 linkid=3
sector iceFreezeSector4 linkid=3
sector iceFreezeSector5 linkid=3
sector iceFreezeSector6 linkid=3
sector iceFreezeSector7 linkid=3

surface iceSurf_front linkid=2, mask=0x400
surface iceSurf_back linkid=2, mask=0x400

surface switch linkid=1
thing console linkid=1

flex damage local
flex damageInterval=0.25 local
flex minDamage=2.0
flex maxDamage=10.0

int status=1 # 1 is THAWED OUT ; 0 is FROZEN OVER
int damaging=1 local

int doesIceFreezePlayer=0

int verbose=0 # Used as a test variable. Set to 0 to not print messages...

end

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


code

startup:

damaging = 0;

if (verbose)
Sleep (1.5); // Allow dust to settle for a bit...
Print ("Ice-Lake's Surface Status COG EXECUTING !!!");

if (status == 0) {
if (verbose)
Print ("startup: LAKE SURFACE THAWED");
SetWallCel (switch, 0);
call ice_THAW;
}
else
if (status == 1) {
if (verbose)
Print ("startup: LAKE SURFACE FROZEN");
SetWallCel (switch, 1);
call ice_FREEZE;
}

return;

#------------------------------------------------------

activated:

// Eliminate any possibility that something other than
// the on-off switch OR console could send the
// "activated" message...
if (GetSenderID() != 1)
return;

if (GetSenderID() == -1)
return;

if (GetSenderID() == 1) {
if (status == 0) {
if (verbose)
Print ("ICE LAKE SURFACE - THAWED OUT...");
SetWallCel (switch, 0);
call ice_THAW;
}
else
if (status == 1) {
if (verbose)
Print ("ICE LAKE SURFACE - FROZEN OVER...");
SetWallCel (switch, 1);
call ice_FREEZE;
}
}

return;

#------------------------------------------------------

ice_FREEZE:

// Floor; Used in COG; Impassable; Magsealed
SetSurfaceFlags (iceSurf_front, 0x6007);
SetSurfaceFlags (iceSurf_back, 0x6007);
// Not passable
ClearAdjoinFlags (iceSurf_front, 0x2);
ClearAdjoinFlags (iceSurf_back, 0x2); // ALT: SetAdjoinFlags (iceSurf_back, 0x5);
// Geo-mode
SetFaceGeoMode (iceSurf_front, 4); // Surface face
SetFaceGeoMode (iceSurf_back, 4); // is drawn...
// Surface Face Type Info
SetFaceType (iceSurf_front, 0x2); // Translucent
SetFaceType (iceSurf_back, 0x2);
// Set wall cell mat info
SetWallCel (switch, 1);
// Reset status to 0 - OFF
// (think that status should be 1 ?? Try it and see what happens... http://forums.massassi.net/html/wink.gif
status = 0;

return;

#------------------------------------------------------

ice_THAW:

// Surface flags
ClearSurfaceFlags (iceSurf_front, 0x6007);
ClearSurfaceFlags (iceSurf_back, 0x6007);
// Adjoins info
SetAdjoinFlags (iceSurf_front, 0x2);
SetAdjoinFlags (iceSurf_back, 0x2); // ALT: SetAdjoinFlags (iceSurf_back, 0x7);
// Geo-mode
SetFaceGeoMode (iceSurf_front, 4); // Draw surface face, as normal
SetFaceGeoMode (iceSurf_back, 4);
// Surface Face Type Info
// ClearFaceType (iceSurf_front, 0x2); // Clears translucency
// ClearFaceType (iceSurf_back, 0x2); //SetFaceType (iceSurf_back, 0x0);
// Set wall cell mat info
SetWallCel (switch, 0);
// Reset status to 1 - ACTIVE
// (think that status should be 0 ?? Try it and see what happens... http://forums.massassi.net/html/wink.gif
status = 1;

return;

#------------------------------------------------------

entered:

// Make sure nothing else can send this message....
if (GetSenderID() != 3)
return;


if (GetSenderID() == 3) {
if (verbose)
Print ("Entered ICY LAKE SECTOR");

if (doesIceFreezePlayer == 0) {
if (verbose)
Print ("NO FREEZE");
return;
}
else
if (doesIceFreezePlayer == 1) {
if (verbose)
Print ("LAKE'S WATER IS TOO COLD TO SURVIVE - DAMAGE PLAYER !!!");
damaging = 1;
SetPulse (damageInterval);
}
}

return;

#------------------------------------------------------

exited:

if (GetSenderID() != 3)
return;

if (GetSenderID() == 3) {
if (verbose)
Print ("Exited ICY LAKE - STOP damaging !!!");
damaging = 0;
}

return;

#------------------------------------------------------

pulse:

if (verbose)
Print ("COG PULSING in FREEZING WATER SECTOR");

if (damaging == 1) {
// Do direct HEALTH damage - cuts through shields...
damage = (Rand() * (maxDamage - minDamage) ) + minDamage;
DamageThing (GetSourceRef(), damage, 0x1, GetSenderRef() );
}
else
if (damaging == 0) {
SetPulse (0.0);
return;
}

return;

#------------------------------------------------------

end


Hope this helps http://forums.massassi.net/html/biggrin.gif If you still have troubles with it, or require further help/clarification/assistance, don't hesitate to call back here or contact me personally - if you wish, I can send you my demo level, with the cog script http://forums.massassi.net/html/biggrin.gif

-Jackpot

------------------
Are you feeling lucky, cuz if you are, get your hands off me... ;)

"Life is mostly froth and bubble,
But two things stand in stone,
Kindness in another's trouble,
Courage in your own"
("Ye Wearie Wayfarer" - by Adam Lindsay Gordon)

hatchyack
09-15-2003, 07:42 AM
thanks, ill try to test these as soon as possible, but at the moment I cant use my pc that the files are on, so ill reply when i have tested them.
-Hatchyack

hatchyack
09-15-2003, 07:46 AM
PS.
-Does the cog need to be synched for multiplayer?, cuz it is a m.p. level.

------------------

lucky_jackpot
09-15-2003, 11:07 AM
I must confess, I always have trouble trying to "think out" whether or not a MP cog script should be synched or not...

In this case, if flags=0x240 isn't correct, then it will be flags=0x40. I think the latter may be correct, thinking about it...

Try flags=0x40, and get back to me. The code itself runs successfully (my single-player test level demonstrates this http://forums.massassi.net/html/wink.gif ) Actually ... I quite like the "freezing sector lake" idea - it works effectively too http://forums.massassi.net/html/biggrin.gif

Maybe I'm just a sadist http://forums.massassi.net/html/wink.gif Anyways - give it a try and post back here - I'm intrigued to see how successful it is http://forums.massassi.net/html/wink.gif http://forums.massassi.net/html/biggrin.gif

-Jackpot

------------------
Are you feeling lucky, cuz if you are, get your hands off me... ;)

"Life is mostly froth and bubble,
But two things stand in stone,
Kindness in another's trouble,
Courage in your own"
("Ye Wearie Wayfarer" - by Adam Lindsay Gordon)

hatchyack
09-18-2003, 07:25 AM
ok, the lake cog is not working. I press the switch and nothing happens, no sound, nothing. Also, the lake is frozemn from the start, it is like the cog is not even there. i set all of the flags like you said to in the cog, but it will still not work.

------------------

lucky_jackpot
09-18-2003, 02:32 PM
Hi there http://forums.massassi.net/html/smile.gif

Here's your revised COG script - it's been improved and now passes Parsec's debugging utility.

The reason why the previous cog script appeared as if it wasn't working was because, after having written the script, I then posted it here and (as an afterthought) added the flags info at the top, with "//" rather than "#". After testing this theory (and running it through Parsec), apparently this issue matters significantly...



##
# MOTS Cog Script
#
# 00_iceSurfaceSwitch.COG
#
# This cog script sets the surface for an icy lake. At the press of a switch
# the lake's surface may be frozen over *OR* thawed out... so beware....
#
# Additional bonus feature: if you want the frozen water section to damage
# the player then make "iceFreezePlayer=1" and select the sectors for your iceFreezeSector.
# This will cater for up to 8 sectors.
#
# May be switched on/off by either a console (thing) or switch (surface).
# Ice-Lake's surface starts being FROZEN (default: status=1).
# Change status=0 if you want the Ice-Lake's surface to be THAWED at start.
#
# In JED (or something similiar in JK Edit, if you're so inclined...) :
# NB-01: Set +ADJOIN FLAGS to 5
# NB-02: Set +SURFACE FLAGS to 6007
# NB-03: Set +FACE FLAGS to 2
# NB-04: Set +GEO to 4
#
# Set verbose=1, if you want to see print out messages.
# (More for test purposes than anything else...)
#
# This COG script is NOT supported by LucasArts or LEC.
#
# Permission is granted to use this script by the author, as long as credit
# is provided in the readme file for any add-on levels that use this script.
#
#
# E-mail: lucky_jackpot@hotmail.com
# [RJS]
#
##

# Make sure that the cog runs locally on each computer (0x40)
# Make sure that the cog does NOT send syncing info to other computers...
flags=0x240

symbols

message startup
message activated
message entered
message exited
message pulse

sector iceFreezeSector0 linkid=3
sector iceFreezeSector1 linkid=3
sector iceFreezeSector2 linkid=3
sector iceFreezeSector3 linkid=3
sector iceFreezeSector4 linkid=3
sector iceFreezeSector5 linkid=3
sector iceFreezeSector6 linkid=3
sector iceFreezeSector7 linkid=3

surface iceSurf_front linkid=2, mask=0x400
surface iceSurf_back linkid=2, mask=0x400

surface switch linkid=1
thing console linkid=1

flex damage local
flex damageInterval=0.25 local
flex minDamage=2.0
flex maxDamage=10.0

int status=1 # 1 is THAWED OUT ; 0 is FROZEN OVER
int damaging=1 local

int doesIceFreezePlayer=0

int verbose=0 # Used as a test variable. Set to 0 to not print messages...

end

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


code

startup:

damaging = 0;

if (verbose)
Sleep (1.5); // Allow dust to settle for a bit...
Print ("Ice-Lake's Surface Status COG EXECUTING !!!");

if (status == 0) {
if (verbose)
Print ("startup: LAKE SURFACE THAWED");
SetWallCel (switch, 0);
call ice_THAW;
}
else
if (status == 1) {
if (verbose)
Print ("startup: LAKE SURFACE FROZEN");
SetWallCel (switch, 1);
call ice_FREEZE;
}

return;

#------------------------------------------------------

activated:

// Eliminate any possibility that something other than
// the on-off switch OR console could send the
// "activated" message...
if (GetSenderID() != 1)
return;

if (GetSenderID() == -1)
return;

if (GetSenderID() == 1) {
if (status == 0) {
if (verbose)
Print ("ICE LAKE SURFACE - THAWED OUT...");
SetWallCel (switch, 0);
call ice_THAW;
}
else
if (status == 1) {
if (verbose)
Print ("ICE LAKE SURFACE - FROZEN OVER...");
SetWallCel (switch, 1);
call ice_FREEZE;
}
}

return;

#------------------------------------------------------

ice_FREEZE:

// Floor; Used in COG; Impassable; Magsealed
SetSurfaceFlags (iceSurf_front, 0x6007);
SetSurfaceFlags (iceSurf_back, 0x6007);
// Not passable
ClearAdjoinFlags (iceSurf_front, 0x2);
ClearAdjoinFlags (iceSurf_back, 0x2); // ALT: SetAdjoinFlags (iceSurf_back, 0x5);
// Geo-mode
SetFaceGeoMode (iceSurf_front, 4); // Surface face
SetFaceGeoMode (iceSurf_back, 4); // is drawn...
// Surface Face Type Info
SetFaceType (iceSurf_front, 0x2); // Translucent
SetFaceType (iceSurf_back, 0x2);
// Set wall cell mat info
SetWallCel (switch, 1);
// Reset status to 0 - OFF
// (think that status should be 1 ?? Try it and see what happens...
status = 0;

return;

#------------------------------------------------------

ice_THAW:

// Surface flags
ClearSurfaceFlags (iceSurf_front, 0x6007);
ClearSurfaceFlags (iceSurf_back, 0x6007);
// Adjoins info
SetAdjoinFlags (iceSurf_front, 0x2);
SetAdjoinFlags (iceSurf_back, 0x2); // ALT: SetAdjoinFlags (iceSurf_back, 0x7);
// Geo-mode
SetFaceGeoMode (iceSurf_front, 4); // Draw surface face, as normal
SetFaceGeoMode (iceSurf_back, 4);
// Surface Face Type Info
// ClearFaceType (iceSurf_front, 0x2); // Clears translucency
// ClearFaceType (iceSurf_back, 0x2); //SetFaceType (iceSurf_back, 0x0);
// Set wall cell mat info
SetWallCel (switch, 0);
// Reset status to 1 - ACTIVE
// (think that status should be 0 ?? Try it and see what happens...
status = 1;

return;

#------------------------------------------------------

entered:

// Make sure nothing else can send this message....
if (GetSenderID() != 3)
return;


if (GetSenderID() == 3) {
if (verbose)
Print ("Entered ICY LAKE SECTOR");

if (doesIceFreezePlayer == 0) {
if (verbose)
Print ("NO FREEZE");
return;
}
else
if (doesIceFreezePlayer == 1) {
if (verbose)
Print ("LAKE'S WATER IS TOO COLD TO SURVIVE - DAMAGE PLAYER !!!");
damaging = 1;
SetPulse (damageInterval);
}
}

return;

#------------------------------------------------------

exited:

if (GetSenderID() != 3)
return;

if (GetSenderID() == 3) {
if (verbose)
Print ("Exited ICY LAKE - STOP damaging !!!");
damaging = 0;
SetPulse (0.0);
}

return;

#------------------------------------------------------

pulse:

if (verbose)
Print ("COG PULSING in FREEZING WATER SECTOR");

if (GetThingHealth (GetSenderRef() ) < 1) {
if (verbose)
Print ("PLAYER DEAD !!! - stop PULSE ");
SetPulse (0.0);
return;
}

if (damaging == 1) {
// Do direct HEALTH damage - cuts through shields...
damage = (Rand() * (maxDamage - minDamage) ) + minDamage;
DamageThing (GetSourceRef(), damage, 0x1, GetSenderRef() );
}
else
if (damaging == 0) {
SetPulse (0.0);
}

return;

#------------------------------------------------------

end


And as for the reason as to why you're not getting any sounds - well you didn't ask for any sounds, so I didn't include it... Please make up your mind what you want your cog to do exactly, as that way, it ensures that us coggers can develop (precisely) the cog that you desire, and thus make your levels more interesting http://forums.massassi.net/html/biggrin.gif

If you still need help or want me to send you my demo test level, implementing this cog script, then let me know and I'll happily email to you http://forums.massassi.net/html/biggrin.gif

Hope this helps http://forums.massassi.net/html/biggrin.gif

-Jackpot

------------------
Are you feeling lucky, cuz if you are, get your hands off me... ;)

"Life is mostly froth and bubble,
But two things stand in stone,
Kindness in another's trouble,
Courage in your own"
("Ye Wearie Wayfarer" - by Adam Lindsay Gordon)

JediKirby
09-18-2003, 06:33 PM
Why not just un-adjoin the surface via switch, and make sure the surface that shows up is a solid ice texture? Seems like you're going through quite a bit of trouble for something so limmited in cog knowledge like me could do.

JediKirby

------------------
"I was driving along listening to the radio, when Judas Priest comes on. It was 'You've got another thing coming.' All of a sudden, I enter 'VICE CITY RAMAGE MODE' and nearly ran some guy over"
- ]-[ellequin

hatchyack
09-23-2003, 07:27 AM
ok, i think the cog is working, but when it is turned off, the surface still shows up. I need the cog to change the surface flags when it is off to be not rendered. right now, when it is off, it is rendered but passable. i need it to be not rendered and passable when off, and rendered , not passable and icy, and translucent when on.

------------------

lucky_jackpot
09-23-2003, 10:46 AM
Hi there http://forums.massassi.net/html/smile.gif

OK - follow this to the letter and you should be fine http://forums.massassi.net/html/wink.gif

In the "ice_THAW" code section change:



SetFaceGeoMode (iceSurf_front, 4);
SetFaceGeoMode (iceSurf_back, 4);
// Surface Face Type Info
// ClearFaceType (iceSurf_front, 0x2); // Clears translucency
// ClearFaceType (iceSurf_back, 0x2); //SetFaceType (iceSurf_back, 0x0);


to:


SetFaceGeoMode (iceSurf_front, 0);
SetFaceGeoMode (iceSurf_back, 0);
ClearFaceType (iceSurf_front, 0x2);
ClearFaceType (iceSurf_back, 0x2);


Let me know that this is successful (not "if" it is successful http://forums.massassi.net/html/wink.gif ) http://forums.massassi.net/html/smile.gif

Hope this helps http://forums.massassi.net/html/biggrin.gif

-Jackpot

------------------
Are you feeling lucky, cuz if you are, get your hands off me... http://forums.massassi.net/html/wink.gif

"Life is mostly froth and bubble,
But two things stand in stone,
Kindness in another's trouble,
Courage in your own"
("Ye Wearie Wayfarer" - by Adam Lindsay Gordon)

[This message has been edited by lucky_jackpot (edited September 23, 2003).]

lucky_jackpot
09-23-2003, 10:53 AM
Oh and jEDIkIRBY - I like to give people options with their custom cogs ... plus I was bored and wished to see how far I can push interesting level ideas, such as this freezing lake idea http://forums.massassi.net/html/wink.gif http://forums.massassi.net/html/biggrin.gif

-Jackpot

------------------
Are you feeling lucky, cuz if you are, get your hands off me... ;)

"Life is mostly froth and bubble,
But two things stand in stone,
Kindness in another's trouble,
Courage in your own"
("Ye Wearie Wayfarer" - by Adam Lindsay Gordon)

Storm_Eyes
09-24-2003, 12:57 PM
I'm gonna provide you with no useful information.

These are my thoughts on life.
...
Thanks for listening.

lucky_jackpot
09-24-2003, 03:43 PM
Riiiight ... thanks for the useful input Storm_Eyes... http://forums.massassi.net/html/wink.gif

At least I've tried to help an aspiring editor in this thread - to be quite candid, I believe your response would have been better left as "not posted" status....

Believe it or not, I'm not getting at you - I just can't see any point to your above post, in terms of helping out an editor who needs cogging help ... unless there's an inside joke going on - in that case... http://forums.massassi.net/html/wink.gif http://forums.massassi.net/html/biggrin.gif

-Jackpot

------------------
Are you feeling lucky, cuz if you are, get your hands off me... ;)

"Life is mostly froth and bubble,
But two things stand in stone,
Kindness in another's trouble,
Courage in your own"
("Ye Wearie Wayfarer" - by Adam Lindsay Gordon)