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.

ForumsShowcase → Run for your lives!
Run for your lives!
2006-02-23, 1:11 PM #1
I edited the actor cog of our good friend gran-with-a-blaster and made him a little more 'observant' of what weapon the player is currently carrying. The detonator, concrifle and lightsaber instill fear, while other weapons not so much.

Feedback greatly needed. I intend to have them check their own weapon, health, and surrounding friends to make a better decision weather to flee or not.


EDIT: Improved version below.
Got a permanent feather in my cap;
Got a stretch to my stride;
a stroll to my step;
2006-02-23, 1:17 PM #2
Haven't read the code, but sounds cool.
APT 1, 2, 3/4, 5/6
TDT
DMDMD

http://veddertheshredder.com
2006-02-23, 1:38 PM #3
It's a good idea, but what fun is it if all your AI can do is run away? Why not improve its ability to fight?
Historians are the most powerful and dangerous members of any society. They must be watched carefully... They can spoil everything. - Nikita Khrushchev.
Kill one man, and you are a murderer. Kill millions of men, and you are a conqueror. Kill them all, and you are a god. - Jean Rostand.
2006-02-23, 1:47 PM #4
I never said this was all I'm adding. ;)

I'm going to be adding the ability to take cover, and hopefully working together as a team.
Got a permanent feather in my cap;
Got a stretch to my stride;
a stroll to my step;
2006-02-23, 2:18 PM #5
I don't think it was mentioned, but you can try this out just by putting the COG in your COG folder and playing the first level of SP.
Bassoon, n. A brazen instrument into which a fool blows out his brains.
2006-02-23, 2:35 PM #6
Oops, I meant to add that thanks! :o
Got a permanent feather in my cap;
Got a stretch to my stride;
a stroll to my step;
2006-02-23, 4:30 PM #7
I'm going to steal that code! ahahahahahah

awesome idea I think.
Code:
if(getThingFlags(source) & 0x8){
  do her}
elseif(getThingFlags(source) & 0x4){
  do other babe}
else{
  do a dude}
2006-02-23, 4:47 PM #8
I improved the code a lot, they now check their own health before deciding to flee. There is also a larger chance one will flee if some of his friends get hit or killed.

Code:
# Jedi Knight Cog Script
#
# ACTOR_RB.COG
#
# ACTOR Script - Ree Yees with Blaster
#
# 7/28/97 [CR] Doubled saber damage for single player gameplay reasons
#
# [CYW, YB & CR]
#
# (C) 1997 LucasArts Entertainment Co. All Rights Reserved


symbols

message     killed
message     damaged
message     sighted
message     skill

template    powerup=+DSTRifle                local
template    dummybrownRY=reeyeesGUN          local
template    limb=+RYlimb                     local
template    limbblack=+RHlimb                local
thing       newThing                         local
thing       victim                           local
int         bin                              local
int         health=-1                        local
flex        fear=-1                          local
int         playergun=-1                     local
int         senderref=-1                     local
ai          flee_ai=noweapon.ai              local
int         damage                           local

end

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

code

sighted:

player = GetSourceRef();
senderref = GetSenderRef();
damager = IsAITargetInSight(player);
DamageThing(senderref, 1, 0x40, damager);

return;

damaged:

senderref = GetSenderRef();
health=GetThingHealth(senderref); 
printInt(health);
playergun = GetCurWeapon(GetLocalPlayerThing());

if(playergun == 2)
   {
      if(health <= 40)
    {
      fear = rand();
      if(fear <= 0.15)
      {
      senderref = GetSenderRef();
      AISetClass(senderref, flee_ai);
      AIFlee(senderref, GetLocalPlayerThing());
      }
    }
   }

else if(playergun == 3)
   {
      if(health <= 40)
    {
      fear = rand();
      if(fear <= 0.15)
      {
      senderref = GetSenderRef();
      AISetClass(senderref, flee_ai);
      AIFlee(senderref, GetLocalPlayerThing());
      }
    }
   }


else if(playergun == 4)
   {
      if(health <= 60)
    {
      fear = rand();
      if(fear <= 0.15)
      {
      senderref = GetSenderRef();
      AISetClass(senderref, flee_ai);
      AIFlee(senderref, GetLocalPlayerThing());
      }
    }
   }


else if(playergun == 5)
   {
      if(health <= 40)
    {
      fear = rand();
      if(fear <= 0.15)
      {
      senderref = GetSenderRef();
      AISetClass(senderref, flee_ai);
      AIFlee(senderref, GetLocalPlayerThing());
      }
    }
   }


else if(playergun == 6)
   {
      if(health <= 40)
    {
      fear = rand();
      if(fear <= 0.15)
      {
      senderref = GetSenderRef();
      AISetClass(senderref, flee_ai);
      AIFlee(senderref, GetLocalPlayerThing());
      }
    }
   }


else if(playergun == 7)
   {
      if(health <= 60)
    {
      fear = rand();
      if(fear <= 0.40)
      {
      senderref = GetSenderRef();
      AISetClass(senderref, flee_ai);
      AIFlee(senderref, GetLocalPlayerThing());
      }
    }
   }


else if(playergun == 8)
   {
      if(health <= 60)
    {
      fear = rand();
      if(fear <= 0.20)
      {
      senderref = GetSenderRef();
      AISetClass(senderref, flee_ai);
      AIFlee(senderref, GetLocalPlayerThing());
      }
    }
   }


else if(playergun == 9)
   {
      if(health <= 60)
    {
      fear = rand();
      if(fear <= 0.50)
      {
      senderref = GetSenderRef();
      AISetClass(senderref, flee_ai);
      AIFlee(senderref, GetLocalPlayerThing());
      }
    }
   }


else if(playergun == 10)
   {
      if(health <= 60)
    {
      fear = rand();
      if(fear <= 0.50)
      {
      senderref = GetSenderRef();
      AISetClass(senderref, flee_ai);
      AIFlee(senderref, GetLocalPlayerThing());
      }
    }
   }

   damage = GetParam(0);
   if(GetParam(1) == 16)                     // saber damage might cause dismemberment
   {
      damage = (damage * 2.0);
      victim = GetSenderRef();
      if(GetThingHealth(victim) <= damage) // but only if damage is sufficient to kill
      {
         if(rand() > 0.15)                   // random chance
         {
            AmputateJoint(victim, 5);

            if(GetThingTemplate(victim) == dummybrownRY) // we have a brown ree yees
               newThing = CreateThingAtPos(limb, GetThingSector(victim), GetThingPos(victim), '0 0 0');
            else
               newThing = CreateThingAtPos(limbblack, GetThingSector(victim), GetThingPos(victim), '0 0 0');

            SetThingVel(newThing, '0.0 0.7 1.4');
         }
      }
   }

   ReturnEx(damage);
   return;

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

killed:
   victim = GetSenderRef();

   if(GetActorWeapon(victim, 1) != -1)
   {
      AmputateJoint(victim, 3);
      newThing = CreateThing(powerup, victim);
      SetLifeleft(newThing, 200.0);
   }

   return;

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

skill:
   bin = GetParam(0);
   if (bin == 24)                            // Force Pull
   {
      senderref = GetSenderRef();
      newThing = CreateThing(powerup, senderref);
      SetLifeleft(newThing, 30.0);
      ReturnEx(newThing);

      AISetClass(senderref, flee_ai);
      AIFlee(senderref, GetLocalPlayerThing());

      return;
   }
   else
   if (bin == 31)                            // Force Grip
   {
      ReturnEx(10);                          // return base damage that is taken by this actor.
      return;
   }
   else
   if (bin == 34)                            // Deadly Sight
   {
      ReturnEx(5);                           // return base damage that is taken by this actor.
      return;
   }

   ReturnEx(-1);
   return;

end
Got a permanent feather in my cap;
Got a stretch to my stride;
a stroll to my step;
2006-02-23, 5:27 PM #9
[quote=me here: [url]http://forums.massassi.net/vb3/showthread.php?t=39577#post633481]Wow[/url], how many different attempts to make JK prettier do we have now? We have Sith 2 for the engine, JKR for models, Zully is working on new textures and now we'll even get the levels rebuilt. Nice.[/quote]

Heh, so does that mean I can add AI to the list? :)
Sorry for the lousy German
2006-02-23, 5:38 PM #10
Hopefully. :)
Got a permanent feather in my cap;
Got a stretch to my stride;
a stroll to my step;
2006-02-23, 7:14 PM #11
Updated again, now they attempt to back off from the player when he has a lightsaber, conc, repeater, detonator, or the bowcaster.

Code:
# Jedi Knight Cog Script
#
# ACTOR_RB.COG
#
# ACTOR Script - Ree Yees with Blaster
#
# 7/28/97 [CR] Doubled saber damage for single player gameplay reasons
#
# [CYW, YB & CR]
#
# (C) 1997 LucasArts Entertainment Co. All Rights Reserved


symbols

message     pulse
message     killed
message     damaged
message     sighted
message     skill

template    powerup=+DSTRifle                local
template    dummybrownRY=reeyeesGUN          local
template    limb=+RYlimb                     local
template    limbblack=+RHlimb                local
thing       newThing                         local
thing       victim                           local
int         bin                              local
ai          flee_ai=noweapon.ai              local
int         damage                           local

end

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

code

sighted:

senderref = GetSenderRef();
SetThingPulse(senderref, 1.0);

return;

pulse:

player = GetSourceRef();
senderref = GetSenderRef();

playergun = GetCurWeapon(GetLocalPlayerThing());

if(playergun >= 5)
   {

if(vectorDist(GetThingPos(player), GetThingPos(senderref)) < 10)
{
   senderref = GetSenderRef();
   AISetMovePos(senderref, VectorAdd(VectorScale(GetThingLVec(senderref), -0.5), GetThingPos(senderref)));
}
}

senderref = GetSenderRef();
health=GetThingHealth(senderref); 
printInt(health);
playergun = GetCurWeapon(GetLocalPlayerThing());

if(playergun == 2)
   {
      if(health <= 40)
    {
      fear = rand();
      if(fear <= 0.02)
      {
      senderref = GetSenderRef();
      AISetClass(senderref, flee_ai);
      AIFlee(senderref, GetLocalPlayerThing());
      }
    }
   }

else if(playergun == 3)
   {
      if(health <= 40)
    {
      fear = rand();
      if(fear <= 0.02)
      {
      senderref = GetSenderRef();
      AISetClass(senderref, flee_ai);
      AIFlee(senderref, GetLocalPlayerThing());
      }
    }
   }


else if(playergun == 4)
   {
      if(health <= 60)
    {
      fear = rand();
      if(fear <= 0.03)
      {
      senderref = GetSenderRef();
      AISetClass(senderref, flee_ai);
      AIFlee(senderref, GetLocalPlayerThing());
      }
    }

   }


else if(playergun == 5)
   {
      if(health <= 60)
    {
      fear = rand();
      if(fear <= 0.03)
      {
      senderref = GetSenderRef();
      AISetClass(senderref, flee_ai);
      AIFlee(senderref, GetLocalPlayerThing());
      }
    }
   }


else if(playergun == 6)
   {
      if(health <= 40)
    {
      fear = rand();
      if(fear <= 0.03)
      {
      senderref = GetSenderRef();
      AISetClass(senderref, flee_ai);
      AIFlee(senderref, GetLocalPlayerThing());
      }
    }
   }


else if(playergun == 7)
   {
      if(health <= 60)
    {
      fear = rand();
      if(fear <= 0.15)
      {
      senderref = GetSenderRef();
      AISetClass(senderref, flee_ai);
      AIFlee(senderref, GetLocalPlayerThing());
      }
    }
   }


else if(playergun == 8)
   {
      if(health <= 60)
    {
      fear = rand();
      if(fear <= 0.05)
      {
      senderref = GetSenderRef();
      AISetClass(senderref, flee_ai);
      AIFlee(senderref, GetLocalPlayerThing());
      }
    }
   }


else if(playergun == 9)
   {
      if(health <= 60)
    {
      fear = rand();
      if(fear <= 0.15)
      {
      senderref = GetSenderRef();
      AISetClass(senderref, flee_ai);
      AIFlee(senderref, GetLocalPlayerThing());
      }
    }
   }


else if(playergun == 10)
   {
      if(health <= 60)
    {
      fear = rand();
      if(fear <= 0.15)
      {
      senderref = GetSenderRef();
      AISetClass(senderref, flee_ai);
      AIFlee(senderref, GetLocalPlayerThing());
      }
    }
   }

return;

damaged:

   damage = GetParam(0);
   if(GetParam(1) == 16)                     // saber damage might cause dismemberment
   {
      damage = (damage * 2.0);
      victim = GetSenderRef();
      if(GetThingHealth(victim) <= damage) // but only if damage is sufficient to kill
      {
         if(rand() > 0.25)                   // random chance
         {
            AmputateJoint(victim, 5);

            if(GetThingTemplate(victim) == dummybrownRY) // we have a brown ree yees
               newThing = CreateThingAtPos(limb, GetThingSector(victim), GetThingPos(victim), '0 0 0');
            else
               newThing = CreateThingAtPos(limbblack, GetThingSector(victim), GetThingPos(victim), '0 0 0');

            SetThingVel(newThing, '0.0 0.7 1.4');
         }
      }
   }

   ReturnEx(damage);
   return;

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

killed:
   victim = GetSenderRef();

   if(GetActorWeapon(victim, 1) != -1)
   {
      AmputateJoint(victim, 3);
      newThing = CreateThing(powerup, victim);
      SetLifeleft(newThing, 200.0);
   }

   return;

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

skill:
   bin = GetParam(0);
   if (bin == 24)                            // Force Pull
   {
      senderref = GetSenderRef();
      newThing = CreateThing(powerup, senderref);
      SetLifeleft(newThing, 30.0);
      ReturnEx(newThing);

      AISetClass(senderref, flee_ai);
      AIFlee(senderref, GetLocalPlayerThing());

      return;
   }
   else
   if (bin == 31)                            // Force Grip
   {
      ReturnEx(10);                          // return base damage that is taken by this actor.
      return;
   }
   else
   if (bin == 34)                            // Deadly Sight
   {
      ReturnEx(5);                           // return base damage that is taken by this actor.
      return;
   }

   ReturnEx(-1);
   return;

end
Got a permanent feather in my cap;
Got a stretch to my stride;
a stroll to my step;

↑ Up to the top!