# Jedi Knight Cog Script # # ELSE_FLASH.COG # # Blinds anyone who has LOS to it, even to AI. # # # This Cog is Not supported by LucasArts Entertainment Co symbols int original local int potential local int i local int m local int blinded local int Spotted local flex Flash_Intensity local flex DistFromFlash local int victim0=-1 local int victim1=-1 local int victim2=-1 local int victim3=-1 local int victim4=-1 local int victim5=-1 local int victim6=-1 local int victim7=-1 local int victim8=-1 local int victim9=-1 local int victim10=-1 local int victim11=-1 local int victim12=-1 local sound explode=forcedestruct02.wav local message created message timer end # ======================================================================================== code created: original = GetSenderRef(); victim0 = -1; m = 0; if(!IsMulti()) //for single player only, better method for multiplayer { LookVec = GetThingLVec(original); //Looking bad, but using "for" freezes... //Throwing grenades straight over sectors sometimes doesn't blind...adjoins interefering maybe, you fix it for me! SetThingLook(original, VectorSet(VectorX(LookVec), VectorY(LookVec), 0)); call find_them; SetThingLook(original, VectorSet(-VectorX(LookVec), -VectorY(LookVec), 0)); call find_them; SetThingLook(original, VectorSet(VectorX(LookVec), VectorY(LookVec), 0.5)); call find_them; SetThingLook(original, VectorSet(-VectorX(LookVec), -VectorY(LookVec), 0.5)); call find_them; SetThingLook(original, VectorSet(VectorX(LookVec), VectorY(LookVec), 1)); call find_them; SetThingLook(original, VectorSet(-VectorX(LookVec), -VectorY(LookVec), 1)); call find_them; SetThingLook(original, VectorSet(VectorX(LookVec), VectorY(LookVec), -0.5)); call find_them; SetThingLook(original, VectorSet(-VectorX(LookVec), -VectorY(LookVec), -0.5)); call find_them; for(i = 0; i <= m - 1; i= i + 1) { blinded = victim0[i]; SetActorFlags(blinded, 0x800); KillTimerEx(blinded); SetTimerEx(3, 0, GetThingSignature(blinded), blinded); } } //For real players blinded = GetLocalPlayerThing(); if( HasLOS(blinded, original) && (GetThingHealth(blinded) != 0) ) { SetActorFlags(blinded, 0x800); KillTimerEx(0); SetTimerEx(3, 0, GetThingSignature(blinded), blinded); DistFromFlash = VectorDist(GetThingPos(original), GetThingPos(blinded)); Flash_Intensity = (6 - DistFromFlash) * 100; if(Flash_Intensity < 10) Flash_Intensity = 10; DistFromFlash = (10 - DistFromFlash) * 0.2; SendMessageEx(GetThingClassCog(blinded), user1, Flash_Intensity, DistFromFlash, 0, 0); } SetThingLight(original, 2, 0.2); SetTimerEx(1, 1, original, 0); return; # ........................................................................................ find_them: //Why doesn't 360 deg work? (Even if I take the ThingViewDot away...) potential = FirstThingInView(original, 180, 9, 0x404); while(potential != -1) { if( HasLOS(potential, original) && (ThingViewDot(potential, original) > 0) && !(GetThingFlags(potential) & 0x200) && !(GetActorFlags(potential) & 0x100) ) { Spotted = 0; for(i = 0; i <= m; i = i + 1) { if(victim0[i] == potential) Spotted = 1; } if(!Spotted) { victim0[m] = potential; m = m + 1; } } potential = NextThingInView(); } return; # ........................................................................................ timer: if(GetSenderID() == 0) { if(GetThingSignature(GetParam(1)) == GetParam(0)) ClearActorFlags(GetParam(1), 0x800); } else if(GetSenderID() == 1) { SetThingLight(GetParam(0), 0, 2); } return; end