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 → turning forc_throw into a new discipline
turning forc_throw into a new discipline
2001-10-17, 12:50 PM #1
expect to see me a lot more from now on, as this new mods need's lots of forces.

right here we go, sorry it's a bit long

symbols

thing player local
thing victim local
thing potential local

flex cost=40.0 local
flex mana local
flex dot local
flex maxDot local
flex damage local
flex starthealth local
int rank local
int retval=0 local

sound gripSound=HEART.WAV local
template blooddrop=+blooddrop local

int limit local
int count local

int active=0 local
int targetting=0 local
int Blood local

message startup
message activated
message deactivated
message pulse
message timer
message newplayer
message killed
message selected
message deselected

end

# ========================================================================================

code

startup:
player = GetLocalPlayerThing();

SetInvActivated(player, 30, 0);

Return;

# ........................................................................................

activated:
// Cannot use power if blinded
if(GetActorFlags(player) & 0x800) Return;

if(active) Return;

mana = GetInv(player, 14);
if(mana >= cost)
{
victim = -1;
active = 1;
targetting = 1;
SetPulse(0.33);
}
Return;

# ........................................................................................

deactivated:
// If no victim was found just cleanup and exit
if((victim == -1) || (GetThingHealth(player) <= 0) || !active)
{
call stop_power;
Return;
}

SetPulse(0);
jkEndTarget();
targetting = 0;

mana = GetInv(player, 14);
if(mana >= cost)
{
if(HasLOS(player, victim)) // check that we still have a LOS on it...
{
SetBinWait(player, 30, rank + 0.5);

PlayMode(player, 24);
if(GetInv(player, 64) != 1) ChangeInv(player, 14, -cost);
rank = GetInv(player, 30);
limit = rank * 3;
starthealth = GetThingHealth(player);

if(GetThingType(victim) == 10)
{
// Multiplayer enemies
if(!(GetThingFlags(victim) & 0x200))
{
retval = SkillTarget(victim, player, 30, rank);
SetPulse(0.1);
count = 0;
SetInvActivated(player, 30, 1);
}
else
{
Return;
}
}
else
{
damage = SkillTarget(victim, player, 30, 0);

if(damage > 0.0)
{
// Play choke animation on the victim.
PlayMode(victim, 25);
SetPulse(0.1);
count = 0;
SetInvActivated(player, 30, 1);
}
}
}
}

Return;

# ........................................................................................

pulse:
if(targetting == 1)
{
// Check all things for our victim.
victim = -1;
maxDot = 0;

// Search for all players and actors.
potential = FirstThingInView(player, 70, 4, 0x404);
while(potential != -1)
{
if(
HasLOS(player, potential) &&
(potential != player) &&
(VectorDist(GetThingPos(player), GetThingPos(potential)) <= 1) &&
!(GetThingFlags(potential) & 0x200) &&
!(GetActorFlags(potential) & 0x100) &&
!((jkGetFlags(potential) & 0x20) && !IsInvActivated(player, 23))
)
{
if(!BitTest(GetActorFlags(potential), 0x100))
{
dot = ThingViewDot(player, potential);
if(dot > maxDot)
{
victim = potential;
maxDot = dot;
}
}
}
potential = NextThingInView();
}

// If we have a victim...
if(victim != -1)
{
jkSetTargetColors(6, 7, 8);
jkSetTarget(victim);
}
else
{
jkEndTarget();
}
}
// this is the real Grip pulse
else
{
if((count > limit) ||
(GetThingHealth(player) < starthealth) ||
(GetActorFlags(player) & 0x800) ||
(GetThingFlags(victim) & 0x200)
)
{
call stop_power;
Return;
}

if(HasLOS(player, victim))
{
if(GetThingType(victim) == 10) // OTHER PLAYER
{
// everything is done in the victim's KYLE.COG handler
if(!(GetThingFlags(victim) & 0x200))
retval = SkillTarget(victim, player, 30, rank);
}
else // ENEMY
{
DamageThing(victim, damage * rank / 2, 0x8, player);
Blood = CreateThingAtPos(blooddrop, GetThingSector(victim), GetThingPos(victim), '0.01 0.01 0');
Blood = CreateThingAtPos(blooddrop, GetThingSector(victim), GetThingPos(victim), '-0.01 -0.01 0');

// Force the victim to stay in place
SetActorFlags(victim, 0x40000);
// But prepare to free it again in 0.45 seconds
SetTimerEx(0.45, victim, GetThingSignature(victim), 0);
}

PlaySoundThing(gripSound, victim, 2.0, -1, -1, 0x80);
count = count + 1;
SetPulse(0.5);
}
else
{
// break the power if LOS is lost
call stop_power;
}
}

Return;

# ........................................................................................

timer:
// This checks that the thing ref is still assigned to the same thing
if(GetThingSignature(GetSenderId()) == GetParam(0))
{
ClearActorFlags(GetSenderId(), 0x40000);
}

Return;

# ........................................................................................

selected:
jkPrintUNIString(player, 30);
Return;

# ........................................................................................

deselected:
call stop_power;

Return;

# ........................................................................................

killed:
if(GetSenderRef() != player) Return;

newplayer:
call stop_power;

Return;

# ........................................................................................

stop_power:
SetPulse(0);
SetInvActivated(player, 30, 0);
targetting = 0;
victim = -1;
active = 0;
jkEndTarget();

Return;

end


in the game all that happens is you target the enemy, uses blood/mana and nothing happens.
I'm a fool when it comes to editing force cogs.
Code:
if(getThingFlags(source) & 0x8){
  do her}
elseif(getThingFlags(source) & 0x4){
  do other babe}
else{
  do a dude}
2001-10-17, 5:50 PM #2
Quote:
<font face="Verdana, Arial" size="2">Originally posted by clan ruthervain:
I'm a fool when it comes to editing force cogs.
</font>


So am I [http://forums.massassi.net/html/biggrin.gif]
I can't see whats wrong with it...
Hey, I'm here! But who cares?
2001-10-19, 7:05 AM #3
I think your problem is with the SkillTarget verb. You replaced the third param (which was 31) with 30. Thirty is for force throw and that won't do any damage. So change it back to 31 (for grip) and it should work.

------------------
Never argue with an idiot. They drag you down to their level and beat you with experience.
Author of the JK DataMaster, Parsec, Scribe, and the EditPlus Cog Files.

↑ Up to the top!