Jump to content
Sign in to follow this  
zapat

SetVariable for Items?

Recommended Posts

Is it possible to set variables for an Item (eg. NvGoogles, or weapons) just like you can do for an object?

I am amfraid we can't as these are stored as strings, and not objects: I guess thats why they need holders (which are objects) . Is this how items work at all?

But I may be mistaken here, or someone may have a workaround.

(What I am trying to do: I want NvGoogles not to be usable for a long time, so I want to measure how long has the player used it. The easiest would be a variable tied to the google itself. )

Share this post


Link to post
Share on other sites

Instead of the object, you could save the variable to the player himself (or herself).

Share this post


Link to post
Share on other sites

Or alternativly you could attach a logic ("logic" createVehicle) to the player and track the night vision. then you could save the timeUsed in the logic object.

I would be rather hard (if not impossible) to track the nvg tho. (E.g. when it is moved into different cargo e.t.c).

Share this post


Link to post
Share on other sites

Yes, moving to different cargos is the problem with variables attached to the player or a logic (that is not to the NVG itself). It is impossible to track as there is no way to ID the NVG.

They seem to be quantities only..

Share this post


Link to post
Share on other sites

I think that's the only way to do it (setVar the player or some other object).

As you mention, weaps and mags are just strings, so there is no way to reliably track anything about them. I think that's why DayZ decided to make weaps as objects for that very purpose.

The only thing I can think of (and it's just thinking aloud) is to investigate how magazines retain their amount of ammo once dropped. You could mess with the configs for NVGoggs to add in a magazine ("LaserBatteries") and assign the battery a "count" value of higher than 1.

Then rig the NVGs to fire continuously when worn (again, more config magic) and it should deplete the battery as if it were a magazine. if the battery follows the principles for other magazines then it may retain it's charge (ammo)

Not sure this would even work but might be worth a try (not even sure if batteries are Arma 3 yet).

Share this post


Link to post
Share on other sites

Thanks guys!

DA your idea is great (as mostly always), although a bit too complicated. We'll see the at release if we can pull it off.

Until then I decidd to go for a personal battery: so not the NVG, but the solider has the battery, and he can operate whatever NVG he wants from it. Not too realistic, but very simple and resource effective and we'll see how it turns out gameplaywise.

Nighttime with unlimited NVGs are just too easy for the scenario I am working on. :)

Share this post


Link to post
Share on other sites

Look into ACRE, they are assigning individual ID's to the radios, so that each radio (once taken from an ammobox) is unique.

Share this post


Link to post
Share on other sites

Thanks Dwarden!

And how do I do this? I've been trying to digest this info for a long time (and actually create an NVG and setVariable) but no success so far.

CreateVehicle doesn't create the NVG.

Additem to a holder adds a string only, there is nowhere an object returned meanwhile.

Taken off NVG goes to a groundWeaponHolder, so its the same. A string in the cargo of a holder.

What else do we have?

Share this post


Link to post
Share on other sites

I thought there was either no actual object for the NVGs (or any weapon/magazine/item really) or at least no way to access that object via scripting? After all, all related commands return a string.

Are there new scripting commands to get the actual object rather than its class name string?

In any case, NVG batteries usually last at least several hours (ex: pvs-14 50 hours), more or less depending on the actual NVG type and actual battery used. If you want to "balance" NVGs, post-processing effects might be more appealing to get the desired results, though I'm not sure how those would work combined with the post processing graphic settings.

Share this post


Link to post
Share on other sites

Isn't there a way to check out the function http://community.bistudio.com/wiki/ammo.

It stores the rounds inside a clip so I figgure by inspection that code we might be able to find a way to add Rounds/battery to a nvg?

I've tried to extract the arma PBO files but it doesn't work with kegety's cpbo.

Share this post


Link to post
Share on other sites

I'd like to bump this thread to return attention to the topic. Has anyone managed to figure out a solution?

It seems that magazines have unique IDs attached to them. When you equip a mag and run the command 'currentMagazineDetail', you will see this. While magazines aren't considered objects (and thus cannot be created with 'createVehicle'), they still have an ID which acts as a pointer to some persistent variable that contains the current magazine count.

Do you think it's possible to add IDs in the same manner to weapons and other items with scripting? Or is this a limitation of the engine itself, and in that case only BIS can address the issue?

Share this post


Link to post
Share on other sites

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now
Sign in to follow this  

×