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 → Would somebody modify this?
Would somebody modify this?
2001-06-23, 4:01 PM #1
I appretiate it if somebody could modify this so there is a 5 second pause in between shots of this cog. What I mean is just to put a verb in there so people can't keep tapping the button. They can do it once. And then have to wait 5 seconds to do it again. THANKS!

Code:
# Jedi Knight Cog Script
#
# FORCE_BLINDING.COG
#
# FORCEPOWER Script - A powerful force push.
# Bin 31 or 27
# 
# (C) 2001 LordXT_IJ
# LucasArts Entertainment Company doesn't support this in any way.

symbols

thing       player                           local
thing       victim                           local
thing       potential                        local

flex        mana                             local
flex        cost=50.0                        local
flex        delay=400.0                      local
int         rank                             local
int         count                            local
int         retval=0                         local
int         dummy                            local

flex        dot                              local
flex        maxDot                           local

sound       blindingSound=forcethrow01.wav   local
template    cone_tpl=+force_blind            local

int         active=0                         local

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

# ........................................................................................
# External animations

keyframe push=kyfpull0.key        local

end

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

code

startup:
   player = GetlocalPlayerThing();

   Return;

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

activated:
   if(active) Return;

   mana = GetInv(player, 14);
   rank = GetInv(player, 24);

   if(mana >= cost)
   {
      victim = -1;
      active = 1;
      SetInvActivated(player, 27, 1);
      SetPulse(0.33);
   }

   Return;

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

pulse:
   // Check all things for our victim.
   victim = -1;
   maxDot = 0;

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

   // If we have a victim...
   if(victim != -1)
   {
      jkSetTargetColors(1, 2, 3);
      jkSetTarget(victim);
   }
   else
   {
      jkEndTarget();
   }

   Return;

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

deactivated:
   if((victim == -1) || (GetThingHealth(player) <= 0))
   {

      call stop_power;
      Return;
   }

   SetPulse(0);
   jkEndTarget();

   mana = GetInv(player, 14);
   if(mana >= cost)
   {
      if(GetInv(player, 65) != 1) ChangeInv(player, 14, -cost);
      SetBinWait(player, 27, 0.2);
      rank = GetInv(player, 27);

      SetTimer(delay);
      if(HasLOS(player, victim) && (victim != player))
      {
         PlayMode(player, 24);
         PlayKey(player, push, 1, 0x38);
         PlaySoundThing(blindingSound, player, 1.0, -1, -1, 0x80);
         SendTrigger(-1, 270, player, randVec, 0, 0);
            DetachThing(victim);
            ApplyForce(victim, VectorScale(VectorNorm(VectorSub(GetThingPos(victim),GetThingPos(player))), 150 * rank));
         }
   }

   active = 0;
   SetInvActivated(player, 27, 0);

   Return;

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

timer:
   // This checks that the thing ref is still assigned to the same thing
   // (remember he could have died and its refrence reassigned to a generated thing)

   Return;

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

selected:
   jkPrintUNIString(player, 27);
   Return;

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

deselected:
   call stop_power;

   Return;

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

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

newplayer:
   call stop_power;

   Return;

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

stop_power:
   SetPulse(0);
   SetInvActivated(player, 27, 0);
   active = 0;
   jkEndTarget();

   Return;

end
Ohh Crap! - Darien Fawkes (The Invisible Man)
2001-06-24, 6:25 AM #2
I'm not gonna modify it because it'd take five minutes just to put it into something legible..the copy/paste looks messed up.

However, to accomplish this, remove the "active=0;" and the "SetInvActivated(player, 27, 0);" from the end of the deactivated: section. Add "call
stop_power;" to the timer: section (before Return; obviously [http://forums.massassi.net/html/tongue.gif]).

Next, where the "active=0" was in deactivated:, put in: "SetTimer(5.0);"

This should do what you want.
2001-07-02, 9:34 AM #3
Would somebody actually modify this for me because that didn't work and I have tried everything i can think of and it aint working. I need it very soon.
Ohh Crap! - Darien Fawkes (The Invisible Man)
2001-07-02, 1:38 PM #4
Here you go ...

Code:
                              # FORCE_BLINDING.COG
                              #
                              # FORCEPOWER Script - A powerful force push.
                              # Bin 31 or 27
                              # 
                              # (C) 2001 LordXT_IJ
                              # LucasArts Entertainment Company doesn't support this in any way.
                              symbols

                              thing       player                           local
                              thing       victim                           local
                              thing       potential                        local
                              flex        mana                             local
                              flex        cost=50.0                        local
                              flex        delay=400.0                      local
                              int         rank                             local
                              int         count                            local
                              int         retval=0                         local
                              int         dummy                            local
                              flex        dot                              local
                              flex        maxDot                           local
                              sound       blindingSound=forcethrow01.wav   local
                              template    cone_tpl=+force_blind            local
                              int         active=0                         local
				  int		done=0					local
                              message     startup
                              message     activated
                              message     deactivated
                              message     pulse
                              message     timer
                              message     newplayer
                              message     killed
                              message     deselected
                              message     selected
                              # ........................................................................................
                              # External animations
                              keyframe push=kyfpull0.key        local
                              end
                              # ========================================================================================
                              code
                              startup:
                                 player = GetlocalPlayerThing();
                                 Return;
                              # ........................................................................................
                              activated:
                                 if(active) Return;
                                 mana = GetInv(player, 14);
                                 rank = GetInv(player, 24);
                                 if(mana >= cost && done == 0)
                                 {
                                    victim = -1;
                                    active = 1;
                                    SetInvActivated(player, 27, 1);
                                    SetPulse(0.33);
                                 }
                                 Return;
                              # ........................................................................................
                              pulse:
                                 // Check all things for our victim.
                                 victim = -1;
                                 maxDot = 0;
                                 // Search for all players and actors.
                                 potential = FirstThingInView(player, 30 + 15 * rank, 8, 0x404);
                                 while(potential != -1)
                                 {
                                    if(
                                       HasLOS(player, potential) &&
                                       (potential != player) &&
                                       (VectorDist(GetThingPos(player), GetThingPos(potential)) <= (1 + rank)) &&
                                       !(GetThingFlags(potential) & 0x200) &&
                                       !(GetActorFlags(potential) & 0x100) &&
                                       !((jkGetFlags(potential) & 0x20) && !IsInvActivated(player, 23))
                                      )
                                    {
                                       dot = ThingViewDot(player, potential);
                                       if(dot > maxDot)
                                       {
                                          victim = potential;
                                          maxDot = dot;
                                       }
                                    }
                                    potential = NextThingInView();
                                 }
                                 // If we have a victim...
                                 if(victim != -1)
                                 {
                                    jkSetTargetColors(1, 2, 3);
                                    jkSetTarget(victim);
                                 }
                                 else
                                 {
                                    jkEndTarget();
                                 }
                                 Return;
                              # ........................................................................................
                              deactivated:
                                 if((victim == -1) || (GetThingHealth(player) <= 0))
                                 {
                                    call stop_power;
                                    Return;
                                 }
                                 SetPulse(0);
                                 jkEndTarget();
                                 mana = GetInv(player, 14);
                                 if(mana >= cost)
                                 {
                                    if(GetInv(player, 65) != 1) ChangeInv(player, 14, -cost);
                                    SetBinWait(player, 27, 0.2);
                                    rank = GetInv(player, 27);
                                    SetTimer(delay);
                                    if(HasLOS(player, victim) && (victim != player))
                                    {
                                       PlayMode(player, 24);
                                       PlayKey(player, push, 1, 0x38);
                                       PlaySoundThing(blindingSound, player, 1.0, -1, -1, 0x80);
                                       SendTrigger(-1, 270, player, randVec, 0, 0);
                                          DetachThing(victim);
                                          ApplyForce(victim, VectorScale(VectorNorm(VectorSub(GetThingPos(victim),GetThingPos(player))), 150 * rank));
						done=1;
						SetTimerEx(5, 1337, -1, -1);
                                       }
                                 }
                                 active = 0;
                                 SetInvActivated(player, 27, 0);
                                 Return;
                              # ........................................................................................
                              timer:
             
     if (GetSenderId() == 1337)
   {
	done=0;
   } 

                                 Return;
                              # ........................................................................................
                              selected:
                                 jkPrintUNIString(player, 27);
                                 Return;
                              # ........................................................................................
                              deselected:
                                 call stop_power;
                                 Return;
                              # ........................................................................................
                              killed:
                                 if(GetSenderRef() != player) Return;
                              newplayer:
                                 call stop_power;
                                 Return;
                              # ........................................................................................
                              stop_power:
                                 SetPulse(0);
                                 SetInvActivated(player, 27, 0);
                                 active = 0;
                                 jkEndTarget();
                                 Return;
                              end



[This message has been edited by *_Seifer_* (edited July 02, 2001).]
2001-07-02, 1:52 PM #5
Sorry for my ignorance. Thanks again Seifer! [http://forums.massassi.net/html/smile.gif]
Ohh Crap! - Darien Fawkes (The Invisible Man)
2001-07-03, 12:37 AM #6
Ignorance ???, No Problem, Glad to Help [http://forums.massassi.net/html/biggrin.gif]
2001-07-12, 11:23 AM #7
Seifer your cog did exactly what mine did. It doesnt make it so you can fire once every five seconds. It makes it so can't target a different person in five seconds. Do you know what I mean?
Ohh Crap! - Darien Fawkes (The Invisible Man)
2001-07-12, 12:43 PM #8
! Arg let me fix it.
2001-07-12, 12:46 PM #9
Here ...

Code:
# FORCE_BLINDING.COG
                                                #
                                                # FORCEPOWER Script - A powerful force push.
                                                # Bin 31 or 27
                                                # 
                                                # (C) 2001 LordXT_IJ
                                                # LucasArts Entertainment Company doesn't support this in any way.
                                                symbols
                                                thing       player                           local
                                                thing       victim                           local
                                                thing       potential                        local
                                                flex        mana                             local
                                                flex        cost=50.0                        local
                                                flex        delay=400.0                      local
                                                int         rank                             local
                                                int         count                            local
                                                int         retval=0                         local
                                                int         dummy                            local
                                                flex        dot                              local
                                                flex        maxDot                           local
                                                sound       blindingSound=forcethrow01.wav   local
                                                template    cone_tpl=+force_blind            local
                                                int         active=0                         local
                                                    int           done=0                                  local
                                                message     startup
                                                message     activated
                                                message     deactivated
                                                message     pulse
                                                message     timer
                                                message     newplayer
                                                message     killed
                                                message     deselected
                                                message     selected
                                                # ........................................................................................
                                                # External animations
                                                keyframe push=kyfpull0.key        local
                                                end
                                                # ========================================================================================
                                                code
                                                startup:
                                                   player = GetlocalPlayerThing();
                                                   Return;
                                                # ........................................................................................
                                                activated:
                                                   if(active) Return;
                                                   mana = GetInv(player, 14);
                                                   rank = GetInv(player, 24);
                                                   if(mana >= cost)
                                                   {
                                                      victim = -1;
                                                      active = 1;
                                                      SetInvActivated(player, 27, 1);
                                                      SetPulse(0.33);
                                                   }
                                                   Return;
                                                # ........................................................................................
                                                pulse:
                                                   // Check all things for our victim.
                                                   victim = -1;
                                                   maxDot = 0;
                                                   // Search for all players and actors.
                                                   potential = FirstThingInView(player, 30 + 15 * rank, 8, 0x404);
                                                   while(potential != -1)
                                                   {
                                                      if(
                                                         HasLOS(player, potential) &&
                                                         (potential != player) &&
                                                         (VectorDist(GetThingPos(player), GetThingPos(potential)) <= (1 + rank)) &&
                                                         !(GetThingFlags(potential) & 0x200) &&
                                                         !(GetActorFlags(potential) & 0x100) &&
                                                         !((jkGetFlags(potential) & 0x20) && !IsInvActivated(player, 23))
                                                        )
                                                      {
                                                         dot = ThingViewDot(player, potential);
                                                         if(dot > maxDot)
                                                         {
                                                            victim = potential;
                                                            maxDot = dot;
                                                         }
                                                      }
                                                      potential = NextThingInView();
                                                   }
                                                   // If we have a victim...
                                                   if(victim != -1)
                                                   {
                                                      jkSetTargetColors(1, 2, 3);
                                                      jkSetTarget(victim);
                                                   }
                                                   else
                                                   {
                                                      jkEndTarget();
                                                   }
                                                   Return;
                                                # ........................................................................................
                                                deactivated:
                                                   if((victim == -1) || (GetThingHealth(player) <= 0))
                                                   {
                                                      call stop_power;
                                                      Return;
                                                   }
                                                   SetPulse(0);
                                                   jkEndTarget();
                                                   mana = GetInv(player, 14);
                                                   if(mana >= cost)
                                                   {
                                                      if(GetInv(player, 65) != 1) ChangeInv(player, 14, -cost);
                                                      SetBinWait(player, 27, 0.2);
                                                      rank = GetInv(player, 27);
                                                      SetTimer(delay);
                                                      if(HasLOS(player, victim) && (victim != player) && done == 0)
                                                      {
                                                         PlayMode(player, 24);
                                                         PlayKey(player, push, 1, 0x38);
                                                         PlaySoundThing(blindingSound, player, 1.0, -1, -1, 0x80);
                                                         SendTrigger(-1, 270, player, randVec, 0, 0);
                                                            DetachThing(victim);
                                                            ApplyForce(victim, VectorScale(VectorNorm(VectorSub(GetThingPos(victim),GetThingPos(player))), 150 * rank));
                                                                  done=1;
                                                                  SetTimerEx(5, 1337, -1, -1);
                                                         }
                                                   }
                                                   active = 0;
                                                   SetInvActivated(player, 27, 0);
                                                   Return;
                                                # ........................................................................................
                                                timer:
                               
                       if (GetSenderId() == 1337)
                     {
                          done=0;
                     } 
                                                   Return;
                                                # ........................................................................................
                                                selected:
                                                   jkPrintUNIString(player, 27);
                                                   Return;
                                                # ........................................................................................
                                                deselected:
                                                   call stop_power;
                                                   Return;
                                                # ........................................................................................
                                                killed:
                                                   if(GetSenderRef() != player) Return;
                                                newplayer:
                                                   call stop_power;
                                                   Return;
                                                # ........................................................................................
                                                stop_power:
                                                   SetPulse(0);
                                                   SetInvActivated(player, 27, 0);
                                                   active = 0;
                                                   jkEndTarget();
                                                   Return;
                                                end

↑ Up to the top!