i have a problem with my cog, everything is good on it, except the host is the only one that hears the sounds when you activate the surface.please help to find out what is wrong, and reply with the edited cog.
------------------
Your Owners Clan Leaader,
_yo_wasup_
Code:
##
# MOTS Cog Script
#
# 00_simpleForceField.COG
#
# Force-field effect on two adjoined surfaces (ff_front and ff_back)
# Will damage player if touched while force-field status is ON.
# May be switched off by either a console (thing) or switch (surface).
# Force-field starts being ON (default: status=1).
# Change status=0 if you want the force-field to be OFF 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 14007
# 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.
#
# version 1 : 12-August-2003
# version 2 : 14-August-2003
#
#
# E-mail: lucky_jackpot@hotmail.com
# [RJS]
#
##
symbols
message startup
message activated
message touched
message damaged
message timer
surface ff_front linkid=2, mask=0x400
surface ff_back linkid=2, mask=0x400
surface switch linkid=1
thing console linkid=1
template sparks=+heavysmoke local
#thing player local
thing playerReference local
thing victim local
flex damage local
flex damageInterval=0.25 local
flex minDamage=2.0
flex maxDamage=10.0
int status=1 # 1 is ON ; 0 is OFF
int damaging=1 local
sound ff_on=forcefieldon01.wav
sound ff_off=forcefieldoff01.wav
sound ff_hum=forcefieldhum01.wav
sound ff_hit=forcefieldhit01.wav
int tempSound1 local
int tempSound2 local
int tempSound3 local
int tempSound4 local
int verbose=0 # Used as a test variable. Set to 0 to not print messages...
end
#==============================================================
#==============================================================
#==============================================================
code
startup:
if (verbose)
Sleep (2.5); // Allow dust to settle for a bit...
Print ("Force Field Status COG EXECUTING !!!");
if (status == 0) {
if (verbose)
Print ("startup: OFF");
SetWallCel (switch, 0);
call forceField_OFF;
}
else
if (status == 1) {
if (verbose)
Print ("startup: ON");
SetWallCel (switch, 1);
call forceField_ON;
}
return;
#------------------------------------------------------
activated:
playerReference = GetLocalPlayerThing();
// 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 ("FF IS OFF");
SetWallCel (switch, 0);
call forceField_OFF;
}
else
if (status == 1) {
if (verbose)
Print ("FF IS ON");
SetWallCel (switch, 1);
call forceField_ON;
}
}
return;
#------------------------------------------------------
touched:
if (GetSenderID() != 2)
return;
playerReference = GetLocalPlayerThing();
victim = GetSourceRef();
if (GetSenderID() == 2) {
if (verbose)
Print ("SURFACE TOUCHED !!!!");
if (status == 1) {
if (verbose)
// Strange - you would have thought status would
// have to be 1 to be ON and damage player, but nevermind
// - the script works... ;p
Print ("SAFE TO PASS - OK");
Print ("FF is off so dont damage...");
}
else
if (status == 0) {
if (verbose)
Print ("OUCH !!!");
damage = (Rand() * (maxDamage - minDamage)) + minDamage;
// Allow for self-inflicted damage (0x2)
// Change to 0x1 flag to cut straight through shields and do DIRECT health damage....
DamageThing (playerReference, damage, 0x2, GetSenderRef() );
// Sounds stuff
tempSound3 = PlaySoundPos (ff_hit, GetSurfaceCenter (ff_front), 0.5, 1, 10, 0);
tempSound4 = PlaySoundPos (ff_hit, GetSurfaceCenter (ff_back), 0.5, 1, 10, 0);
if (!IsMulti() )
CreateThing (sparks, victim);
damaging = 0;
SetTimer (damageInterval);
}
}
return;
#------------------------------------------------------
damaged:
if (GetParam (1) == 1) {
//player = GetThingParent (GetSourceRef() );
player = GetSourceRef();
if (GetThingType (player) != 10)
return;
damage = (Rand() * (maxDamage - minDamage) ) + minDamage;
DamageThing (player, damage, 0x01, player);
}
return;
#------------------------------------------------------
timer:
damaging = 1;
return;
#------------------------------------------------------
forceField_ON:
// Floor; Used in COG; Impassable; Magsealed
SetSurfaceFlags (ff_front, 0x14007);
SetSurfaceFlags (ff_back, 0x14007);
// Not passable
ClearAdjoinFlags (ff_front, 0x2);
ClearAdjoinFlags (ff_back, 0x2); // ALT: SetAdjoinFlags (ff_back, 0x5);
// Geo-mode
SetFaceGeoMode (ff_front, 4); // Surface face
SetFaceGeoMode (ff_back, 4); // is drawn...
// Surface Face Type Info
SetFaceType (ff_front, 0x2); // Translucent
SetFaceType (ff_back, 0x2);
// Sounds stuff
PlaySoundLocal (ff_on, 1, 0, 0x0); // Play On sound
tempSound1 = PlaySoundPos (ff_hum, GetSurfaceCenter (ff_front), 1.5, 2.0, 10.0, 0x1);
tempSound2 = PlaySoundPos (ff_hum, GetSurfaceCenter (ff_back), 1.5, 2.0, 10.0, 0x1);
// 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;
#------------------------------------------------------
forceField_OFF:
// Surface flags
ClearSurfaceFlags (ff_front, 0x14007);
ClearSurfaceFlags (ff_back, 0x14007);
// Adjoins info
SetAdjoinFlags (ff_front, 0x2);
SetAdjoinFlags (ff_back, 0x2); // ALT: SetAdjoinFlags (ff_back, 0x7);
// Geo-mode
SetFaceGeoMode (ff_front, 0); // Don't draw surface
SetFaceGeoMode (ff_back, 0);
// Surface Face Type Info
ClearFaceType (ff_front, 0x2); // Clears translucency
ClearFaceType (ff_back, 0x2); //SetFaceType (ff_back, 0x0);
// Sounds stuff
StopSound (tempSound1, 0.5); // Stop hum sound
StopSound (tempSound2, 0.5);
StopSound (tempSound3, 0.2);
StopSound (tempSound4, 0.2);
PlaySoundLocal (ff_off, 1, 0, 0x0); // Play Off sound
// 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;
#------------------------------------------------------
end------------------
Your Owners Clan Leaader,
_yo_wasup_
-=__/¯¯l¤¥Ø¤l¯¯\__\/\/ª≤uÞ_=-
http://www.TeamYo.org
http://www.TeamYo.org
![http://forums.massassi.net/html/biggrin.gif [http://forums.massassi.net/html/biggrin.gif]](http://forums.massassi.net/html/biggrin.gif)
![http://forums.massassi.net/html/tongue.gif [http://forums.massassi.net/html/tongue.gif]](http://forums.massassi.net/html/tongue.gif)
. How was I to know that the editor was going to use the script for multi-player? Admittedly, the base script doesn't change too much, but it's just little things like sound setting that need changing - nothing drastic. I think you'll find everything else works correctly with that cog script, so to answer your question:
. I've spent far too much of this week editing instead of cogging ![http://forums.massassi.net/html/redface.gif [http://forums.massassi.net/html/redface.gif]](http://forums.massassi.net/html/redface.gif)
![http://forums.massassi.net/html/rolleyes.gif [http://forums.massassi.net/html/rolleyes.gif]](http://forums.massassi.net/html/rolleyes.gif)