I downloaded this cog right here at massassi for blowing up a designated object, but in the placed cogs menu it wont let me enter any values for thing, etc. Can anyone see anything wrong with it? If not, can someone write me a simple cog for blowing up an object (object takes certain amount of damage, then explosion w./debris and then destroys thing). Thanks.
# Jedi Knight Cog Script
#
# XTANK1.COG
#
# This cog causes an attached object to explode if damaged sufficiently
#
# 5/23 - RKD - Removed buggy "remains" element
# 5/30 - YB - Don't explode if hit by fists.
# 7/7 - CR - Converted to actor cog
# Added delay in exploding
# 7/7 - YB - Rewrote the script to use thing user data
# 7/8 - CR - Adjusted delay, fixed damage test, marked issue closed
# 7/25 - YB - Made execution mode SERVER | SYNC
# 8/26 - RKD - Added killtimerex to fix bug
#
# (C) 1997 LucasArts Entertainment Co. All Rights Reserved
# 4/98 -DAK- Changed Cog for use with grating.
flags=0x80
symbols
message created
message damaged
message timer
template barrel_exp=+debris_exp local
int barrel local
flex barrelhealth local
flex damage local
end
# ========================================================================================
code
created:
SetThingUserData(GetSenderRef(), 30); // set the initial user data (i.e. "health")
Return;
# ............................................................................................
damaged:
barrel = GetSenderRef();
damage = GetParam(0);
barrelhealth = GetThingUserData(barrel);
if(GetParam(1) == 1) Return; // barrel won't be damaged by damage type impact
if(barrelhealth <= damage) // is this enough damage to kill the barrel ?
{
SetTimerEx(0.5, barrel, 0, 0); // prepare to kill the barrel in 0.6 second
Return;
}
SetThingUserData(barrel, barrelhealth - damage);
Return;
# ............................................................................................
timer:
KillTimerEx(GetSenderId());
CreateThing(barrel_exp, GetSenderId()); // create an explosion
DestroyThing(GetSenderId()); // Destroy the barrel
Return;
end
[This message has been edited by Joshua (edited April 26, 2001).]
# Jedi Knight Cog Script
#
# XTANK1.COG
#
# This cog causes an attached object to explode if damaged sufficiently
#
# 5/23 - RKD - Removed buggy "remains" element
# 5/30 - YB - Don't explode if hit by fists.
# 7/7 - CR - Converted to actor cog
# Added delay in exploding
# 7/7 - YB - Rewrote the script to use thing user data
# 7/8 - CR - Adjusted delay, fixed damage test, marked issue closed
# 7/25 - YB - Made execution mode SERVER | SYNC
# 8/26 - RKD - Added killtimerex to fix bug
#
# (C) 1997 LucasArts Entertainment Co. All Rights Reserved
# 4/98 -DAK- Changed Cog for use with grating.
flags=0x80
symbols
message created
message damaged
message timer
template barrel_exp=+debris_exp local
int barrel local
flex barrelhealth local
flex damage local
end
# ========================================================================================
code
created:
SetThingUserData(GetSenderRef(), 30); // set the initial user data (i.e. "health")
Return;
# ............................................................................................
damaged:
barrel = GetSenderRef();
damage = GetParam(0);
barrelhealth = GetThingUserData(barrel);
if(GetParam(1) == 1) Return; // barrel won't be damaged by damage type impact
if(barrelhealth <= damage) // is this enough damage to kill the barrel ?
{
SetTimerEx(0.5, barrel, 0, 0); // prepare to kill the barrel in 0.6 second
Return;
}
SetThingUserData(barrel, barrelhealth - damage);
Return;
# ............................................................................................
timer:
KillTimerEx(GetSenderId());
CreateThing(barrel_exp, GetSenderId()); // create an explosion
DestroyThing(GetSenderId()); // Destroy the barrel
Return;
end
[This message has been edited by Joshua (edited April 26, 2001).]
"Flash like daybreak to the fray"
Raccoonking: Deeznuts are tasty!http://www.geocities.com/joshroxby/
Raccoonking: Deeznuts are tasty!http://www.geocities.com/joshroxby/