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 → damaged symbol
damaged symbol
2004-01-14, 1:38 PM #1
when using the symbol "damaged" in a COG on a surface, for some reason it only reacts when i hit the surface with the light saber, and even then i have to hit the surface a few times before it does anything. here's the cog if you want to take a look. any suggestions as to what the problem is?

# Jedi Knight Cog Script

symbols


surface cond1 linkid=4
surface cond2 linkid=5
surface switch1 linkid=1
surface switch2 linkid=2
surface switch3 linkid=3

thing player local

sound elec=00electrexplo03.wav
sound objective=accomplish1.wav

template boom=+conc_exp

int done1=0 local
int done2=0 local

int power1=1 local
int power2=1 local
int power3=1 local


message activated
message damaged

end


code

activated:
if (GetSenderId() == 4 || getsenderid() == 5)
{
print("I should probably cut the power to these things before I do anything to them");
}

else if (GetSenderId() == 1)
{
if (power1 == 1)
{
power1 = 0;
print("power 1 off");
}
else
{
power1 = 1;
}
}

else if (GetSenderId() == 2)
{
if (power2 == 1)
{
power2 = 0;
print("power 2 off");
}
else
{
power2 = 1;
}
}

else if (GetSenderId() == 3)
{
if (power3 == 1)
{
power3 = 0;
print("power 3 off");
}
else
{
power3 = 1;
}
}
return;


damaged:
if (GetSenderId() == 1 && done1 == 0)
{
done1 = 1;
setwallcel(cond1, 1);
PlaySoundPos(elec, SurfaceCenter(cond1), 1, -1, -1, 0);

if (power1 == 1 || power3 == 1)
{
player=GetLocalPlayerThing();
CreateThing(boom, player);
CreateThing(boom, player);
}

if(getwallcel(cond2) == 1)
{
sleep(2.0);
print("OBJECTIVE COMPLETE!");
playsoundlocal(objective, 1, 0, 132);
player=GetLocalPlayerThing();
SetGoalFlags(player, 3, 0x2);
}
}

else if (GetSenderId() == 2 && done2 == 0)
{
done2 = 1;
setwallcel(cond2, 1);
PlaySoundPos(elec, SurfaceCenter(cond2), 1, -1, -1, 0);

if (power2 == 1 || power3 == 1)
{
player=GetLocalPlayerThing();
CreateThing(boom, player);
CreateThing(boom, player);
}

if(getwallcel(cond1) == 1)
{
sleep(2.0);
print("OBJECTIVE COMPLETE!");
playsoundlocal(objective, 1, 0, 132);
player=GetLocalPlayerThing();
SetGoalFlags(player, 3, 0x2);
}
}
return;


end

------------------
www.lastgreatwar.com
2004-01-14, 2:33 PM #2
Parsec says there's nothing wrong, so I'll have to look harder [http://forums.massassi.net/html/wink.gif]. Next time, PLEASE use the code tags around your cog. It makes it easier to read.
FYI, this is just the cog inside code tags. I used Scribe to reformat it so it would be indented, etc, since when I copied it it appeared in Notepad just like it does above. I have not changed any of the coding, however. I'm not sure what's wrong.

Code:
# Jedi Knight Cog Script
#==============================================================#
symbols

surface   cond1                       linkid=4
surface   cond2                       linkid=5
surface   switch1                     linkid=1
surface   switch2                     linkid=2
surface   switch3                     linkid=3

thing     player                      local

sound     elec=00electrexplo03.wav
sound     objective=accomplish1.wav

template  boom=+conc_exp

int       done1=0                     local
int       done2=0                     local
int       power1=1                    local
int       power2=1                    local
int       power3=1                    local

message   activated
message   damaged

end
#==============================================================#
code
#------------------------------------------------------
activated:
	if(GetSenderID() == 4 || GetSenderID() == 5)
	{
		Print("I should probably cut the power to these things before I do anything to them");
	}
	else if(GetSenderID() == 1) //activated power src 1
	{
		if(power1 == 1)
		{
			power1 = 0;
			Print("power 1 off");
		}
		else
		{
			power1 = 1;
		}
	}
	else if(GetSenderID() == 2) //pwr src 2
	{
		if(power2 == 1)
		{
			power2 = 0;
			Print("power 2 off");
		}
		else
		{
			power2 = 1;
		}
	}
	else if(GetSenderID() == 3) // pwr src 3
	{
		if(power3 == 1)
		{
			power3 = 0;
			Print("power 3 off");
		}
		else
		{
			power3 = 1;
		}
	}

Return;
#------------------------------------------------------
damaged:
	if(GetSenderID() == 1 && done1 == 0)
	{
		done1 = 1;
		SetWallCel(cond1, 1);
		PlaySoundPos(elec, SurfaceCenter(cond1), 1, -1, -1, 0);
		if(power1 == 1 || power3 == 1)
		{
			player = GetLocalPlayerThing();
			CreateThing(boom, player);
			CreateThing(boom, player);
		}
		if(GetWallCel(cond2) == 1)
		{
			Sleep(2.0);
			Print("OBJECTIVE COMPLETE!");
			PlaySoundLocal(objective, 1, 0, 132);
			player = GetLocalPlayerThing();
			SetGoalFlags(player, 3, 0x2);
		}
	}
	else if(GetSenderID() == 2 && done2 == 0)
	{
		done2 = 1;
		SetWallCel(cond2, 1);
		PlaySoundPos(elec, SurfaceCenter(cond2), 1, -1, -1, 0);
		if(power2 == 1 || power3 == 1)
		{
			player = GetLocalPlayerThing();
			CreateThing(boom, player);
			CreateThing(boom, player);
		}
		if(GetWallCel(cond1) == 1)
		{
			Sleep(2.0);
			Print("OBJECTIVE COMPLETE!");
			PlaySoundLocal(objective, 1, 0, 132);
			player = GetLocalPlayerThing();
			SetGoalFlags(player, 3, 0x2);
		}
	}

Return;
#------------------------------------------------------
end

See how much easier the tagged one was to read/follow than the untagged? If so, you see my point.

The code tags are used in the following format (minus the dashes):
[-code-]
Put ure code here
[-/code-]

------------------
I am Darth Slaw.
The Dark Lord of the Sith.

[This message has been edited by Darth Slaw (edited January 14, 2004).]
May the mass times acceleration be with you.
2004-01-14, 4:06 PM #3
yeah, this problem got me very angry for a very long time. After all, breaking glass isn't that much fun if u can only break it with a saber.

The problem is you have to give the surface you want to process the damage a mask so it knows what kind of damage to process.

Here is the mask I made for one of the mission objectives in the level i'm currently working on. With this mask, the surface will call the damaged section of your cog if it is hit by: an explosion, the saber, or by a force power.

Code:
thing		powertube01=-1	mask=0x440


It goes in the symbols section of your cog (der). I included what I used it on just so you can see where you put it in your cog. Just add the mask=0x440 at the end of your surface delcaration like I did above. If you want your surface to be damagible by other weapons other than what I said above, tell me and i'll try to figure out what mask you need.

------------------
One day, after everybody else quits, I'll be the best.
Sith Mercenaries
^My site.
One day, after everybody else quits, I'll be the best.
Sith Mercenaries
^My site.
2004-01-15, 10:13 AM #4
thanks, that was actually pretty helpful

the problem is it doesn't always recognize that i hit the surface in the first place, even with the saber

do you know the mask for "saber and explosives" only by any chance?

------------------
www.lastgreatwar.com

[This message has been edited by lgwb0b (edited January 15, 2004).]

↑ Up to the top!