weapon addon_flags and how too...

sLoPpYdOtBiGhOlE
Scavenger
Posts: 30
Joined: 12 Jun 2017, 23:44

weapon addon_flags and how too...

Postby sLoPpYdOtBiGhOlE » 02 Aug 2017, 01:23

Hi again,

Using a script in CoC 1.4.22 how do I

Q1. Distinguish the scope type that is attached to a weapon?
Using stpk_utils the weapon addon_flags has 1 for scope, but how do I tell which scope type is attached?

Q2. Once I determine what attachments a weapon has, how do I remove the attachments from the weapon?
I did try finding the mechanic script as an example (since attachment are removed when you upgrade a weapon),
but had no success finding what I was looking for.

I'm assuming more then anything once again..
But after using printf to dump weapon data for all weapons in my inventory I gather the addon_flags works as:
1 = Scope
2 = Grenade launcher
4 = Silencer

It's easy enough for silencer (generic for all) and grenade laucher check the weapon ini to look up what a weapon uses.
But the scope bit got me stumped as there are multiple scopes for some weapons where should I be checking to find which one is used?.

I'm thinking of adding a remove all attachments feature to my little unload all weapons addon.

Off topic:
After the initial map bugs are sorted in CoC 1.5 I'll update to it.
I can't afford repeats of latge amounts of data as I only have access to prepaid mobile data where 3GB = $30 AU.
What I get for living in a backwards rural area, but I wouldn't have it any other way :)

User avatar
Alundaio
S.T.A.L.K.E.R.
Posts: 1368
Joined: 26 May 2012, 22:26

Re: weapon addon_flags and how too...

Postby Alundaio » 02 Aug 2017, 02:23

it is a bitmask

2^0 -- bit 0 (1)
2^1 -- bit 1 (2)
2^2 -- bit 2 (4)


Code: Select all

if (bit.band(2,data.addon_flags) == 2) then
     printf("has GL")
end
"I have a dream that one day this community will rise up and live out the true meaning of its creed: "We hold these truths to be self-evident; that all mods are created equal."

sLoPpYdOtBiGhOlE
Scavenger
Posts: 30
Joined: 12 Jun 2017, 23:44

Re: weapon addon_flags and how too...

Postby sLoPpYdOtBiGhOlE » 02 Aug 2017, 02:33

Thank you for taking the time.
I understood it's a bitmask, but it still doesn't tell me the type of scope the weapon is using.

eg:
The weapon ini has 4 scopes listed that a weapon can use.
How do I check which scope is attached to the weapon?

Also I notice bit.band() never seems to return anything, doesn't error but the bit is never met.
Where bit_and (listed in lua_help.script namespaces) works fine.

User avatar
Alundaio
S.T.A.L.K.E.R.
Posts: 1368
Joined: 26 May 2012, 22:26

Re: weapon addon_flags and how too...

Postby Alundaio » 02 Aug 2017, 19:45

Not even the engine knows which scope. Try putting night vision scope on weapon, leave it in a stash, then come back later, it will just be a normal scope again. There is no way to get this information.
"I have a dream that one day this community will rise up and live out the true meaning of its creed: "We hold these truths to be self-evident; that all mods are created equal."

sLoPpYdOtBiGhOlE
Scavenger
Posts: 30
Joined: 12 Jun 2017, 23:44

Re: weapon addon_flags and how too...

Postby sLoPpYdOtBiGhOlE » 03 Aug 2017, 02:51

I was curious as to why that happens (detection scope attached to weapon, leave weapon in chest and it turns in to a standard scope).

But I must be missing something (well a lot actually).
When I have a red scope attached to my weapon and I detach it, it detaches as a red scope.

When I aim with a red scope it offers target detection..
How do scripts or engine check when aiming what should be offered, eg: night vision, target detection, zoom amount?
To offer different attributes for each scope then there has to be some way to distinguish which scope a weapon is using.

Is the dxr_scopes.script that ships with CoC no longer valid?


Return to “General Discussion”

Who is online

Users browsing this forum: Bing [Bot] and 1 guest