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 → Freaky Crashing
Freaky Crashing
2004-07-28, 12:08 PM #1
In the UR mod I'm using all sorts of ways of getting custom effects(especially templates), but avoid using triggers. I know triggers are the easiest and are proven to work, but they are known for lagging things to hell when used to much. Right now there are some really strange errors I get from these two particular cogs. The error seems to only happen in MP. What happens is that the other player(he was the host too, maybe that has something to do with it)'s model turned into anything(ANYTHING, not just models, it turns into sprites and particle systems too) at random that was created in the level at that moment, like water spashes, blaster bolts, smoke puffs, even particles. There are two particular cogs that seem to have this problem.

The rocket launcher cog, it seems to start the problem as soon as a rocket is fired, it only did it on my side, but the host could fire as many rockets as he wanted without a problem:
Code:
# Jedi Knight Cog Script
#
# WEAP_RAILDET.COG
#
# WEAPON 7 script - Rail Detonator
#
# Modified raildet.
#
# __Ace_1__

symbols

model       povModel=dflt.3do                   local
model       weaponMesh=plxg.3do                 local

keyframe    mountAnim=StrVmnt.key               local
keyframe    dismountAnim=StrVdis.key            local
keyframe    povfireAnim=StrVpst1.key            local
keyframe    holsterAnim=kyhlstr.key             local

sound       mountSound=df_rif_ready.wav         local
sound       dismountSound=PutWeaponAway01.wav   local
sound       fireSound=RailChargeFire01.wav      local
sound       outSound=RailChargeEmpty01.wav      local

template    projectile=+raildet                 local
template    projectile2=+raildet2               local

thing       player                              local

vector      randVec                             local

flex        fireWait=1.0                        local
flex        wait1=0.35                          local
flex        wait2=0.5                           local
flex        holsterWait                         local
flex        powerBoost                          local
flex        autoAimFOV=30                       local
flex        autoAimMaxDist=5                    local

int         magazine=0                          local
int         reloading=0                         local

int         ammobin=15                          local

int         Delay=0                             local
int         burst=1                             local
int         rocketing=1                         local
int         rocketslow=1                        local
int         firemode=0                          local
int         damagemode=0                        local

int         dummy                               local
int         seekerthing                         local
int         victim                              local
int         trackID=-1                          local
int         fireChannel=-1                      local
int         holsterTrack                        local
int         mode                                local

vector      lookvel                             local
vector      curvel                              local

message     activated
message     deactivated
message     selected
message     deselected
message     autoselect
message     fire
message     timer
message     killed
#message     user1
message     user2
message     removed

end

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

code

fire:
   player = GetSourceRef();
   mode = GetSenderRef();

   // Check that the player is still alive.
   if(GetThingHealth(player) <= 0)
   {
      Return;
   }

   // Check Ammo - If we are out, autoselect best weapon.
   // It should always use two energy cells, but -- as in DF --
   // allow the last fire if there is only one left...
   if(GetInv(player, ammobin) < 1.0)
   {
      PlaySoundThing(outSound, player, 1.0, -1, -1, 0x80);
      Return;
   }

   if((magazine >= 400) || (reloading == 1))
   {
      call user1;
      Return;
   }

      call shoot;

   Return;

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

shoot:

   KillTimerEx(21);
   KillTimerEx(22);
   ID = 71;
   SendMessageEx(GetInvCog(player, 140), user0, player, dummy, 0, ID);

   dummy = FireProjectile(player, projectile, -1, 8, '0.035 0.05 0.015', '0 0 0', 1.0, 0x20, autoAimFOV, autoAimFOV*2);
   SetCollideType(dummy, 0);
   SetThingVel(dummy, GetThingVel(player));
   PlaySoundThing(fireSound, player, 1.0, -1.0, -1.0, 0x80);
   SetWeaponFlags(dummy, 0x300);
   SetThingRotVel(dummy, '0 0 0');

   if(damagemode == 0)
   {
      SetThingModel(dummy, LoadModel("rld0.3do"));
   }
   else if(damagemode == 1)
   {
      SetThingModel(dummy, LoadModel("rld1.3do"));
   }
   else if(damagemode == 2)
   {
      SetThingModel(dummy, LoadModel("rld2.3do"));
   }

   if(firemode == 0)
   {
      SetTimerEx(0.1, 20, dummy, player);
   }
   else if(firemode == 1)
   {
      SetTimerEx(0.1, 20, dummy, player);
      SetTimerEx(0.15, 21, dummy, player);
      CaptureThing(dummy);
   }
   else if(firemode == 2)
   {
      SetTimerEx(0.1, 22, dummy, player);
      ID = 70;
      SendMessageEx(GetInvCog(player, 140), user0, player, dummy, 0, ID);
      CaptureThing(dummy);
      SetLifeLeft(dummy, 60.0);
      rocketing = 2;
   }

      ChangeInv(player, ammobin, -1.0);

      powerBoost = GetInv(player, 63);
      ChangeFireRate(player, fireWait/powerBoost);
   Return;

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

activated:
   player = GetSourceRef();
   mode = GetSenderRef();

   jkSetWaggle(player, '0.0 0.0 0.0', 0);

   if(Delay != 1)
   {
      if(mode == 0)
      {
         if(rocketing == 2)
         {
            rocketslow = 2;
         }

         if(GetInv(player, ammobin) < 1.0)
         {
            PlaySoundThing(outSound, player, 1.0, -1, -1, 0x80);
            Return;
         }

         if(rocketing != 2)
         {
            call shoot;
         }

      }
      else if(mode == 1)
      {
         for(i=0; i<=GetThingCount(); i=i+1)
         {
            if((GetThingTemplate(i) == LoadTemplate("+raildet")) && (GetThingModel(i) == LoadModel("rld0.3do")) && (GetThingParent(i) == player))
            {
               FireProjectile(i, LoadTemplate("+raildet_exp"), -1, -1, '0.0 0.0 0.0', '0 0 0', 1.0, 0x20, 0, 0);
            }
            KillTimerEx(21);
            KillTimerEx(22);
            if(dummy != -1)
            {
               ReleaseThing(dummy);
            }
   ID = 71;
   SendMessageEx(GetInvCog(player, 140), user0, player, dummy, 0, ID);
   rocketing = 1;
         }
      }
      Delay = 1;
      SetTimerEx(0.5, 3, 0, 0);
   }

   Return;

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

deactivated:
   player = GetSourceRef();
   jkSetWaggle(player, '10.0 7.0 0.0', 350);
            rocketslow = 1;
   Return;

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

selected:
   player = GetSourceRef();

   Print("Missle Tube");

   jkSetPOVModel(player, povModel);
   ID = 9525;
   SendMessageEx(GetInvCog(player, 131), user0, player, 7, 0, ID);

   PlayMode(player, 41);
   PlaySoundThing(mountSound, player, 1.0, -1, -1, 0x80);
   SetMountWait(player, GetKeyLen(mountAnim));
   jkClearFlags(player, 0x5);
   SetCurWeapon(player, 7);
   burst = 1;
   Delay = 0;
   reloading = 0;
   rocketing = 1;
   jkSetWeaponMesh(player, weaponMesh);
   SetArmedMode(player, 1);
   SendTrigger(-1, 700, player, 7, 0, 0);

   SetInv(player, 21, 1);
   SetInv(player, 22, 1);
   SetInv(player, 23, 1);
   SetInvAvailable(player, 21, 1);
   SetInvAvailable(player, 22, 1);
   SetInvAvailable(player, 23, 1);
   SetInv(player, 14, (400 - magazine));
            rocketslow = 1;

   Return;

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

deselected:
   player = GetSourceRef();

   ID = 9550;
   SendMessageEx(GetInvCog(player, 131), user0, player, 7, 0, ID);

   PlaySoundThing(dismountSound, player, 1.0, -1, -1, 0x80);
   holsterWait = GetKeyLen(holsterAnim);
   SetMountWait(player, holsterWait);
   holsterTrack = PlayKey(player, holsterAnim, 1, 0x4);
   SetTimerEx(holsterWait, 2, 0.0, 0.0);
   jkSetWaggle(player, '0.0 0.0 0.0', 0);
   KillTimerEx(4);
   SendTrigger(-1, 710, player, 7, 0, 0);
   KillTimerEx(21);
   KillTimerEx(22);
   if(dummy != -1)
   {
      ReleaseThing(dummy);
   }
   ID = 71;
   SendMessageEx(GetInvCog(player, 140), user0, player, dummy, 0, ID);
   rocketing = 1;


   Return;

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

autoselect:
   player = GetSourceRef();

   // If the player has the weapon
   if(GetInv(player, 7) != 0.0)
   {
      ReturnEx(500.0);
   }
   else
   {
      ReturnEx(-1.0);
   }

   Return;

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

killed:

   if(GetSenderRef() == player)
   {
   KillTimerEx(21);
   KillTimerEx(22);
   if(dummy != -1)
   {
      ReleaseThing(dummy);
   }
      magazine = 0;
   ID = 71;
   SendMessageEx(GetInvCog(player, 140), user0, player, dummy, 0, ID);
   rocketing = 1;
   }

   Return;

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

user1:
   if((magazine != 0) && (reloading == 0))
   {
      PlaySoundThing(outSound, player, 1.0, -1, -1, 0x80);
      ID = 72;
      SendMessageEx(GetInvCog(player, 131), user0, player, 7, 0, ID);
      reloading = 1;
      SetTimerEx(2.5, 4, 0, 0);
      Print("Inserting New Clip...");
   rocketing = 1;
   }
      Return;

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

timer:
   if(GetSenderId() == 1)
   {
      call shoot;

      burst = (burst+1);
      if(burst < 3)
      {
         SetTimerEx(0.12, 1, 0, 0);
      }
      Return;
   }
   if(GetSenderId() == 2)
   {
      StopKey(player, holsterTrack, 0.0);
      Return;
   }
   if(GetSenderId() == 3)
   {
      Delay = 0;
      Return;
   }
   if(GetSenderId() == 4)
   {
      magazine = 0;
      reloading = 0;
      Print("Loaded");
      Return;
   }
   if(GetSenderId() == 5)
   {
      jkSetWeaponMesh(player, weaponMesh);
      SetArmedMode(player, 1);
      SendTrigger(-1, 700, player, 7, 0, 0);
      Delay = 0;
      Return;
   }

   if(GetSenderId() == 20)
   {
      dummy = GetParam(0);
      SetThingVel(dummy, VectorScale(GetThingLVec(dummy), 2.5));
      SetCollideType(dummy, 1);
      Return;
   }
   if(GetSenderId() == 21)
   {
      dummy = GetParam(0);
      player = GetParam(1);
      victim = FirstThingInView(player, 90, 15, 0x404);
      if((dummy != -1) && (victim != -1))
      {
         curvel = VectorScale(GetThingLVec(dummy), 2.0);
         SetThingLook(dummy, VectorSub(GetThingPos(victim), GetThingPos(dummy)));
         lookvel = VectorScale(GetThingLVec(dummy), 1.0);
         SetThingVel(dummy, VectorAdd(curvel, lookvel));
         SetTimerEx(0.2, 21, dummy, player);
      }
      SetCollideType(dummy, 1);
      Return;
   }
   if(GetSenderId() == 22)
   {
      dummy = GetParam(0);
      player = GetParam(1);
      seekerthing = FireProjectile(player, LoadTemplate("+punch"), -1, -1, '0.0 0.05 0.0', '0 0 0', 1.0, 0x20, -1, -1);
      SetThingLook(dummy, GetThingLVec(seekerthing));
      SetThingVel(dummy, VectorScale(GetThingLVec(dummy), (2.0/rocketslow)));
      SetCollideType(dummy, 1);
      SetTimerEx(0.2, 22, dummy, player);
      Return;
   }

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

user2:
   KillTimerEx(21);
   KillTimerEx(22);
   if(dummy != -1)
   {
      ReleaseThing(dummy);
   }
   ID = 71;
   SendMessageEx(GetInvCog(player, 140), user0, player, dummy, 0, ID);
   rocketing = 1;
   if(GetParam(3) == 10)
   {
      if(firemode == 0)
      {
         Print("Firemode set to Seeking");
         firemode = 1;
      }
      else if(firemode == 1)
      {
         Print("Firemode set to Guided");
         firemode = 2;
      }
      else if(firemode == 2)
      {
         Print("Firemode set to Normal");
         firemode = 0;
      }
   }
   else if(GetParam(3) == 20)
   {
      if(reloading == 0)
      {
         PlaySoundThing(outSound, player, 1.0, -1, -1, 0x80);
         ID = 72;
         SendMessageEx(GetInvCog(player, 131), user0, player, 7, 0, ID);
         reloading = 1;
         SetTimerEx(2.5, 4, 0, 0);
         Print("Inserting New Clip...");
      }
      else
      {
         Return;
      }
      if(damagemode == 0)
      {
         Print("Using Cluster Rockets");
         damagemode = 1;
      }
      else if(damagemode == 1)
      {
         Print("Using Stun Rockets");
         damagemode = 2;
      }
      else if(damagemode == 2)
      {
         Print("Using Concussion Rockets");
         damagemode = 0;
      }
   }

   Return;

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

removed:

   KillTimerEx(21);
   KillTimerEx(22);
   if(dummy != -1)
   {
      ReleaseThing(dummy);
   }
   ID = 71;
   SendMessageEx(GetInvCog(player, 140), user0, player, dummy, 0, ID);
   rocketing = 1;

   Return;

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

end


And the Crossbow cog, the problem seems to only come up on the player's side when the other player(he was the host too) fires 1st fire. here's the cog:
Code:
# Jedi Knight Cog Script
#
# WEAP_CROSSBOW.COG
#
# WEAPON 5 Script - Crossbow
#
# - Affected by MagSealed sectors/surfaces.
#
# [YB & CYW]
#
# (C) 1997 LucasArts Entertainment Co. All Rights Reserved


symbols

model       povModel=BowV.3do                   local
model       weaponMesh=BowG.3do                 local

keyframe    mountAnim=BowVmnt.key               local
keyframe    dismountAnim=BowVdis.key            local
keyframe    povfireAnim=BowVpst1.key            local
keyframe    holsterAnim=kyhlstr.key             local

sound       mountSound=df_bry_ready.wav         local
sound       dismountSound=PutWeaponAway01.wav   local

sound       chargeSound=disruptchargedfire1.wav  local
sound       fireSound1=disruptfire1.wav          local
sound       fireSound2=disruptfire1.wav         local
sound       outSound=trprout.wav                local

template    projectile=+crossbowbolt            local

flex        fireWait=0.175                      local
flex        delayTime                           local
flex        error                               local
flex        autoAimFOV=30                       local
flex        autoAimMaxDist=10                   local
flex        powerBoost                          local
flex        holsterWait                         local

vector      errorVec                            local

thing       player                              local

int         dummy                               local
int         dummyb                              local
int         trackID=-1                          local
int         channel=-1                          local
int         holsterTrack                        local
int         retval=0                         local

message     startup
message     activated
message     deactivated
message     selected
message     deselected
message     newplayer
message     autoselect
message     fire
message     killed
message     timer
message     touched

end

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

code

startup:
   player = GetLocalPlayerThing();

   Return;

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

activated:
   mode = GetSenderRef();

   jkSetWaggle(player, '0.0 0.0 0.0', 0);

   // Check Ammo - If we are out, autoselect best weapon.
   if(GetInv(player, 12) < 2.0)
   {
         PlaySoundThing(outSound, player, 1.0, -1, -1, 0x80);

      Return;
   }

   if(mode == 0)
   {
      if(Delay != 1)
      {
         Delay = 1;
         SetTimerEx(0.6, 3, player, player);
         PlaySoundThing(chargeSound, player, 1.0, -1, -1, 0x80);
      }
   }
   else
   {
      powerBoost = GetInv(player, 63);
      ActivateWeapon( player, fireWait/powerBoost, mode);
   }

   Return;

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

fire:
   // Check that the player is still alive.
   if(GetThingHealth(player) <= 0) Return;

   // Check Ammo - If we are out, autoselect best weapon.
   if(GetInv(player, 12) < 2.0)
   {
         PlaySoundThing(outSound, player, 1.0, -1, -1, 0x80);
      Return;
   }

   SetPOVShake('0.0 -.01 0.0', '2.0 0.0 0.0', .05, 80.0);
   dummy = FireProjectile(player, projectile, firesound1, 8, '0.0207 0.0888 0.00', '0 0 0', 1.0, 0x20, autoAimFOV, autoAimFOV*2);
   SetThingModel(dummy, LoadModel("bow0.3do"));
   ChangeInv(player, 12, -2.0);
   jkPlayPOVKey(player, povfireAnim, 1, 0x38);

   powerBoost = GetInv(player, 63);
   ChangeFireRate(player, fireWait/powerBoost);

   Return;


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

deactivated:
   mode = GetSenderRef();

   jkSetWaggle(player, '10.0 7.0 0.0', 350);

      DeactivateWeapon(player, mode);

   Return;

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

selected:
   // Play external animation
   PlayMode(player, 41);

   // Set up meshes and models.
   jkSetPOVModel(player, povModel);
   SetArmedMode(player, 1);
   jkSetWeaponMesh(player, weaponMesh);
   jkSetWaggle(player, '10.0 7.0 0.0', 350);

   // Play sound and animation.
   PlaySoundThing(mountSound, player, 1.0, -1, -1, 0x80);
   trackID = jkPlayPOVKey(player, mountAnim, 0, 20);
   SetMountWait(player, GetKeyLen(mountAnim));

   // Set flags, etc.
   jkClearFlags(player, 0x5);
   SetCurWeapon(player, 5);

   // Check Ammo - If we are out, autoselect best weapon.
   if(GetInv(player, 12) < 2.0)
   {
      if((GetAutoSwitch() & 1))
         SelectWeapon(player, AutoSelectWeapon(player, 1));
   }
      Delay = 0;

   Return;

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

deselected:
   PlaySoundThing(dismountSound, player, 1.0, -1, -1, 0x80);
   jkPlayPOVKey(player, dismountAnim, 0, 18);
   
   holsterWait = GetKeyLen(holsterAnim);
   SetMountWait(player, holsterWait);
   holsterTrack = PlayKey(player, holsterAnim, 1, 0x4);
   SetTimerEx(holsterWait, 2, 0.0, 0.0);
   if (trackID != -1)
   {
      jkStopPOVKey(player, trackID, 0);
      trackID = -1;
   }
   jkSetWaggle(player, '0.0 0.0 0.0', 0);
   
   if(channel != -1)
   {
      StopSound(channel, 0.1);
      channel = -1;
   }

   Return;

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

killed:
   if (player == GetSenderRef())
   {
      if(channel != -1)
      {
         StopSound(channel, 0.1);
         channel = -1;
      }
   }
   Return;

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

newplayer:
//   // Make sure that if the player is respawning, the old mount isn't playing anymore.
//   if (trackID != -1)
//   {
//      jkStopPOVKey(player, trackID, 0);
//      trackID = -1;
//   }

   if(channel != -1)
   {
      StopSound(channel, 0.1);
      channel = -1;
   }

   Return;

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

autoselect:
   // If the player has the weapon
   if(GetInv(player, 5) != 0.0)
   {
      // If the player has ammo
      if(GetInv(player, 12) > 1.0)
      {
         ReturnEx(700.0);
      }
      else
      {
         ReturnEx(-1.0);
      }
   }
   else
   {
      ReturnEx(-1.0);
   }

   Return;

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

timer:

   if(GetSenderID() == 2)
   {
      StopKey(player, holsterTrack, 0.0);
   }
   if(GetSenderID() == 3)
   {
      dummy = FireProjectile(player, projectile, -1, -1, '0.0207 0.0888 0.00', '0 0 0', 1.0, 0x20, autoAimFOV, autoAimFOV*2);
      SetCollideType(dummy, 0);
      SetThingVel(dummy, GetThingVel(player));
      SetLifeLeft(dummy, 0.125);
      SetThingModel(dummy, LoadModel("laserflash.3do"));

      dummy = FireProjectile(player, projectile, -1, 8, '0.0207 0.0888 0.00', '0 0 0', 1.0, 0x20, autoAimFOV, autoAimFOV*2);
      SetThingVel(dummy, VectorScale(GetThingLVec(dummy), 15));
      CaptureThing(dummy);
      SetThingModel(dummy, LoadModel("bow0.3do"));
      ChangeInv(player, 12, -10.0);
      Delay = 0;
   jkPlayPOVKey(player, povfireAnim, 1, 0x38);
   }
   Return;

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

touched:
   // Bullet damage done here
   victim = GetSourceRef();
   dummy = GetSenderRef();
   if(GetThingType(victim) == 10)      // OTHER PLAYER
   {
         retval = SkillTarget(victim, player, 5, 5);
         if((IsMulti()) && (victim == player)) // Because skill target wont be coming back to the player's side in a multiplayer game
         {
      SetThingFlags(victim, 0x10);
      dummyb = FireProjectile(victim, LoadTemplate("+bryarbolt"), -1, -1, '0.0 0.0 0.0', '0 0 0', 1.0, 0x20, -1, -1);
      SetThingFlags(dummyb, 0x10);
      SetCollideType(dummyb, 0);
      SetThingVel(dummyb, GetThingVel(victim));
      SetThingModel(dummyb, LoadModel("sabp.3do"));
      DamageThing(victim, 10000, 0x8, player);
         }
         Print("hit");
   }
   else                                // ANY OTHER ENEMY
   {
      SetThingFlags(victim, 0x10);
      dummyb = FireProjectile(victim, LoadTemplate("+bryarbolt"), -1, -1, '0.0 0.0 0.0', '0 0 0', 1.0, 0x20, -1, -1);
      SetThingFlags(dummyb, 0x10);
      SetCollideType(dummyb, 0);
      SetThingVel(dummyb, GetThingVel(victim));
      SetThingModel(dummyb, LoadModel("sabp.3do"));
      DamageThing(victim, 10000, 0x8, player);
   }
   if(dummy != -1)
   {
      ReleaseThing(dummy);
   }
   Return;

end


This is another cog that might have something to do with the problems... :
Code:
# Jedi Knight Cog Script
#
# PROJECTILES.COG
#
# controls custom projectiles
#
# __Ace_1__

flags=0x240

symbols

template    changetpl=+crossbowbolt          local
model       newmodel=str0.3do                local
flex        i                                local
int         player                           local
int         dummy                            local
int         dummy2                           local
int         dummy3                           local
int         dummy4                           local
int         dummy5                           local

message     startup
message     shutdown
message     pulse

end

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

code
startup:
   SetPulse(0.01);

   Return;

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

shutdown:
   SetPulse(0);

   Return;

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

pulse:
   for(i=0; i<=GetThingCount(); i=i+1)
   {
      if(GetThingTemplate(i) == LoadTemplate("+bryarbolt"))
      {
         if(GetThingModel(i) == LoadModel("sabp.3do"))
         {
            dummy = FireProjectile(i, LoadTemplate("+disint"), -1, -1, '0 0 0', '0 0 0', 1.0, 0x20, -1, -1);
            SetThingModel(i, LoadModel("disint1.3do"));
            SetLifeLeft(i, 0.1);
            Print("disintergrate animation created");
         }
         if(GetThingModel(i) == LoadModel("bryg.3do"))
         {
            ParseArg(i, "explode=+blasthit fleshhit=+blastfleshhit damage=35.000000");
            SetThingModel(i, LoadModel("bry0.3do"));
            SetCollideType(i, 1);
            DetachThing(i);
            //SetThingVel(i, VectorScale(GetThingVel(i), 1.5));
            SetThingVel(i, VectorScale(GetThingLVec(i), 6));
            ClearThingFlags(i, 0x10);
            Print("low power blasterbolt created");
         }
         if(GetThingModel(i) == LoadModel("strg.3do"))
         {
            ParseArg(i, "explode=+blasthit fleshhit=+blastfleshhit damage=70.000000");
            SetThingModel(i, LoadModel("str0.3do"));
            SetCollideType(i, 1);
            DetachThing(i);
            SetThingVel(i, VectorScale(GetThingLVec(i), 7));
            ClearThingFlags(i, 0x10);
            Print("high power blasterbolt created");
         }
         if(GetThingModel(i) == LoadModel("stunner0.3do"))
         {
            ParseArg(i, "explode=+elecball fleshhit=+elecball2 damage=1.000000");
            SetThingModel(i, LoadModel("stun0.3do"));
            SetCollideType(i, 1);
            DetachThing(i);
            SetThingVel(i, VectorScale(GetThingLVec(i), 7));
            ClearThingFlags(i, 0x10);
         }
         if(GetThingModel(i) == LoadModel("stunner1.3do"))
         {
            ParseArg(i, "explode=+elecball fleshhit=+elecball2 damage=1.000000");
            SetThingModel(i, LoadModel("stun1.3do"));
            SetCollideType(i, 1);
            DetachThing(i);
            SetThingVel(i, VectorScale(GetThingLVec(i), 7));
            ClearThingFlags(i, 0x10);
            Print("level 1 stunbolt created");
         }
         if(GetThingModel(i) == LoadModel("stunner2.3do"))
         {
            ParseArg(i, "explode=+elecball fleshhit=+elecball2 damage=1.000000");
            SetThingModel(i, LoadModel("stun2.3do"));
            SetCollideType(i, 1);
            DetachThing(i);
            SetThingVel(i, VectorScale(GetThingLVec(i), 7));
            ClearThingFlags(i, 0x10);
            Print("level 2 stunbolt created");
         }
         if(GetThingModel(i) == LoadModel("stunner3.3do"))
         {
            ParseArg(i, "explode=+elecball fleshhit=+elecball2 damage=1.000000");
            SetThingModel(i, LoadModel("stun3.3do"));
            SetCollideType(i, 1);
            DetachThing(i);
            SetThingVel(i, VectorScale(GetThingLVec(i), 7));
            ClearThingFlags(i, 0x10);
            Print("level 3 stunbolt created");
         }
         if(GetThingModel(i) == LoadModel("stunner4.3do"))
         {
            ParseArg(i, "explode=+elecball fleshhit=+elecball2 damage=1.000000");
            SetThingModel(i, LoadModel("stun4.3do"));
            SetCollideType(i, 1);
            DetachThing(i);
            SetThingVel(i, VectorScale(GetThingLVec(i), 7));
            ClearThingFlags(i, 0x10);
            Print("level 4 stunbolt created");
         }
         if(GetThingModel(i) == LoadModel("stunner5.3do"))
         {
            ParseArg(i, "explode=+elecball fleshhit=+elecball2 damage=1.000000");
            SetThingModel(i, LoadModel("stun5.3do"));
            SetCollideType(i, 1);
            DetachThing(i);
            SetThingVel(i, VectorScale(GetThingLVec(i), 7));
            ClearThingFlags(i, 0x10);
            Print("level 5 stunbolt created");
         }
         if(GetThingModel(i) == LoadModel("melee0.3do"))
         {
            SetThingFlags(i, 0x10);
            SetThingModel(i, LoadModel("melee1.3do"));
            SetThingUserData(i, 405);
            ParseArg(i, "explode=+blastsmoke fleshhit=+blastsmoke damage=25.000000 damageclass=0x1");
            SetCollideType(i, 1);
            DetachThing(i);
            SetThingVel(i, VectorScale(GetThingLVec(i), 4));
            Print("melee hit created");
         }
      }
      if(GetThingTemplate(i) == LoadTemplate("+raildet"))
      {
         if(GetThingModel(i) == LoadModel("rld0.3do"))
         {
            ParseArg(i, "explode=+nconcussion_exp fleshhit=+nconcussion_exp");
            SetThingModel(i, LoadModel("railrocket.3do"));
            SetCollideType(i, 1);
            DetachThing(i);
            Print("concussion rocket created");
         }
         if(GetThingModel(i) == LoadModel("rld1.3do"))
         {
            ParseArg(i, "explode=+cluster_exp fleshhit=+cluster_exp");
            SetThingModel(i, LoadModel("railrocket.3do"));
            SetCollideType(i, 1);
            DetachThing(i);
            Print("cluster rocket created");
         }
         if(GetThingModel(i) == LoadModel("rld2.3do"))
         {
            ParseArg(i, "explode=+stunning_exp fleshhit=+stunning_exp");
            SetThingModel(i, LoadModel("railrocket.3do"));
            SetCollideType(i, 1);
            DetachThing(i);
            Print("stun rocket created");
         }
      }

      if(GetThingTemplate(i) == LoadTemplate("+blastsmoke"))
      {
         SetThingLook(i, VectorSub(GetThingPos(jkGetLocalPlayer()), GetThingPos(i)));
      }
      if(GetThingTemplate(i) == LoadTemplate("+bigsmoke"))
      {
         SetThingLook(i, VectorSub(GetThingPos(jkGetLocalPlayer()), GetThingPos(i)));
      }

   }
   Return;

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

end


Please help...... I have no clue what's causing this problem

------------------
GetThingSignature(Ace1);
I am _ Ace_1 _ , and I approve this message.
2004-07-28, 1:17 PM #2
I can't tell you what's causing your problem, I've still gotta pour over that code and see if I can find the problem. However, you have a seperate critical flaw in your coding:

in projectiles.cog, you have this line:
for(i=0; i<=GetThingCount(); i=i+1)
the problem is GetThingCount() doesn't return the total number of current things; it simply returns the World Things number in the level's jkl file. It's a clever attempt to run through all things in the level and find projectiles, but it scans thing numbers that have no data and it won't scan any things that have an index number greater than the World Things number. Also, even if it did work, you'd want i<GetThingCount() not i<=GetThingCount().

Quib Mask
2004-07-28, 3:11 PM #3
Quib, I've been meaning to get ahold of you. Any particular method you'd prefer?

JediKirby

------------------
jEDIkIRBY - Putting the Romance back into Necromancer.
Proud Leader of the Minnessassian Council

Live on, Adam.
ᵗʰᵉᵇˢᵍ๒ᵍᵐᵃᶥᶫ∙ᶜᵒᵐ
ᴸᶥᵛᵉ ᴼᵑ ᴬᵈᵃᵐ
2004-07-28, 3:53 PM #4
Send me an e-mail by getting my address through the little e-mail button in these forums on one of my posts. I'll check it every day for the next three days, after that, no guarantees I'll get the e-mail. Keep the subject line short so it doesn't get lost in the spam.

Sorry to post something unrelated to your thread Ace1, I am still seeing if I can figure out what's causing the problem. I have seen what you're describing before, where a player looked like a different template (sprite, particles, etc.), my guess is it's related to an uncontrolled thing reference somewhere, where some change is applied to thing 0 (the host), instead of a projectile or something.

Quib Mask
2004-07-30, 3:45 PM #5
Bump?

------------------
jEDIkIRBY - Putting the Romance back into Necromancer.
Proud Leader of the Minnessassian Council

Live on, Adam.
ᵗʰᵉᵇˢᵍ๒ᵍᵐᵃᶥᶫ∙ᶜᵒᵐ
ᴸᶥᵛᵉ ᴼᵑ ᴬᵈᵃᵐ

↑ Up to the top!