I have been working on this cog for a while and I still can't seem to get it right. As of right now it only teleports the player to the victims location.
that is basically the force blinding cog, except for this:
If someone could help me, that'd be greatly appreciated
Code:
# Instantly transports victim to your location and # transports you to their location symbols thing player local thing victim local thing potential local int tele=-1 local flex mana local flex cost=50.0 local int rank local int count local int retval=0 local flex dot local flex maxDot local sound blindingSound=score2.wav local template obj=+bryar local int active=0 local message startup message activated message deactivated message pulse message newplayer message killed message deselected message selected end # ======================================================================================== code startup: player = GetlocalPlayerThing(); Return; # ........................................................................................ activated: if(active) Return; mana = GetInv(player, 14); rank = GetInv(player, 27); cost = 100/rank; if(mana >= cost) { victim = -1; active = 1; SetInvActivated(player, 27, 1); SetPulse(0.33); } Return; # ........................................................................................ pulse: // 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)) <= (2 + 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(1, 2, 3); jkSetTarget(victim); } 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); if(HasLOS(player, victim) && (victim != player)) { PlayMode(player, 24); PlaySoundThing(blindingSound, player, 1.0, -1, -1, 0x80); tele = CreateThing(obj, GetThingPos(player)); TeleportThing(player,victim); TeleportThing(victim,tele); DestroyThing(obj); } } active = 0; SetInvActivated(player, 27, 0); Return; # ........................................................................................ selected: jkPrintUNIString(player, 27); Return; # ........................................................................................ deselected: call stop_power; Return; # ........................................................................................ killed: if(GetSenderRef() != player) Return; newplayer: call stop_power; Return; # ........................................................................................ stop_power: SetPulse(0); SetInvActivated(player, 27, 0); active = 0; jkEndTarget(); Return; end
that is basically the force blinding cog, except for this:
Code:
tele = CreateThing(obj, GetThingPos(player)); TeleportThing(player,victim); TeleportThing(victim,tele); DestroyThing(obj);
If someone could help me, that'd be greatly appreciated