Jump to content
Official BF Editor Forums
Sign in to follow this  
Morimaru

Little script needed ( headshot distance)

Recommended Posts

Hi all,

I'm looking for a script for my private mod that shows the distance in meters of a headshot on the notification feed. 

*Example - [ Headshot ] J. Doe [ 117m]

My modding knowledge is plenty basic, and absolutely no idea about phyton coding. I'm trying to understand phyton files of Wookie's Sniper Mod (that makes the thing) but I am mental blind, because I understand nothing. 

Some helpful soul bring me a hand? 

Thank you so much! 

Share this post


Link to post
Share on other sites

I'm on the right way?

 

Quote

class killevent:
    
    def __init__(self, attacker, victim, template):

        self.attacker = attacker
        self.victim = victim

        # determine target distance
        distance = vector.getDistance(playermanager.getPosition(attacker), playermanager.getPosition(victim))
        self.distance = int(math.ceil(distance))
        self.distanceScore = int(math.ceil(distance/100.0) * 5)

        self.weapon = constant.getName(template)
        self.weaponType = constant.getType(template)

    def process(self):

        # determine hit region
        if self.victim.isManDown() == 0:
            self.region = "headshot"
            self.regionScore = 20
        else:
            self.region = "bodyshot"
            self.regionScore = 0

        # SCORE / MESSAGE


            # rifle score
            elif self.weaponType == constant.rifle:
                self.score = self.distanceScore + self.regionScore + self.speedScore + self.stanceScore
                self.text = "%s [%s] %s   [%+i]   (%sm - %s - %s - %s)" % (playermanager.getName(self.attacker), self.weapon, playermanager.getName(self.victim), self.score, self.distance, self.region)

      
        common.message(self.text)

 

Edited by Morimaru

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
Sign in to follow this  

×
×
  • Create New...