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 → Don't shoot the civvies!
Don't shoot the civvies!
2001-11-11, 8:44 AM #1
I'm trying to create a COG where, upon shooting an armed ped, it switches from ai1 (pedroam.ai) to ai2 (something like stdefault.ai). However, whenever I shoot the actor, all he does is die.

# Jedi Knight Cog Script
#
# 00_setactor.COG
#
# When roaming, the enemy is pedroam.ai. When shot, it turns into ai2.
#
#
# This Cog is Not supported by LucasArts Entertainment Co

symbols

message startup
message damaged
ai ai1=pedroam.ai
ai ai2
thing actor1


end

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

code

startup:
AiSetClass(actor1, ai1);
return;

damaged:
AiSetClass(actor1, ai2);
SetActorFlags(actor1, 0x8);
return;

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

end

------------------
This blank space intentionally left.

[This message has been edited by Wolfy (edited November 11, 2001).]
the idiot is the person who follows the idiot and your not following me your insulting me your following the path of a idiot so that makes you the idiot - LC Tusken
2001-11-11, 9:59 AM #2
Ok, 2 things to try. First, try increasing the amount of health the ped actually has. It could be that you kill the ped before it has a chance to fight back. Second try adding 'mask=0xfff' to 'thing actor1' in the symbols section.

Raynar


------------------
... the Jedi I admire the most, met up with Darth Maul, now he's toast ...
Rbots - a project to develop a working Bot for Jedi Knight... download the latest development version here
Pagewizard_YKS: "making your own lightsaber doesn't make you a nerd... "
Raynar - the man with a 10.75" ePenis
2001-11-11, 9:59 AM #3
Mmmm. An invulneral ped that shoots back. Mmm.

Perhaps if you used a weapon that wouldnt kill on the first shot. Like the fists?


------------------
Success is the inverse relationship between effort, gain, and loss.

[This message has been edited by GBK (edited November 11, 2001).]
And when the moment is right, I'm gonna fly a kite.
2001-11-11, 10:10 AM #4
GBK - problem is, the player starts off with a stormtroop rifle.

Raynar - it's not that they don't have enough health - I shoot them, and they run away. It's like the COG doesn't even recognize the damaged: message.

------------------
This blank space intentionally left.
the idiot is the person who follows the idiot and your not following me your insulting me your following the path of a idiot so that makes you the idiot - LC Tusken
2001-11-11, 12:15 PM #5
Hmm, you forgot to use 'Capturething()'.

------------------
Success is the inverse relationship between effort, gain, and loss.
And when the moment is right, I'm gonna fly a kite.
2001-11-11, 12:23 PM #6
ai ai1=pedroam.ai
ai ai2

You havent defined ai2
I think you need to do something like:

ai ai2=2nd.ai

Or did you leave it out intentionally?
- Wisdom is 99% experience, 1% knowledge. -
2001-11-11, 1:40 PM #7
The mask=0xfff did the trick.

Yes, I did purposely omit ai2's definition, and I have no idea what CaptureThing() would do in this COG.

------------------
This blank space intentionally left.
the idiot is the person who follows the idiot and your not following me your insulting me your following the path of a idiot so that makes you the idiot - LC Tusken
2001-11-11, 3:46 PM #8
Is this a level cog, or an actor cog?

------------------
Success is the inverse relationship between effort, gain, and loss.
And when the moment is right, I'm gonna fly a kite.
2001-11-11, 11:41 PM #9
Quote:
<font face="Verdana, Arial" size="2">Is this a level cog, or an actor cog?</font>


I think he assigns this actor cog through level editor.

Wolfy - CaptureThing captures the thing event, so it will start receiving "damaged", "killed" etc personal messages. I think it is same as mask=0xfff if I'm not wrong. It can do it on certain things within cog operations.

------------------
http://millennium.massassi.net/ - Millennium
2001-11-12, 2:14 PM #10
Alrighty then. Is it possible to apply the damamged: message to a template. Say, so if a pedestrian template gets shot in the level, actors in the level will change to hostile AI, like police responding to a hostile action?

------------------
This blank space intentionally left.
the idiot is the person who follows the idiot and your not following me your insulting me your following the path of a idiot so that makes you the idiot - LC Tusken
2001-11-12, 2:19 PM #11
Yeah, just as in darkjedi cogs, it uses CaptureThing(darkjedi) (if I'm not mistaken being sleepy after doing homework without a sleep...) at startup. Although it also has mask=0xfff (something like that) in the symbols. It may be that you need both. Sorry but not too certain.

------------------
http://millennium.massassi.net/ - Millennium
2001-11-12, 3:35 PM #12
Quote:
<font face="Verdana, Arial" size="2">Originally posted by Wolfy:
...Say, so if a pedestrian template gets shot in the level, actors in the level will change to hostile AI...
</font>



If you want to do it the easy way...


 

Startup:
For(I=0;I<=Getthingcount();I=I+1) {
Capturething(I); }
Stop;

Damaged:
If(Getthingtemplate(Getsenderref()) == Pedtype) {
AIsetclass(Policeman, Killer_AI); }
Stop;

 


Essentially, that will run through all the things in a level, and "capture" all those that have the 'Pedestrian' template. Then, when one of those peds is damaged, it changes the AI of the 'Policeman'.

The good thing about this is, you dont have to predefine all of the peds, its done on startup.. [http://forums.massassi.net/html/biggrin.gif]

------------------
Success is the inverse relationship between effort, gain, and loss.
And when the moment is right, I'm gonna fly a kite.
2001-11-12, 5:27 PM #13
It has been a little quesionable to me that if every "thing" in the level can be obtained by simply going through the thing ID from 0 to the number of things in the level. Also I add a little optimization to that.
Code:
startup:


   for(x=0; x<GetSectorCount(); x=x+1)
   {
      y = FirstThingInSector(x);
      while(y != -1)
      {
          if(GetThingTemplate(y) == ped_tpl) CaptureThing(y);


          y = NextThingInSector(y);
      }
   }


   return;


damaged:


    print("Hostile mode!");


    return;


------------------
http://millennium.massassi.net/ - Millennium

[This message has been edited by Hideki (edited November 12, 2001).]
2001-11-12, 5:35 PM #14
Quote:
<font face="Verdana, Arial" size="2">Originally posted by Hideki:
It has been a little quesionable to me that if every "thing" in the level can be obtained by simply going through the thing ID from 0 to the number of things in the level. Also I add a little optimization to that.
</font>


You can obtain every "thing" in a level just by going through the thing ID's from 0 to number of things in the level. Things in levels are given IDs sequentially, and anytime a thing is destroyed, the things with ID #'s higher are all moved down. But I still use the FirstThingInSector()/NextThingInSector() myself.
2001-11-12, 5:37 PM #15
Quote:
<font face="Verdana, Arial" size="2">Originally posted by Hideki:
It has been a little quesionable to me that if every "thing" in the level can be obtained by simply going through the thing ID from 0 to the number of things in the level.
</font>


It does work, and I use it quite frequently. [http://forums.massassi.net/html/biggrin.gif]

------------------
Success is the inverse relationship between effort, gain, and loss.
And when the moment is right, I'm gonna fly a kite.

↑ Up to the top!