Thanx 4 yer reply in the other forum -- I shoulda known it'd be controlled by COG; I get a bit confused when it comes to projectiles.
_K_
_K_
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.
## Jedi Knight Cog Script # # FORCE_DRAIN.COG # # FORCEPOWER Script - DRAIN - replaces "Blinding" # Light (should be Dark) Side Power # Bin 27 # # [Originally by YB] # # Modifed version of force blinding, so that the victim's health and mana # become the attacker's (the force user's). # # This cog script is FAR from perfect - it's just a *(VERY) QUICK* altered version of # LEC's "Force Blinding" that I drummed up - there are a couple of inconsistencies, # and none of the script is *really* dependent upon "force assignment stars". # (eg: "rank" based effects/duration) # The script also contains many "hard-coded" variables, that do not allow for # any real "dynamic updating"... :S # # If you wish to have it as an additional force power, then you'll need to edit # "items.dat" file (make sure you have an "icon"), else it will crash JK !!! # # # This COG script is NOT supported by LucasArts or LEC. # # Permission is granted to use this script by the author, as long as credit # is provided in the readme file for any add-on levels that use this script. # # E-mail: lucky_jackpot@hotmail.com # [RJS] ## symbols thing player local thing victim local thing potential local flex mana local flex cost=100.0 local int rank local int count local int retval=0 local int dummy local flex dot local flex maxDot local sound blindingSound=ForceBlind01.WAV local template cone_tpl=+force_blind local int active=0 local message startup message activated message deactivated message pulse message timer message newplayer message killed message deselected message selected flex playerHealth local flex victimHealth local flex damageAmount local flex manaReductionRate=10 local flex minAmountNeeded=25 local end # ======================================================================================== code startup: player = GetlocalPlayerThing(); Return; # ........................................................................................ activated: if(active) Return; mana = GetInv(player, 14); rank = GetInv(player, 27); if(mana >= cost) { victim = -1; active = 1; SetInvActivated(player, 27, 1); SetPulse(0.33); } Return; # ........................................................................................ pulse: if (GetInv (player, 14) <= minAmountNeeded) Return; // Check all things for our victim. victim = -1; maxDot = 0; // Search for all players and actors. potential = FirstThingInView(player, 30 + 15 * rank, 8, 0x404); while(potential != -1) { if ( HasLOS(player, potential) && (potential != player) && (VectorDist(GetThingPos(player), GetThingPos(potential)) <= (1 + rank)) && !(GetThingFlags(potential) & 0x200) && !(GetActorFlags(potential) & 0x100) && !((jkGetFlags(potential) & 0x20) && !IsInvActivated(player, 23) ) ) { dot = ThingViewDot(player, potential); if(dot > maxDot) { victim = potential; maxDot = dot; } } potential = NextThingInView(); } // If we have a victim... if(victim != -1) { jkSetTargetColors(6, 6, 6); jkSetTarget(victim); ChangeInv (player, 14, -10); PlaySoundThing(blindingSound, player, 1.0, -1, -1, 0x80); // Sort out "health" redistribution and dispersement... // This is tested and works... victimHealth = GetThingHealth (victim); damageAmount = 10; DamageThing (victim, damageAmount, 0x1, player); PrintInt (victimHealth); HealThing (player, 5); // Now deal with the force side of things... // NB: Could not test this next section of code // (for MP *OR* SP), so this is based on theory... :/ if (IsInvAvailable (player, 14) > 0) { // If the player's Force bin is available... if (IsInvAvailable (victim, 14) > 0 ) { //...and the victim's Force bin is available ChangeInv (victim, 14, -manaReductionRate); // reduce victim's mana... ChangeInv (player, 14, manaReductionRate); // increase player's mana... } else { Print ("NO FORCE to DRAIN...."); } } } else { jkEndTarget(); } Return; # ........................................................................................ deactivated: if((victim == -1) || (GetThingHealth(player) <= 0)) { call stop_power; Return; } SetPulse(0); jkEndTarget(); mana = GetInv(player, 14); if(mana >= cost) { if(GetInv(player, 65) != 1) // ChangeInv(player, 14, -cost); SetBinWait(player, 27, 0.2); rank = GetInv(player, 27); if(HasLOS(player, victim) && (victim != player)) { PlayMode(player, 24); // PlaySoundThing(blindingSound, player, 1.0, -1, -1, 0x80); // dummy = CreateThingAtPosNR(cone_tpl, GetThingSector(player), VectorAdd(GetThingPos(player), '0.0 0.0 0.04'), '0.0 0.0 0.0'); // SetThingLook(dummy, VectorSub(GetThingPos(victim), GetThingPos(player))); // Blind victim for 5 seconds per rank if ( (GetThingType(victim) == 10) || (GetThingType (victim) == 2) ) // OTHER PLAYER { if(!(GetThingFlags(victim) & 0x200)) retval = SkillTarget(victim, player, 27, rank); } else // ENEMY { // If bit is already set we kill the existing timer and start a new one if(GetActorFlags(victim) & 0x800) KillTimerEx(victim); SetActorFlags(victim, 0x800); // Pass signature (i.e. unique ID) as a check in param 0 SetTimerEx(rank * 5, victim, GetThingSignature(victim), 0.0); } } } active = 0; SetInvActivated(player, 27, 0); Return; # ........................................................................................ timer: // This checks that the thing ref is still assigned to the same thing // (remember the guy could have died and its ref reassigned to a generated thing) if(GetThingSignature(GetSenderId()) == GetParam(0)) { ClearActorFlags(GetSenderId(), 0x800); } Return; # ........................................................................................ selected: jkPrintUNIString(player, 27); Return; # ........................................................................................ deselected: call stop_power; Return; # ........................................................................................ killed: if(GetSenderRef() != player) Return; Return; newplayer: call stop_power; Return; # ........................................................................................ stop_power: SetPulse(0); SetInvActivated(player, 27, 0); active = 0; jkEndTarget(); Return; end