I am trying to make a cog that sets certain actors to neutral or friendly alignment at startup, then checks whether the player has selected any weapon other than fists, and if so, alerts the actors to revert to enemies. I thought that I had found a similar cog by David McHale in his Sigma 51A level and tried modifying it, but no luck. I have no idea what the AI Mode 0x2000 flag does (I was assuming it changed AI Alignment).
So, what should I change?/Should I try a totally different way?
So, what should I change?/Should I try a totally different way?
Code:
# MotS COG
# Using the code of alerted.COG by David McHale in 'Escape from Sigma 51A'
#
# This COG should let the player wander past selected enemies unmolested, unless
# the player has selected one of several forbidden weapons. It will also change the actors to enemies when a certain thing is touched, e.g. a door to a forbidden area.
#
# This COG is not supported by Lucasarts
#
symbols
message startup
message entered
message damaged
sector EnterSector
thing enemy1
thing enemy2
thing enemy3
thing enemy4
thing enemy5
thing enemy6
thing enemy7
thing enemy8
thing lockeddoor linkid=1
int attacked=0
int hl1
int hl2
int hl3
int hl4
int hl5
int hl6
int hl7
int hl8
int start=0
end
code
startup:
h11 = GetThingHealth(enemy1); // Don't know meaning of this
h12 = GetThingHealth(enemy2);
h13 = GetThingHealth(enemy3);
h14 = GetThingHealth(enemy4);
h15 = GetThingHealth(enemy5);
h16 = GetThingHealth(enemy6);
h17 = GetThingHealth(enemy7);
h18 = GetThingHealth(enemy8);
AISetMode(enemy1, 0x2000);
AISetMode(enemy2, 0x2000);
AISetMode(enemy3, 0x2000);
AISetMode(enemy4, 0x2000);
AISetMode(enemy5, 0x2000);
AISetMode(enemy6, 0x2000);
AISetMode(enemy7, 0x2000);
AISetMode(enemy8, 0x2000);
player = GetLocalPlayerThing();
return;
// This code is supposed to check if the player has activated a weapon other than fists when they enter a sector
entered:
if (GetCurWeapon(player) !=1)
{
AIClearMode(enemy1, 0x2000);
AIClearMode(enemy2, 0x2000);
AIClearMode(enemy3, 0x2000);
AIClearMode(enemy4, 0x2000);
AIClearMode(enemy5, 0x2000);
AIClearMode(enemy6, 0x2000);
AIClearMode(enemy7, 0x2000);
AIClearMode(enemy8, 0x2000);
}
if (GetSenderId() == 1)
{
AIClearMode(enemy1, 0x2000);
AIClearMode(enemy2, 0x2000);
AIClearMode(enemy3, 0x2000);
AIClearMode(enemy4, 0x2000);
AIClearMode(enemy5, 0x2000);
AIClearMode(enemy6, 0x2000);
AIClearMode(enemy7, 0x2000);
AIClearMode(enemy8, 0x2000);
}
Return;
end

![http://forums.massassi.net/html/smile.gif [http://forums.massassi.net/html/smile.gif]](http://forums.massassi.net/html/smile.gif)