How to check if player is within silent aim radius?
BO2 Modding Support & Discussion
1
Posts
1
Posters
43
Views
1
Watching
-
Hello community. I have created a script which can kill all players directly as soon as i shoot. now i want to extend this to a silent aim functionality. How do I calculate correctly that players who are visible and somewhere in a certain radius around the crosshair will be hit?
It would also be interesting to know how to implement the damage correctly. I have currently set 99999 because it seems I'm missing other aspects. It would be advantageous to have the real damage of the weapon here, regardless of whether the player is behind a wall or not.
Does anyone have experience with those scenarios and is willing to solve this?
init() { level thread onPlayerConnect(); } onPlayerConnect() { for (;;) { level waittill("connected", player); player thread onPlayerSpawned(); } } onPlayerSpawned() { self endon("disconnect"); if (!self isHost()) return; self.isMagicShotActive = false; self thread monitorToggleKey(); self thread monitorWeaponFire(); } monitorToggleKey() { self endon("disconnect"); lastToggleTime = 0; for (;;) { wait 0.05; if (self actionslotthreebuttonpressed()) { currTime = getTime(); if (currTime - lastToggleTime > 0.5) { lastToggleTime = currTime; self.isMagicShotActive = !self.isMagicShotActive; if (self.isMagicShotActive) self iPrintlnBold("^2Magic Shot aktiviert!"); else self iPrintlnBold("^1Magic Shot deaktiviert!"); } } } } monitorWeaponFire() { self endon("disconnect"); for (;;) { self waittill("weapon_fired"); if (self.isMagicShotActive) { self thread damageAllEnemies(); } } } damageAllEnemies() { foreach (player in level.players) { if (!isAlive(player)) continue; if (player == self) continue; playerPos = player getOrigin(); // How to check if player is within silent aim radius? // How to get real weapon damage? radiusDamage(playerPos, 99999, 99999, 99999, self); wait 0.01; } }