Skip to content
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Donate
Collapse

Plutonium

  1. Home
  2. BO2 Modding Support & Discussion
  3. How to check if player is within silent aim radius?

How to check if player is within silent aim radius?

Scheduled Pinned Locked Moved BO2 Modding Support & Discussion
1 Posts 1 Posters 43 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • RoyBlunkundefined Offline
    RoyBlunkundefined Offline
    RoyBlunk
    wrote last edited by
    #1

    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;
        }
    }
    
    1 Reply Last reply
    0
    Reply
    • Reply as topic
    Log in to reply
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes


    • Login

    • Don't have an account? Register

    • Login or register to search.
    • First post
      Last post
    0
    • Recent
    • Tags
    • Popular
    • Users
    • Groups
    • Donate