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 → civflee cog mystery
civflee cog mystery
2004-09-24, 4:49 AM #1
Hi, I've been trying to add a damaged message to the civflee cog that Grismath showed to me once, and the wierdest thing keeps happening. With my extra code, when the player damages the civs, they attack the player (I had noticed that previously you could punch them to death without them getting upset) - however, a blackreeyees also is created at the civs position every time damage is called! Why? :confused: As far as I can see, I haven't got any other cog in the level that ever asks CreateThing(reeyees);.

Here is what I had done to ruin Grismath's cog:

Code:
# Jedi Knight Cog Script
# CivFlee.cog
# This cog gives civilians an aversion to armed gunmen roaming amongst them.
# [Grismath]
# 
# (I added the damaged message so you can't go around punching people in the face with no comeback)
# (Thanks for the cog, Grismath - my level depends on it! - rob_whatman)
# This COG is not supported by Lucasarts
#

symbols
message startup
message pulse
message timer
message damaged
thing player local
thing civ0
thing civ1
thing civ2
thing civ3
thing civ4
thing civ5
thing civ6
thing civ7
ai regular
ai flee
flex fTime // Length of fleeing period
int X=0 local
int Y=0 local

sound		bangbang
template	pow
end
#======================================================================================#
code
#--------------------------------------------------------
startup:
Sleep(0.5);
for(X=0;X<8;X=X+1) AISetClass(civ0[X], regular);
for(X=0;X<8;X=X+1) CaptureThing(civ0[X]);
player=GetLocalPlayerThing();
SetPulse(1);
return;
#--------------------------------------------------------
pulse:
for(X=0;X<8;X=X+1) {
if(HasLOS(civ0[X], player)) {
if(GetCurWeapon(player) != 1) {
AISetClass(civ0[X], flee);
SetTimerEx(fTime, 1337, X, 0);
}}}
return;
#--------------------------------------------------------
timer:
if(GetSenderID()==1337) {
Y=GetParam(1);
AISetClass(civ0[Y], regular);
}
return;
#--------------------------------------------------------
# I added the damaged message, and the troopers get angry OK - but also a reeyees is created at the ThingPos!
# WHY?!!!!!!

damaged:
		creature = GetSenderRef();
		player = GetLocalPlayerThing();
		actor = GetThingParent(GetSourceRef());
		if(actor == player)
		{
		if(HasLOS(creature, player))
			{
			SetPulse(0);
			AISetFireTarget(creature, player);
			FireProjectile(creature, bangbang, pow, -1, 0, 0, 1, 0, 120, 10); 
			AISetMode(creature, 0x2);  
			AISetClass(creature, flee);
			Print("I'll teach you to mess with me!");
			SetPulse(1);
			return;
			}
		}
return;
#-----------------------------------------------------------
end
2004-09-25, 5:00 AM #2
The FireProjectile verb is another create thing action, so I looked there first. Here is what I discovered:

Quoted from DataMaster:
Quote:
projectile=FireProjectile(fire_thing, template, sound, submode, offset_vec, error_vec, extra_flex, proj_flags, AA_FOVX, AA_FOVZ);
It looks like the FireProjectile verb in your code is incorrect; that is bangbang and pow should be swapped.

Also, bangbang and pow are not defined, so they are probably set to zero.

:)
2004-09-25, 11:45 AM #3
Thanks, ZeqMacaw, that sorted it out! :cool:
2004-09-25, 3:46 PM #4
Holy CoW! I do remember this cog! When did I show this to you? When did I make it?! Augh!
Cordially,
Lord Tiberius Grismath
1473 for '1337' posts.
2004-09-25, 7:11 PM #5
Bizarre things can happen.

One time when I tried to make remote mines, I didn't define a variable (or fired it wrong, or whatever went wrong) and it created un-pickupable power cell powerups at my position 0_o

When I tried making a hotkey that switched your weapon mesh from one saber-replacement to another, one undefined var or something caused my weapon to become a catwalk 3do :\

Wacky.
May the mass times acceleration be with you.
2004-09-27, 12:15 AM #6
It was maybe two years ago, Grismath, I think. Is it still OK to use it, with your permission? I've finally started to build up my level idea into something I might release, if I have enough time.
2004-09-27, 6:00 AM #7
Sure you can use it, but who are you, and how did you get it?!
Cordially,
Lord Tiberius Grismath
1473 for '1337' posts.
2004-09-27, 12:08 PM #8
I asked a question once, and you wrote it out, on this forum. Sorry to cause offense, I was simply trying to credit you fairly.
2004-09-28, 3:06 PM #9
No offence caused, I'm rather impressed.
Cordially,
Lord Tiberius Grismath
1473 for '1337' posts.

↑ Up to the top!