How to check if a player is scoping
10 replies



11.11.19 08:18:28 pm
I need to be able to check if a player is using a scope, and what zoom level.
It's for the shieldhit hook
It's for the shieldhit hook

fish
Hmm.. I can't think of a way to do that.
I think there's no way in general to check if a player is scoping. In hooks like
hit it would be possible to check for scoping by checking the amount of damage. This isn't a 100% accurate solution in all cases though (damage can be reduced by previous hits).
Since
shieldhit doesn't even provide a damage value it's not even possible to use a damage based workaround there
I think there's no way in general to check if a player is scoping. In hooks like

Since


@
DC: I decided to use
Dirty workaround, but it works well if I use a multiplier like
But then I had a problem when I thought about player scoping, for now I ignore scoping but that'll affect gameplay...
There should be a "DMG" variable that gives the amount of damage that the shield mitigated.

item(wpn_id, 'dmg')
.Dirty workaround, but it works well if I use a multiplier like
* 0.5
.But then I had a problem when I thought about player scoping, for now I ignore scoping but that'll affect gameplay...
There should be a "DMG" variable that gives the amount of damage that the shield mitigated.
fish
For now, you can try using
attack2 if I am not wrong.

Create your UI easy and fast: UI Framework | Go deeper into the darkness and test your bravery:
Outlast II Mod (28)


@
Masea: Yeah it's possible to follow the weapon mode for every player in a variable.
But, its unefficient and not really worth the effort.
Plus, it could go wrong without you even realizing it.

But, its unefficient and not really worth the effort.
Plus, it could go wrong without you even realizing it.
fish
Yep,
Mami Tomoe. Thought about adding the very same thing. Will do so.

add a variable like
made for 3 minutes and not tested, is only the idea.
I think is enough to keep at least one variable for every player in that case, the select hook allow you to drop the variable(also if u even change the weapon u're in scope to the same weapon it count as "select")
/maybe i'm wrong just kill me :v
Code:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
player1zoom = 0
addhook("attack2","_attack2")
function _attack2(id,mode)
if mode==1 then
player1zoom = 1
elseif mode==2 then
player1zoom = 2
end
end
addhook("shieldhit","_shieldhit")
function _shieldhit(id,source)
if player1zoom == 1 then
msg("ah is one")
elseif player1zoom == 2 then
msg("oh is two")
end
end
addhook("select","_select")
function _select(id)
player1zoom = 0
end
addhook("attack2","_attack2")
function _attack2(id,mode)
if mode==1 then
player1zoom = 1
elseif mode==2 then
player1zoom = 2
end
end
addhook("shieldhit","_shieldhit")
function _shieldhit(id,source)
if player1zoom == 1 then
msg("ah is one")
elseif player1zoom == 2 then
msg("oh is two")
end
end
addhook("select","_select")
function _select(id)
player1zoom = 0
end
made for 3 minutes and not tested, is only the idea.
I think is enough to keep at least one variable for every player in that case, the select hook allow you to drop the variable(also if u even change the weapon u're in scope to the same weapon it count as "select")
/maybe i'm wrong just kill me :v
edited 2×, last 12.11.19 08:05:04 pm
@
mrc: I know right, but as I said I just made an idea for 3 minutes. Just tired after job and less attentive. Fixed post, thanks anyways.




