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 → All right, Easy Cog needed
All right, Easy Cog needed
2000-10-30, 9:16 AM #1
I need a force field that is controlled by a shootable switch, and is off until turned on. I've tried making my own but it seems I have Zero Talent in that area.

Thanks, and if you make it I'll put your name in the credits.

------------------
Formerly ST_Clan_Leader. But That Name was too Freaking Long.
Formerly ST_Clan_Leader. But That Name was too Freaking Long.
2000-10-31, 11:28 AM #2
Does the forcefield need to cause damage when touched by the player?

-Jipe
2000-10-31, 1:22 PM #3
Yes, damage is a must.
Formerly ST_Clan_Leader. But That Name was too Freaking Long.
2000-10-31, 4:03 PM #4
Here. This should work; it has no syntax errors but that doesn't guarantee anything [http://forums.massassi.net/html/smile.gif]

Code:
# Jedi Knight Cog Script
#
# M2_FFieldSwitch.cog
#
# This script operates a forcefield surface that damages
# the player and is controlled by a shootable switch. It 
# also sets this surface to be nomove and translucent.
#
# [SC]
#
# 8/8/97 - YB - Fixed sleep() problem by using timers.
#
# 10/31/00 - Jipe - Changed both switches activated by spacebar to
#                   a single switch activated by weapon shots.
#
# (C) 1997 LucasArts Entertainment Co. All Rights Reserved
# ========================================================================================

symbols

message     damaged
message     touched
message     timer

sound       poweroff=activate04.wav         local
sound       poweron=activate01.wav          local
sound       hitsurf=ForceFieldHit01.wav     local

surface     switch                          mask=0x408 desc=switch
surface     damsurf                         linkid=3   mask=0x448
surface     damsurf2                        linkid=3   mask=0x448

flex        maxdamage=10.0
flex        mindamage=5.0
flex        damage=0.0                      local
flex        interval=0.25                   local

int         damaging=1                      local
int         garbage=0                       local
int         garbage2=0                      local

thing       victim                          local

template    sparks=+heavysmoke              local

end

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

code

touched:
   if ((GetSenderID() == 3) && (damaging == 1))
   {
      PlaySoundPos(hitsurf, SurfaceCenter(damsurf), 1.0, -1, -1, 0 );
      victim = GetSourceRef();
      damage = (Rand()*(maxdamage - mindamage))+mindamage;
      DamageThing(victim,damage,0x2,victim);
      if(!IsMulti()) CreateThing(sparks, GetSourceRef());
      damaging=0;
      SetTimerEx(interval, 1, 0, 0);
   }
   else return;

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

damaged:
   if((GetParam(1) == 1) && (GetThingType() == 10))
      {
         damage = (Rand()*(maxdamage - mindamage))+mindamage;
         DamageThing(victim, damage, 0x1, victim);
         if(!IsMulti()) CreateThing(sparks, GetSourceRef());
         PlaySoundPos(hitsurf, SurfaceCenter(damsurf), 1.0, -1, -1, 0 );
         SetFaceGeoMode(damsurf,3);
         SetFaceGeoMode(damsurf2,3);
         KillTimerEx(2);
         SetTimerEx(0.5, 2, 0, 0);
      }
   else if ((GetSenderRef() == switch) && (GetWallCell(switch) == 1))
       {
         PlaySoundPos(hitsurf, SurfaceCenter(damsurf), 1.0, -1, -1, 0 );
         SetFaceGeoMode(damsurf,3);
         SetFaceGeoMode(damsurf2,3);
         KillTimerEx(2);
         SetTimerEx(0.5, 2, 0, 0);
       }
   else if ((GetSenderRef() == switch) && (GetWallCell(switch) == 0))
      {
         PlaySoundPos(poweroff, SurfaceCenter(switch), 1.0, -1, -1, 0 );
         PlaySoundPos(poweroff, SurfaceCenter(switch1), 1.0, -1, -1, 0);
         SetWallCel(switch,1);                  //off
         SetAdjoinFlags(damsurf,2);             //move
         SetAdjoinFlags(damsurf2,2);
      }
   else if ((GetSenderRef() == switch) && (GetWallCell(switch) == 1))
      {
         PlaySoundPos(poweron, SurfaceCenter(switch), 1.0, -1, -1, 0 );
         PlaySoundPos(poweron, SurfaceCenter(switch1), 1.0, -1, -1, 0);
         SetWallCel(switch,0);                  //on
         ClearAdjoinFlags(damsurf,2);           //no move
         ClearAdjoinFlags(damsurf2,2);
      }
   return;

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

timer:
   if(GetSenderId() == 1)
   {
      damaging=1;
   }

   if(GetSenderId() == 2)
   {
      SetFaceGeoMode(damsurf,0);
      SetFaceGeoMode(damsurf2,0);
   }

   return;

end


Things to be identified in Jed: (1) switch - surface (2 celled mat), (2) damsurf - one side of forcefield adjoin, (3) damsurf 2 - other side of forcefield adjoin. Let me know if it works out.

-Jipe
2000-11-01, 3:12 AM #5
Ok, I put it in the level and when you shoot the switch the damsurf 1 and 2 flash, the switch smokes, and the player recives damage.
Formerly ST_Clan_Leader. But That Name was too Freaking Long.
2000-11-01, 10:45 AM #6
Code:
# Jedi Knight Cog Script
#
# M2_FFieldSwitch.cog
#
# This script operates a forcefield surface that damages
# the player and is controlled by a shootable switch. It 
# also sets this surface to be nomove and translucent.
#
# [SC]
#
# 8/8/97 - YB - Fixed sleep() problem by using timers.
#
# 10/31/00 - Jipe - Changed both switches activated by spacebar to
#                   a single switch activated by weapon shots.
#
# (C) 1997 LucasArts Entertainment Co. All Rights Reserved
# ========================================================================================

symbols

message     damaged
message     touched
message     timer

sound       poweroff=activate04.wav         local
sound       poweron=activate01.wav          local
sound       hitsurf=ForceFieldHit01.wav     local

surface     switch                          mask=0x408 desc=switch
surface     damsurf                         linkid=3   mask=0x448
surface     damsurf2                        linkid=3   mask=0x448

flex        maxdamage=10.0
flex        mindamage=5.0
flex        damage=0.0                      local
flex        interval=0.25                   local

int         damaging=1                      local
int         garbage=0                       local
int         garbage2=0                      local

thing       victim                          local

template    sparks=+heavysmoke              local

end

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

code

touched:
   if ((GetSenderID() == 3) && (damaging == 1))
   {
      PlaySoundPos(hitsurf, SurfaceCenter(damsurf), 1.0, -1, -1, 0 );
      victim = GetSourceRef();
      damage = (Rand()*(maxdamage - mindamage))+mindamage;
      DamageThing(victim,damage,0x2,victim);
      if(!IsMulti()) CreateThing(sparks, GetSourceRef());
      damaging=0;
      SetTimerEx(interval, 1, 0, 0);
   }
   else return;

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

damaged:
   if((GetParam(1) == 1) && (GetThingType() == 10))
      {
         damage = (Rand()*(maxdamage - mindamage))+mindamage;
         DamageThing(victim, damage, 0x1, victim);
         if(!IsMulti()) CreateThing(sparks, GetSourceRef());
         PlaySoundPos(hitsurf, SurfaceCenter(damsurf), 1.0, -1, -1, 0 );
         SetFaceGeoMode(damsurf,3);
         SetFaceGeoMode(damsurf2,3);
         KillTimerEx(2);
         SetTimerEx(0.5, 2, 0, 0);
      }
   else
   if((GetSenderRef() == switch) && (GetWallCell(switch) == 0))
      {
         PlaySoundPos(poweroff, SurfaceCenter(switch), 1.0, -1, -1, 0 );
         PlaySoundPos(poweroff, SurfaceCenter(switch1), 1.0, -1, -1, 0);
         SetWallCel(switch,1);                  //off
         SetAdjoinFlags(damsurf,2);             //move
         SetAdjoinFlags(damsurf2,2);
      }
   else
   if((GetSenderRef() == switch) && (GetWallCell(switch) == 1))
      {
         PlaySoundPos(poweron, SurfaceCenter(switch), 1.0, -1, -1, 0 );
         PlaySoundPos(poweron, SurfaceCenter(switch1), 1.0, -1, -1, 0);
         SetWallCel(switch,0);                  //on
         ClearAdjoinFlags(damsurf,2);           //no move
         ClearAdjoinFlags(damsurf2,2);
      }
   return;

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

timer:
   if(GetSenderId() == 1)
   {
      damaging=1;
   }

   if(GetSenderId() == 2)
   {
      SetFaceGeoMode(damsurf,0);
      SetFaceGeoMode(damsurf2,0);
   }

   return;

end


Try this. Had a few screwed up lines that didn't need to be in there [http://forums.massassi.net/html/smile.gif]

-Jipe

[This message has been edited by Jipe (edited November 01, 2000).]

↑ Up to the top!