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 → Need a quickie cog for SP...........
Need a quickie cog for SP...........
2003-06-01, 11:48 AM #1
Here is the deal, I want to blow a hole in the ground opon cutting some wires, and this is how im going to do it. Upon the damaging of a surface, I need A: An explosion to be generated at 4 ghosts (complete with sound and damage), B: a surface's ADJOIN flags to go from 7 to 5, and its GEO flag to go from 4 to 0, and C: The mat cell to change. Help would be apreciated and credit will be given. Thanks.

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

Restless 2

Sanctum de la Mort
2003-06-01, 2:16 PM #2
heres one that will do what it sounds like you want:
Code:
# Written By DSLS_DeathSythe
symbols
#=====
message   startup
message   damaged
surface   dmgSurf_frnt     mask=0x448
surface   dmgSurf_back     mask=0x448
flex      dmgAmount=50.0
thing     ghostExp_pos0=-1
thing     ghostExp_pos1=-1
thing     ghostExp_pos2=-1
thing     ghostExp_pos3=-1
template  exp_tpl=+raildet_exp
int       hasCut=0     local
int       damage=0.0     local
#-----
end
#=====
code
#-----
startup:
  SetWallCel(dmgSurf_frnt, 0);
  SetWallCel(dmgSurf_back, 0);
  SetSurfaceFlags(dmgSurf_frnt, 0x5);
  SetSurfaceFlags(dmgSurf_back, 0x5);
  ClearAdjoinFlags(dmgSurf_frnt, 0x2);
  ClearAdjoinFlags(dmgSurf_back, 0x2);
  hasCut = 0;
  damage = 0.0;
return;
#-----
damaged:
  if(hasCut == 0)
    {
    if(GetParam(1) != 1 && GetParam(1) != 8)
      {
      damage = damage + GetParam(0);
      if(damage >= dmgAmount)
        {
        hasCut = 1;
        SetWallCel(dmgSurf_frnt, 1);
        SetWallCel(dmgSurf_back, 1);
        ClearSurfaceFlags(dmgSurf_frnt, 0x5);
        ClearSurfaceFlags(dmgSurf_back, 0x5);
        SetAdjoinFlags(dmgSurf_frnt, 0x2);
        SetAdjoinFlags(dmgSurf_back, 0x2);
        CreateThing(exp_tpl, ghostExp_pos0);
        CreateThing(exp_tpl, ghostExp_pos1);
        CreateThing(exp_tpl, ghostExp_pos2);
        CreateThing(exp_tpl, ghostExp_pos3);
        }
      }
    }
  ReturnEx(-1);
return;
#=====
end

i didnt mess with the GEO of the surfaces because if it was set to 0 then you wouldnt see the mats cel change. you will have to change the surfaces GEO to 4 in jed, and if you want the surface to sound like metal you will need to set that flag in jed as well.
it doesnt take damage from punching and force, but force destruction still will damage it because its an explosion.
the 'dmgAmount' is the amount of damage the surface takes before it explodes.
i tested it and it worked for me. hope its what you need.

------------------
Famous last words - "It seemed like a good idea at the time."

[This message has been edited by DSLS_DeathSythe (edited June 01, 2003).]
Famous last words - "It seemed like a good idea at the time."
2003-06-01, 3:31 PM #3
Shouldn't
Code:
if(GetParam(1) != 1 && GetParam(1) != 8)
be
Code:
if((GetParam(1) != 1) && (GetParam(1) != 8))
?

------------------
"The Just shall live by faith." - Galatians 3:11
To edit is human... To COG is divine!!
Catloaf, meet mouseloaf.
My music
2003-06-01, 3:53 PM #4
No, i think you misunderstood. Actually, i think I didnt explain very well. When you slash one surface, a DIFFERENT surface changes to Geo 0 and Adjoin 5. So it appears that when you slash the wires, it opens up a hole in the wall in a different part of the room.

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

Restless 2

Sanctum de la Mort
2003-06-01, 4:32 PM #5
whoopsy [http://forums.massassi.net/html/redface.gif] yep i misunderstood what you wanted.
heres the cog that should do what you want.
Code:
# Written By DSLS_DeathSythe
symbols
#=====
message   startup
message   damaged
surface   dmgSurf     mask=0x448 linkid=1
surface   holeSurf_frnt     linkid=2
surface   holeSurf_back     linkid=2
flex      dmgAmount=50.0
thing     ghostExp_pos0=-1
thing     ghostExp_pos1=-1
thing     ghostExp_pos2=-1
thing     ghostExp_pos3=-1
template  exp_tpl=+raildet_exp
int       hasCut=0     local
int       damage=0.0     local
#-----
end
#=====
code
#-----
startup:
  SetWallCel(dmgSurf, 0);
  SetSurfaceFlags(holeSurf_frnt, 0x5);
  SetSurfaceFlags(holeSurf_back, 0x5);
  ClearAdjoinFlags(holeSurf_frnt, 0x2);
  ClearAdjoinFlags(holeSurf_back, 0x2);
  SetFaceGeoMode(holeSurf_frnt, 4);
  SetFaceGeoMode(holeSurf_back, 4);
  hasCut = 0;
  damage = 0.0;
return;
#-----
damaged:
  if(hasCut == 0)
    {
    if(GetSenderID() == 1)
      {
      if(GetParam(1) != 1 && GetParam(1) != 8)
        {
        damage = damage + GetParam(0);
        if(damage >= dmgAmount)
          {
          hasCut = 1;
          SetWallCel(dmgSurf, 1);
          ClearSurfaceFlags(holeSurf_frnt, 0x5);
          ClearSurfaceFlags(holeSurf_back, 0x5);
          SetAdjoinFlags(holeSurf_frnt, 0x2);
          SetAdjoinFlags(holeSurf_back, 0x2);
          SetFaceGeoMode(holeSurf_frnt, 0);
          SetFaceGeoMode(holeSurf_back, 0);
          CreateThing(exp_tpl, ghostExp_pos0);
          CreateThing(exp_tpl, ghostExp_pos1);
          CreateThing(exp_tpl, ghostExp_pos2);
          CreateThing(exp_tpl, ghostExp_pos3);
          }
        }
      }
    }
  ReturnEx(-1);
return;
#=====
end

i didnt test this one but it should work.

DogSRoOL - i dont think it matters about that part, could be wrong though. it worked just fine the way it was when i was testing it.

------------------
Famous last words - "It seemed like a good idea at the time."

[This message has been edited by DSLS_DeathSythe (edited June 01, 2003).]
Famous last words - "It seemed like a good idea at the time."
2003-06-01, 5:06 PM #6
Quote:
<font face="Verdana, Arial" size="2">DogSRoOL - i dont think it matters about that part, could be wrong though. it worked just fine the way it was when i was testing it.</font>


No, it doesn't matter. The reason it works is because of the operators' precedence. The 'not equal to' operator has a higher precedence so the two equality tests are done first. Like this (assuming true):

(GetParam(1) != 1 && GetParam(1) != 8)
(1 && 1)
(1)

------------------
Author of the JK DataMaster, Parsec, Scribe, and the EditPlus Cog Files.
Author of the JK DataMaster, Parsec, Scribe, and the EditPlus Cog Files.
2003-06-03, 4:26 PM #7
Perfect, thank you.


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

Restless 2

Sanctum de la Mort

↑ Up to the top!