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 → Just want to make sure.
Just want to make sure.
2002-08-13, 5:03 AM #1
Code:
# Jedi Knight Cog Script
#
# crash_forcefield.cog
#
# Just a regular forcefield cog except now it creates a hitwave thingy so it will look like
# the projectile sent a tremor through the forcefield.
#
# [DP (+SM)]
#

symbols

message     touched
message     damaged
message     startup
message     timer

surface     surf0                               mask=0x408
surface     surf1                               mask=0x408
int         victim=-1                           local
int         player=-1                           local
int         damaging=1                          local
int         hit=-1                              local

flex        maxDamage=10.0
flex        minDamage=5.0
flex        interval=0.25
flex        damage                              local

sound       wav0=ForceFieldHum01.wav            local
sound       wav1=ForceFieldHit01.wav            local

template    sparks=+heavysmoke                  local
template    hitwave=+hitwave                    local

end

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

code

Startup:
   SetSurfaceFlags(surf0, 0x4000);
   SetSurfaceFlags(surf1, 0x4000);
   PlaySoundPos(wav0, GetSurfaceCenter(surf0), 1.5, 2.0, 10.0, 0x1);
   Return;

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

Touched:
   If(damaging == 0) Return;
   victim = GetSourceRef();
   damage = (Rand() * (maxDamage - minDamage)) + minDamage;
   DamageThing(victim, damage, 0x2, victim);

   PlaySoundPos(wav1, GetSurfaceCenter(surf0), 0.5, 1, 10, 0);
   If(!IsMulti()) CreateThing(sparks, victim);
   damaging = 0;
   SetTimer(interval);
   Return;

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

Damaged:
   If(GetParam(1) == 1)
   {
      player=GetThingParent(GetSourceRef());
      If(GetThingType(player) != 10) Return;

      damage = (Rand()*(maxDamage - minDamage)) + minDamage;
      DamageThing(player, damage, 0x1, player);
   }
   hit = GetSourceRef();
   CreateThingAtPos(hitwave, GetThingSector(hit), GetThingPos(hit), GetSurfaceNormal(surf0));
   Return;

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

Timer:
   damaging = 1;
   Return;

end
The code should explain it enough. Parsec is clean, my question is, if you input the 'vector' of the surface, (ie across the bottem or the top) will it appear right in the game, and I'm too lazy to create the hitwave textures. (no ,its not a sprite, its going to be a flat 3do with animated surfaces. Else, a few donut 3dos with different scales)

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

The Magician Saber System.

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

Completed
Judgement Day (HLP), My level pack
2002-08-14, 3:23 AM #2
Its the vetor of the surface, so on those angled surfaces, it doesn't appear wrong. That's the main question, if I input the correct vector for the surface (its angle basically), will the hitwave appear on the same vector (or angle)?

Also, I don't see where the first part of code is. The calculations are the same as 00_forcefield's.

I'm also creating the hitwave at whatever damaged the surface, so the Source will be the projectile, and the player will be the Parent of the Source.

BTW, which waay of making the hitwave do you suggest?

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

The Magician Saber System.
Major projects working on:
SATNRT, JK Pistol Mod, Aliens TC, Firearms

Completed
Judgement Day (HLP), My level pack
2002-08-14, 3:49 AM #3
Ah, I see what you mean now. Forget I said that. [http://forums.massassi.net/html/redface.gif]

Yeah, I think that if you use the normal of the surface as the lvec for the hitwave, it should appear correctly. You can use GetSurfaceNormal() instead of defining surfaceVector in the JKL.

Does it work correctly, or is there a problem?

------------------
Author of the JK DataMaster, Parsec, Scribe, and the EditPlus Cog Files.
Author of the JK DataMaster, Parsec, Scribe, and the EditPlus Cog Files.
2002-08-14, 4:14 AM #4
Like I said, its not tested, thanks SaberMaster. Just wanted to know your opinion on which on would look nicer (not quicker/easier, unless they're one in the same I don't exactly know) Revised cog is above.

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

The Magician Saber System.

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

Completed
Judgement Day (HLP), My level pack
2002-08-14, 10:56 AM #5
Looks like it should work well. [http://forums.massassi.net/html/wink.gif]

------------------
Author of the JK DataMaster, Parsec, Scribe, and the EditPlus Cog Files.
Author of the JK DataMaster, Parsec, Scribe, and the EditPlus Cog Files.

↑ Up to the top!