Well I've tried adding things to this cog, a few have worked. However, I was wanting to balance it a bit more by adding self health damage when battery power (I changed battery power to be like stamina
) gets lower than 40. I wasn't able to add the health damage without breaking the cog no matter what I tried unfortunately.
Here's the Cog I use. Health damage is in activated section:
) gets lower than 40. I wasn't able to add the health damage without breaking the cog no matter what I tried unfortunately.Here's the Cog I use. Health damage is in activated section:
Code:
symbols
thing player local
flex cost=50.0 local
int rank local
int mana local
int bin local
template lightning=+force_lightning local
sound fireSound=ForceLitning02.wav local
int fireChannel=-1 local
int modeTrack=-1 local
flex autoAimFOV=65 local
message startup
message activated
message deactivated
message fire
message killed
message selected
end
# ========================================================================================
code
startup:
player = GetLocalPlayerThing();
Return;
# ........................................................................................
fire:
mana = GetInv(player, 14);
if((mana >= 75) && (GetInv(player, 13) >= 20) && (GetThingHealth(player) > 75))
{
if(GetInv(player, 64) != 1) ChangeInv(player, 14, -cost) && ChangeInv(player, 13, -cost);
if(fireChannel == -1)
fireChannel = PlaySoundThing(fireSound, player, 1.0, -1, -1, 0x81);
FireProjectile(player, lightning, -1, -1, '-0.035 0.01 0', '0 0 0', 1.2, 0, autoAimFOV, autoAimFOV);
Sleep(0.001);
FireProjectile(player, lightning, -1, -1, '-0.025 0.01 0', '0 0 0', 1.2, 0, autoAimFOV, autoAimFOV);
Sleep(0.001);
FireProjectile(player, lightning, -1, -1, '0 0.01 0', '0 0 0', 1.2, 0, autoAimFOV, autoAimFOV);
Sleep(0.001);
FireProjectile(player, lightning, -1, -1, '0.025 0.01 0', '0 0 0', 1.2, 0, autoAimFOV, autoAimFOV);
Sleep(0.001);
FireProjectile(player, lightning, -1, -1, '0.035 0.01 0', '0 0 0', 1.2, 0, autoAimFOV, autoAimFOV);
}
else
{
if(fireChannel != -1)
{
StopSound( fireChannel, 0.1);
fireChannel = -1;
}
}
return;
# ........................................................................................
activated:
bin = GetSenderRef();
rank = GetInv(player, 32);
if(rank == 1)
cost = 3.0;
else if(rank == 2)
cost = 3.0;
else if(rank == 3)
cost = 3.0;
else if(rank == 4)
cost = 3.0;
ActivateBin(player, 0.3, bin);
SetInvActivated(player, 32, 1);
if (modeTrack == -1)
modeTrack = PlayMode(player, 24);
{
if(GetInv(player, 13) < 40);
ChangeInv(GetThingHealth(player) -1));
}
Return;
# ........................................................................................
selected:
jkPrintUNIString(player, 32);
Return;
# ........................................................................................
deactivated:
bin = GetSenderRef();
DeactivateBin(player, bin);
SetInvActivated(player, 32, 0);
call stop_power;
Return;
# ........................................................................................
killed:
if(GetSenderRef() != player) Return;
call stop_power;
Return;
# ........................................................................................
stop_power:
if(fireChannel != -1)
{
StopSound( fireChannel, 0.1);
fireChannel = -1;
}
if(modeTrack != -1)
{
StopKey(player,modeTrack,0.5);
modeTrack = -1;
}
Return;
end