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 → Up down, forwards backwards, left right.
Up down, forwards backwards, left right.
2001-04-10, 10:10 AM #1
ok a vectors question, i want to create a ghost object above the victim, about 2 units above them, now i got told that you would have to add to the vector of the player, so this is my best soht at the verb, please correct my mistakes [http://forums.massassi.net/html/smile.gif]

CreateThingatPos(ghost, -1, victim VectorAdd(X,+3), -1);

------------------
Generating Electro Vibes™ for the masses on Massassi
Go To: EL3CTROPROSE
or
DEEPMATRIX

[This message has been edited by Electro (edited April 10, 2001).]
Generating Electro Vibes™ for the masses on Massassi
Go To: BiTsToRm Forums or L3CY's Topsites
Boba Jules: You ever read the bible TK-421?
TK-421: No?
Boba Jules: Oh, ok...
*BLAM BLAM BLAM BLAM*
<EL3CTRO> EXCAUSE ME MISTAR CAERV BUT I LIEK MY PHORUMPHS!
2001-04-10, 10:23 AM #2
CreateTHingAtPos(ghost, GetThingSector(player), VectorAdd(GetThingPos(player),'0 0 .2', '0 0 0');

im a little rusty, but that should be what you want
I'm just an old man with a skooma problem.
2001-04-10, 10:48 AM #3
ok, i have added that, but now the cog doesnt work, i wish cog wasent so touchy [http://forums.massassi.net/html/frown.gif]

I have the code:
CreateThingatPos(ghost, GetThingSector(player), VectorAdd(GetThingPos(player),'0 0 .2', '0 0 0);

CreateThing(ioncol, ghost);

anything wrong there?

Oh and the whole cog is: (its based off of force grip, i am experimenting [http://forums.massassi.net/html/biggrin.gif])
Code:
# Jedi Knight Cog Script
#
# FORCE_GRIP.COG
#
# FORCEPOWER Script - The Grip
#  Dark Side Power
#  Bin 31
#
# Edited by electro for the beginning of the Ion Cannon weapon.
#
# 

symbols

thing       player                           local
thing       victim                           local
thing       potential                        local

flex        cost=50.0                        local
flex        mana                             local
flex        dot                              local
flex        maxDot                           local
flex        damage                           local
flex        starthealth                      local
int         rank                             local
int         retval=0                         local

sound       gripSound=ForceGrip01.WAV        local

int         limit                            local
int         count                            local

int         active=0                         local
int         targetting=0                     local

template    ionblast=+conc_exp               local
template    ioncol=+concblast2

message     startup
message     activated
message     deactivated
message     pulse
message     timer
message     newplayer
message     killed
message     selected
message     deselected

end

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

code

startup:
   player = GetLocalPlayerThing();

   SetInvActivated(player, 31, 0);

   Return;

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

activated:
   // Cannot use power if blinded
   if(GetActorFlags(player) & 0x800) Return;

   if(active) Return;

   mana = GetInv(player, 14);
   if(mana >= cost)
   {
      victim = -1;
      active = 1;
      targetting = 1;
      SetPulse(0.33);
   }
   Return;

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

deactivated:
   // If no victim was found just cleanup and exit
   if((victim == -1) || (GetThingHealth(player) <= 0) || !active)
   {
      call stop_power;
      Return;
   }

   SetPulse(0);
   jkEndTarget();
   targetting = 0;

   mana = GetInv(player, 14);
   if(mana >= cost)
   {
      if(HasLOS(player, victim))             // check that we still have a LOS on it...
      {
         SetBinWait(player, 31, rank + 0.5);

         PlayMode(player, 24);
         if(GetInv(player, 64) != 1) ChangeInv(player, 14, -cost);
         rank = GetInv(player, 31);
         limit = rank * 2;
         starthealth = GetThingHealth(player);

         if(GetThingType(victim) == 10)
         {
            // Multiplayer enemies
            if(!(GetThingFlags(victim) & 0x200))
            {
               retval = SkillTarget(victim, player, 31, rank);
               SetPulse(0.1);
               count = 0;
               SetInvActivated(player, 31, 1);
            }
            else
            {
               Return;
            }
         }
         else
         {
            damage = SkillTarget(victim, player, 31, 0);

            if(damage > 0.0)
            {
               // Play choke animation on the victim.
               PlayMode(victim, 25);
               SetPulse(0.1);
               count = 0;
               SetInvActivated(player, 31, 1);
            }
         }
      }
   }

   Return;

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

pulse:
   if(targetting == 1)
   {
      // Check all things for our victim.
      victim = -1;
      maxDot = 0;

      // Search for all players and actors.
      potential = FirstThingInView(player, 70, 4, 0x404);
      while(potential != -1)
      {
         if(
            HasLOS(player, potential) &&
            (potential != player) &&
            (VectorDist(GetThingPos(player), GetThingPos(potential)) <= 1) &&
            !(GetThingFlags(potential) & 0x200) &&
            !(GetActorFlags(potential) & 0x100) &&
            !((jkGetFlags(potential) & 0x20) && !IsInvActivated(player, 23))
           )
         {
            if(!BitTest(GetActorFlags(potential), 0x100))
            {
               dot = ThingViewDot(player, potential);
               if(dot > maxDot)
               {
                  victim = potential;
                  maxDot = dot;
               }
            }
         }
         potential = NextThingInView();
      }

      // If we have a victim...
      if(victim != -1)
      {
         jkSetTargetColors(2, 7, 5);
         jkSetTarget(victim);
      }
      else
      {
         jkEndTarget();
      }
   }
   // this is the real Grip pulse
   else
   {
      if((count > limit) ||
         (GetThingHealth(player) < starthealth) ||
         (GetActorFlags(player) & 0x800) ||
         (GetThingFlags(victim) & 0x200)
        )
      {
         call stop_power;
         Return;
      }

      if(HasLOS(player, victim))
      {
         if(GetThingType(victim) == 10)      // OTHER PLAYER
         {
            // everything is done in the victim's KYLE.COG handler
            if(!(GetThingFlags(victim) & 0x200))
               retval = SkillTarget(victim, player, 31, rank);
         }
         else                                // ENEMY
         {
            DamageThing(victim, 50, 0x8, player);
            // Force the victim to stay in place
            SetActorFlags(victim, 0x40000);
            // But prepare to free it again in 0.45 seconds
            SetTimerEx(0.45, victim, GetThingSignature(victim), 0);
            AddDynamicTint(victim, 0, 0, 255);
            CreateThingatPos(ghost, GetThingSector(player), VectorAdd(GetThingPos(player),'0 0 .2', '0 0 0);
            CreateThing(ioncol, ghost);
}

         PlaySoundThing(gripSound, victim, 1.0, -1, -1, 0x80);
         count = count + 1;
         SetPulse(0.5);
      }
      else
      {
         // break the power if LOS is lost
         call stop_power;
      }
   }

   Return;

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

timer:
   // This checks that the thing ref is still assigned to the same thing
   if(GetThingSignature(GetSenderId()) == GetParam(0))
   {
      ClearActorFlags(GetSenderId(), 0x40000);
   }

   Return;

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

selected:
   jkPrintUNIString(player, 31);
   Return;

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

deselected:
   call stop_power;

   Return;

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

killed:
   if(GetSenderRef() != player) Return;

newplayer:
   call stop_power;

   Return;

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

stop_power:
   SetPulse(0);
   SetInvActivated(player, 31, 0);
   targetting = 0;
   victim = -1;
   active = 0;
   jkEndTarget();

   Return;

end


------------------
Generating Electro Vibes™ for the masses on Massassi
Go To: EL3CTROPROSE
or
DEEPMATRIX

[This message has been edited by Electro (edited April 10, 2001).]
Generating Electro Vibes™ for the masses on Massassi
Go To: BiTsToRm Forums or L3CY's Topsites
Boba Jules: You ever read the bible TK-421?
TK-421: No?
Boba Jules: Oh, ok...
*BLAM BLAM BLAM BLAM*
&lt;EL3CTRO&gt; EXCAUSE ME MISTAR CAERV BUT I LIEK MY PHORUMPHS!
2001-04-10, 10:52 AM #4
Instead of CreateThingatPos(ghost, GetThingSector(player), VectorAdd(GetThingPos(player),'0 0 .2', '0 0 0); use dummy = CreateThingatPos(ghost, GetThingSector(player), VectorAdd(GetThingPos(player),'0 0 .2', '0 0 0);
Then use CreateThing(ioncol, dummy);

------------------
Together we stand.
Divided we fall.
2001-04-10, 11:10 AM #5
ok, i have put that in, but the cog still doesnt work...

the code so far:
Code:
# Jedi Knight Cog Script
#
# FORCE_GRIP.COG
#
# FORCEPOWER Script - The Grip
#  Dark Side Power
#  Bin 31
#
# Edited by electro for the beginning of the Ion Cannon weapon.
#
# 

symbols

thing       player                           local
thing       victim                           local
thing       potential                        local

flex        cost=50.0                        local
flex        mana                             local
flex        dot                              local
flex        maxDot                           local
flex        damage                           local
flex        starthealth                      local
int         rank                             local
int         retval=0                         local

sound       gripSound=ForceGrip01.WAV        local

int         limit                            local
int         count                            local

int         active=0                         local
int         targetting=0                     local

template    ionblast=+conc_exp               local
template    ioncol=+concblast2

message     startup
message     activated
message     deactivated
message     pulse
message     timer
message     newplayer
message     killed
message     selected
message     deselected

end

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

code

startup:
   player = GetLocalPlayerThing();

   SetInvActivated(player, 31, 0);

   Return;

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

activated:
   // Cannot use power if blinded
   if(GetActorFlags(player) & 0x800) Return;

   if(active) Return;

   mana = GetInv(player, 14);
   if(mana >= cost)
   {
      victim = -1;
      active = 1;
      targetting = 1;
      SetPulse(0.33);
   }
   Return;

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

deactivated:
   // If no victim was found just cleanup and exit
   if((victim == -1) || (GetThingHealth(player) <= 0) || !active)
   {
      call stop_power;
      Return;
   }

   SetPulse(0);
   jkEndTarget();
   targetting = 0;

   mana = GetInv(player, 14);
   if(mana >= cost)
   {
      if(HasLOS(player, victim))             // check that we still have a LOS on it...
      {
         SetBinWait(player, 31, rank + 0.5);

         PlayMode(player, 24);
         if(GetInv(player, 64) != 1) ChangeInv(player, 14, -cost);
         rank = GetInv(player, 31);
         limit = rank * 2;
         starthealth = GetThingHealth(player);

         if(GetThingType(victim) == 10)
         {
            // Multiplayer enemies
            if(!(GetThingFlags(victim) & 0x200))
            {
               retval = SkillTarget(victim, player, 31, rank);
               SetPulse(0.1);
               count = 0;
               SetInvActivated(player, 31, 1);
            }
            else
            {
               Return;
            }
         }
         else
         {
            damage = SkillTarget(victim, player, 31, 0);

            if(damage > 0.0)
            {
               // Play choke animation on the victim.
               PlayMode(victim, 25);
               SetPulse(0.1);
               count = 0;
               SetInvActivated(player, 31, 1);
            }
         }
      }
   }

   Return;

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

pulse:
   if(targetting == 1)
   {
      // Check all things for our victim.
      victim = -1;
      maxDot = 0;

      // Search for all players and actors.
      potential = FirstThingInView(player, 70, 4, 0x404);
      while(potential != -1)
      {
         if(
            HasLOS(player, potential) &&
            (potential != player) &&
            (VectorDist(GetThingPos(player), GetThingPos(potential)) <= 1) &&
            !(GetThingFlags(potential) & 0x200) &&
            !(GetActorFlags(potential) & 0x100) &&
            !((jkGetFlags(potential) & 0x20) && !IsInvActivated(player, 23))
           )
         {
            if(!BitTest(GetActorFlags(potential), 0x100))
            {
               dot = ThingViewDot(player, potential);
               if(dot > maxDot)
               {
                  victim = potential;
                  maxDot = dot;
               }
            }
         }
         potential = NextThingInView();
      }

      // If we have a victim...
      if(victim != -1)
      {
         jkSetTargetColors(2, 7, 5);
         jkSetTarget(victim);
      }
      else
      {
         jkEndTarget();
      }
   }
   // this is the real Grip pulse
   else
   {
      if((count > limit) ||
         (GetThingHealth(player) < starthealth) ||
         (GetActorFlags(player) & 0x800) ||
         (GetThingFlags(victim) & 0x200)
        )
      {
         call stop_power;
         Return;
      }

      if(HasLOS(player, victim))
      {
         if(GetThingType(victim) == 10)      // OTHER PLAYER
         {
            // everything is done in the victim's KYLE.COG handler
            if(!(GetThingFlags(victim) & 0x200))
               retval = SkillTarget(victim, player, 31, rank);
         }
         else                                // ENEMY
         {
            DamageThing(victim, 50, 0x8, player);
            // Force the victim to stay in place
            SetActorFlags(victim, 0x40000);
            // But prepare to free it again in 0.45 seconds
            SetTimerEx(0.45, victim, GetThingSignature(victim), 0);
            AddDynamicTint(victim, 0, 0, 255);
            dummy = CreateThingatPos(ghost, GetThingSector(player), VectorAdd(GetThingPos(player),'0 0 .2', '0 0 0);
            CreateThing(ioncol, dummy);

}

         PlaySoundThing(gripSound, victim, 1.0, -1, -1, 0x80);
         count = count + 1;
         SetPulse(0.5);
      }
      else
      {
         // break the power if LOS is lost
         call stop_power;
      }
   }

   Return;

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

timer:
   // This checks that the thing ref is still assigned to the same thing
   if(GetThingSignature(GetSenderId()) == GetParam(0))
   {
      ClearActorFlags(GetSenderId(), 0x40000);
   }

   Return;

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

selected:
   jkPrintUNIString(player, 31);
   Return;

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

deselected:
   call stop_power;

   Return;

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

killed:
   if(GetSenderRef() != player) Return;

newplayer:
   call stop_power;

   Return;

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

stop_power:
   SetPulse(0);
   SetInvActivated(player, 31, 0);
   targetting = 0;
   victim = -1;
   active = 0;
   jkEndTarget();

   Return;

end


HELP!

------------------
Generating Electro Vibes™ for the masses on Massassi
Go To: EL3CTROPROSE
or
DEEPMATRIX

[This message has been edited by Electro (edited April 10, 2001).]
Generating Electro Vibes™ for the masses on Massassi
Go To: BiTsToRm Forums or L3CY's Topsites
Boba Jules: You ever read the bible TK-421?
TK-421: No?
Boba Jules: Oh, ok...
*BLAM BLAM BLAM BLAM*
&lt;EL3CTRO&gt; EXCAUSE ME MISTAR CAERV BUT I LIEK MY PHORUMPHS!
2001-04-10, 11:18 AM #6
try adding

thing dummy local

to the message section.

[edit: with appropriate spacing, of course.]

[This message has been edited by Hebedee (edited April 10, 2001).]
2001-04-10, 11:32 AM #7
Ok, it STILL DOEST WORK AND I ADDED TAHT!

Cog so far:
Code:
# Jedi Knight Cog Script
#
# FORCE_GRIP.COG
#
# FORCEPOWER Script - The Grip
#  Dark Side Power
#  Bin 31
#
# Edited by electro for the beginning of the Ion Cannon weapon.
#
# 

symbols

thing       player                           local
thing       victim                           local
thing       potential                        local
thing       dummy                            local

flex        cost=50.0                        local
flex        mana                             local
flex        dot                              local
flex        maxDot                           local
flex        damage                           local
flex        starthealth                      local
int         rank                             local
int         retval=0                         local

sound       gripSound=ForceGrip01.WAV        local

int         limit                            local
int         count                            local

int         active=0                         local
int         targetting=0                     local

template    ionblast=+conc_exp               local
template    ioncol=+concblast2

message     startup
message     activated
message     deactivated
message     pulse
message     timer
message     newplayer
message     killed
message     selected
message     deselected

end

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

code

startup:
   player = GetLocalPlayerThing();

   SetInvActivated(player, 31, 0);

   Return;

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

activated:
   // Cannot use power if blinded
   if(GetActorFlags(player) & 0x800) Return;

   if(active) Return;

   mana = GetInv(player, 14);
   if(mana >= cost)
   {
      victim = -1;
      active = 1;
      targetting = 1;
      SetPulse(0.33);
   }
   Return;

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

deactivated:
   // If no victim was found just cleanup and exit
   if((victim == -1) || (GetThingHealth(player) <= 0) || !active)
   {
      call stop_power;
      Return;
   }

   SetPulse(0);
   jkEndTarget();
   targetting = 0;

   mana = GetInv(player, 14);
   if(mana >= cost)
   {
      if(HasLOS(player, victim))             // check that we still have a LOS on it...
      {
         SetBinWait(player, 31, rank + 0.5);

         PlayMode(player, 24);
         if(GetInv(player, 64) != 1) ChangeInv(player, 14, -cost);
         rank = GetInv(player, 31);
         limit = rank * 2;
         starthealth = GetThingHealth(player);

         if(GetThingType(victim) == 10)
         {
            // Multiplayer enemies
            if(!(GetThingFlags(victim) & 0x200))
            {
               retval = SkillTarget(victim, player, 31, rank);
               SetPulse(0.1);
               count = 0;
               SetInvActivated(player, 31, 1);
            }
            else
            {
               Return;
            }
         }
         else
         {
            damage = SkillTarget(victim, player, 31, 0);

            if(damage > 0.0)
            {
               // Play choke animation on the victim.
               PlayMode(victim, 25);
               SetPulse(0.1);
               count = 0;
               SetInvActivated(player, 31, 1);
            }
         }
      }
   }

   Return;

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

pulse:
   if(targetting == 1)
   {
      // Check all things for our victim.
      victim = -1;
      maxDot = 0;

      // Search for all players and actors.
      potential = FirstThingInView(player, 70, 4, 0x404);
      while(potential != -1)
      {
         if(
            HasLOS(player, potential) &&
            (potential != player) &&
            (VectorDist(GetThingPos(player), GetThingPos(potential)) <= 1) &&
            !(GetThingFlags(potential) & 0x200) &&
            !(GetActorFlags(potential) & 0x100) &&
            !((jkGetFlags(potential) & 0x20) && !IsInvActivated(player, 23))
           )
         {
            if(!BitTest(GetActorFlags(potential), 0x100))
            {
               dot = ThingViewDot(player, potential);
               if(dot > maxDot)
               {
                  victim = potential;
                  maxDot = dot;
               }
            }
         }
         potential = NextThingInView();
      }

      // If we have a victim...
      if(victim != -1)
      {
         jkSetTargetColors(2, 7, 5);
         jkSetTarget(victim);
      }
      else
      {
         jkEndTarget();
      }
   }
   // this is the real Grip pulse
   else
   {
      if((count > limit) ||
         (GetThingHealth(player) < starthealth) ||
         (GetActorFlags(player) & 0x800) ||
         (GetThingFlags(victim) & 0x200)
        )
      {
         call stop_power;
         Return;
      }

      if(HasLOS(player, victim))
      {
         if(GetThingType(victim) == 10)      // OTHER PLAYER
         {
            // everything is done in the victim's KYLE.COG handler
            if(!(GetThingFlags(victim) & 0x200))
               retval = SkillTarget(victim, player, 31, rank);
         }
         else                                // ENEMY
         {
            DamageThing(victim, 50, 0x8, player);
            // Force the victim to stay in place
            SetActorFlags(victim, 0x40000);
            // But prepare to free it again in 0.45 seconds
            SetTimerEx(0.45, victim, GetThingSignature(victim), 0);
            AddDynamicTint(victim, 0, 0, 255);
            dummy = CreateThingatPos(ghost, GetThingSector(player), VectorAdd(GetThingPos(player),'0 0 .2', '0 0 0);
            CreateThing(ioncol, dummy);

}

         PlaySoundThing(gripSound, victim, 1.0, -1, -1, 0x80);
         count = count + 1;
         SetPulse(0.5);
      }
      else
      {
         // break the power if LOS is lost
         call stop_power;
      }
   }

   Return;

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

timer:
   // This checks that the thing ref is still assigned to the same thing
   if(GetThingSignature(GetSenderId()) == GetParam(0))
   {
      ClearActorFlags(GetSenderId(), 0x40000);
   }

   Return;

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

selected:
   jkPrintUNIString(player, 31);
   Return;

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

deselected:
   call stop_power;

   Return;

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

killed:
   if(GetSenderRef() != player) Return;

newplayer:
   call stop_power;

   Return;

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

stop_power:
   SetPulse(0);
   SetInvActivated(player, 31, 0);
   targetting = 0;
   victim = -1;
   active = 0;
   jkEndTarget();

   Return;

end


------------------
Generating Electro Vibes™ for the masses on Massassi
Go To: EL3CTROPROSE
or
DEEPMATRIX
Generating Electro Vibes™ for the masses on Massassi
Go To: BiTsToRm Forums or L3CY's Topsites
Boba Jules: You ever read the bible TK-421?
TK-421: No?
Boba Jules: Oh, ok...
*BLAM BLAM BLAM BLAM*
&lt;EL3CTRO&gt; EXCAUSE ME MISTAR CAERV BUT I LIEK MY PHORUMPHS!

↑ Up to the top!