CrazyAluminum Posted October 20, 2020 Share Posted October 20, 2020 Main idea: flashlight, gun flashlight, headlight, car light, night vision goggles, reflex sights won't work without rechargeable batteries that have their own charge. As example: 10180 90 mAh 10220 ≈130 mAh 10280 ≈180 mAh 10430, 10440 ≈250 mAh 14250 ≈250 mAh 14270 ≈700 mAh 14430 ≈500 mAh 14500 ≈700 mAh 14670 ≈700 mAh 15266, 15270 ≈750-850 mAh 16340 ≈750-1200 mAh 17500 ≈1100 mAh 17670 ≈1800 mAh 18350, 18490 ≈1400 mAh 18500 ≈1400 mAh 18650 1600-3600 mAh 18700 1600-3700 mAh 21700, 22650 3000-4000 mAh 25500, 26500 2500-5000 mAh 26650, 26980 2300-6000 mAh 32600, 32650 3000-6500 mAh 33600 3500-6500 mAh 42120 ≈5000 mAh Above you see what I wanna do(see), and also: No battery recipes, only could be find in the loot. No battery repairs, only recharge in the battery bank or etc. No flashlight repairs (and etc.). Spoiler I'm confused about all these buffs and Idk is it really to do it in the xml: Rechargeable battery on 2000 mAh effect_group <requirement name="!HoldingItemHasTags" tags="CFO_accumulator2000mAh"/> <passive_effect name="ModifyCVar" cvar="CFO_charge" operation="set" value="2000"/> flashlight effect_group <requirement trigger="onSelfItemActivate" action="SetTransformActive" active="true" parent_transform="#HeldItemRoot" transform_path="lightSource"/> <triggered_effect trigger="onSelfBuffUpdate" action="ModifyCVar" cvar="CFO_charge" operation="subtract" value="1"/> effect_group <requirement name="CVarCompare" cvar="CFO_charge" operation="GTE" value="1"/></triggered_effect/> <triggered_effect trigger="onSelfItemActivate" action="SetTransformActive" active="true" parent_transform="#HeldItemRoot" transform_path="lightSource"/> effect_group <triggered_effect trigger="onSelfItemDeactivate" action="SetTransformActive" active="false" parent_transform="#HeldItemRoot" transform_path="lightSource"/> <requirement name="CVarCompare" cvar="CFO_charge" operation="Equals" value="0"/></triggered_effect> </passive_effect> Also, is it possible to make custom blocks with vanilla parts like Shufkin's server-side weapons, entities and vehicles? Please tell me how to. Link to comment Share on other sites More sharing options...
stample Posted October 20, 2020 Share Posted October 20, 2020 Some issues with how you're doing it. I'll say up front I'm not sure how to fix it, though. I've done something almost exactly like this in a mod I've yet to release, but with one critical difference. More on that below. One, every time you equip the flashlight, its going to reset CFO_charge back to 2000. So all you're really doing is determining how long you can have it on without toggling it again. You can fix this by setting a new cvar, CFO_current_charge, and always decrementing from it. Even when you de-equip that item, the cvar stays intact so it will remember what charge level you had. However, to prevent it from setting that back to 2k each time, what you really need is a permanent buff, that sets CFO_current_charge to 2k on buff start, and there's no criteria to end it. Then, each time you equip after the 1st time, it won't be starting but merely updating the buff. So that'll stop it from giving you free charge. That brings us to a different issue, though, which is that the game will have no idea which item its tracking. So if you toss that flashlight, and grab another, it'l be charged the same as the first. I get around that by saying that the item doesn't come with a battery, and you carry your (only good) battery with you, inserting it into whichever battery-needing item you are using at the time. Finally, you'd need a way to recharge your battery, or the item's battery if you find a way to do that. I created a charging station block that grants buff when walked on, that increments CFO_current_charge. It checks CFO_current_charge to see if its lower than CFO_charge (which we're using as the max value) and increments it when <=. For safety, also make a check if its >=, and set it = to CFO_charge if so. Prevents overcharging through any weird bugs. Another thing I'll throw in, just in case you don't know, is that buffs should (nearly) all have a update rate. 1 = 1 RL second. So you can control how fast its charging very finely. 1 every 1/2 second, or 2 every 1 second, or 10 every 20th second, or whatever. And, yes, you can create custom blocks using existing prefabs, but your results may get weird. Collision seems to be tied to the prefab, unless you use an imposter block. I've only messed with it a tiny bit, and decided it wasn't worth it for what I was doing. Link to comment Share on other sites More sharing options...
doughphunghus Posted October 20, 2020 Share Posted October 20, 2020 I personally would love a battery dependent/non eternal flashlight. I’ve been thinking of looking into a way to have flashlight tiers as well, the lower tiers being very dim, and the highest tier being the current vanilla brightness as the current flashlights are way too bright and OP, IMHO. Anyway, if either of you release your flashlight mod(s) for batteries, I would love it . I have a flashlight mod that essentially makes it harder to get flashlights /headlight mods (removes them from loot, have to craft) to keep the game darker for longer. also: I recently threw together a mini battery bank for charging and using “capacitors”. A mini charging station for Flashlight batteries would be essentially the same, if anyone wants to pilfer it. Link to comment Share on other sites More sharing options...
CrazyAluminum Posted October 20, 2020 Author Share Posted October 20, 2020 3 minutes ago, doughphunghus said: I personally would love a battery dependent/non eternal flashlight. I’ve been thinking of looking into a way to have flashlight tiers as well, the lower tiers being very dim, and the highest tier being the current vanilla brightness as the current flashlights are way too bright and OP, IMHO. Anyway, if either of you release your flashlight mod(s) for batteries, I would love it . I have a flashlight mod that essentially makes it harder to get flashlights /headlight mods (removes them from loot, have to craft) to keep the game darker for longer. also: I recently threw together a mini battery bank for charging and using “capacitors”. A mini charging station for Flashlight batteries would be essentially the same, if anyone wants to pilfer it. I don't like tiers for flashlights, but if I could switch modes... Link to comment Share on other sites More sharing options...
doughphunghus Posted October 20, 2020 Share Posted October 20, 2020 3 hours ago, CrazyAluminum said: I don't like tiers for flashlights, but if I could switch modes... If the battery would run down faster when it was brighter, and less when it was dimmer, I’d be happy. The whole purpose of wanting tiers was to not get a god tier flashlight every time you picked one up, even on day 1. If batteries controlled flashlight power/duration/brightness then the battery quality already built in game would be enough to balance it until you could loot/buy/maintain good batteries. maybe part of a way to balance the battery issue would be that the batteries are not pulled out like batteries/mods, but are crafted as part of the flashlight, and there could be mods for flashlights like better bulbs/lenses/etc. for brightness. Then the flashlight “battery duration” would be like weapon quality where it wears out to zero (flashlight no lights up) and to “repair” it you use another battery.? Just thinking aloud as it seems it may be difficult to do batteries in flashlights based on buffs/cvars (since above there's "....that the game will have no idea which item its tracking"). I haven’t really thought about it much in this way, so my bad if it’s a terrible idea I’d be happy if anything worked better (makes flashlights more “real” and more difficult) than the flashlight mechanics we current have in vanilla Link to comment Share on other sites More sharing options...
CrazyAluminum Posted October 21, 2020 Author Share Posted October 21, 2020 7 hours ago, doughphunghus said: If the battery would run down faster when it was brighter, and less when it was dimmer, I’d be happy. The whole purpose of wanting tiers was to not get a god tier flashlight every time you picked one up, even on day 1. If batteries controlled flashlight power/duration/brightness then the battery quality already built in game would be enough to balance it until you could loot/buy/maintain good batteries. maybe part of a way to balance the battery issue would be that the batteries are not pulled out like batteries/mods, but are crafted as part of the flashlight, and there could be mods for flashlights like better bulbs/lenses/etc. for brightness. Then the flashlight “battery duration” would be like weapon quality where it wears out to zero (flashlight no lights up) and to “repair” it you use another battery.? Just thinking aloud as it seems it may be difficult to do batteries in flashlights based on buffs/cvars (since above there's "....that the game will have no idea which item its tracking"). I haven’t really thought about it much in this way, so my bad if it’s a terrible idea I’d be happy if anything worked better (makes flashlights more “real” and more difficult) than the flashlight mechanics we current have in vanilla It would be ideal if you could find different flashlights with different lighting modes: blinking, bright, and dim. A bunch of different rechargeable batteries 16340, 18650, 26650, 32650, etc. During the loot, you could find flashlights with a random amount of charge. Ideas like adding durability to a flashlight and repairing it are too commonplace and unrealistic Link to comment Share on other sites More sharing options...
stample Posted October 21, 2020 Share Posted October 21, 2020 Actually, if you had a way to cause it to lose durability, that'd be the best solution. Its how batteries work, after all. Just change the repair item to a battery (maybe a new one, not a car battery) and that solves it I think. But how to get it to use durability when on, rather than swinging? Link to comment Share on other sites More sharing options...
CrazyAluminum Posted October 21, 2020 Author Share Posted October 21, 2020 13 minutes ago, stample said: Actually, if you had a way to cause it to lose durability, that'd be the best solution. Its how batteries work, after all. Just change the repair item to a battery (maybe a new one, not a car battery) and that solves it I think. But how to get it to use durability when on, rather than swinging? In that case, I don't wanna repair flashlight with one battery, I wanna repair with different batteries Link to comment Share on other sites More sharing options...
stample Posted October 21, 2020 Share Posted October 21, 2020 Hmm, probably much harder then. You can only list 1 repair item in the item. Unless you have 3 different flashlights which each use one of 3 different batteries? Well, if we can get past the durability part, we can re-examine that. Link to comment Share on other sites More sharing options...
CrazyAluminum Posted October 21, 2020 Author Share Posted October 21, 2020 6 hours ago, stample said: Hmm, probably much harder then. You can only list 1 repair item in the item. Unless you have 3 different flashlights which each use one of 3 different batteries? Well, if we can get past the durability part, we can re-examine that. I have updated the text so you can understand better Link to comment Share on other sites More sharing options...
doughphunghus Posted October 22, 2020 Share Posted October 22, 2020 On 10/21/2020 at 8:31 AM, stample said: Actually, if you had a way to cause it to lose durability, that'd be the best solution. Its how batteries work, after all. Just change the repair item to a battery (maybe a new one, not a car battery) and that solves it I think. But how to get it to use durability when on, rather than swinging? Just thinking, have not tested/tried anything....for a chainsaw/auger, it’s power is from gas, and it’s durability (how long it lasts before it is broken) is lowered when you hit trees/blocks with it. A flashlight doesn’t hit anything when it’s “on”... or could it? Could it be like a chainsaw where it’s constantly “mining” or hitting “air blocks”? It obviously will not destroy the air blocks, but it could be a target? It seems the existing model for chainsaw/auger and “gas=battery” might be possible if actual batteries in how the game is using electrical items doesn’t pan out (where “on” = calculating time and power to run down the battery/item) Link to comment Share on other sites More sharing options...
CrazyAluminum Posted October 22, 2020 Author Share Posted October 22, 2020 10 minutes ago, doughphunghus said: Just thinking, have not tested/tried anything....for a chainsaw/auger, it’s power is from gas, and it’s durability (how long it lasts before it is broken) is lowered when you hit trees/blocks with it. A flashlight doesn’t hit anything when it’s “on”... or could it? Could it be like a chainsaw where it’s constantly “mining” or hitting “air blocks”? It obviously will not destroy the air blocks, but it could be a target? It seems the existing model for chainsaw/auger and “gas=battery” might be possible if actual batteries in how the game is using electrical items doesn’t pan out (where “on” = calculating time and power to run down the battery/item) But what about the flashlight for the weapons, and headlights? Link to comment Share on other sites More sharing options...
doughphunghus Posted October 22, 2020 Share Posted October 22, 2020 Hmmmm, I really don’t know I don’t know what happens if they are mods to other items. Like if they are literally just flashlight “items” attached to the gun/helmet and this are turned on/off as if you were holding them, or if there’s some special place in the code for mods/attachments. If they are just “attached” and still flashlights, and they worked by “mining” air blocks would they not then begin degrading themselves? I’m betting it doesn’t work like that. Of course, battery mods to vehicles can lose quality while inserted into the vehicle. Sorry!, just speculating about possible workarounds while at work Link to comment Share on other sites More sharing options...
CrazyAluminum Posted October 23, 2020 Author Share Posted October 23, 2020 18 hours ago, doughphunghus said: Hmmmm, I really don’t know I don’t know what happens if they are mods to other items. Like if they are literally just flashlight “items” attached to the gun/helmet and this are turned on/off as if you were holding them, or if there’s some special place in the code for mods/attachments. If they are just “attached” and still flashlights, and they worked by “mining” air blocks would they not then begin degrading themselves? I’m betting it doesn’t work like that. Of course, battery mods to vehicles can lose quality while inserted into the vehicle. Sorry!, just speculating about possible workarounds while at work Definitely need a completely new slot for these things, modifiers and durability reduction will definitely not work Link to comment Share on other sites More sharing options...
Iceburg71 Posted October 28, 2020 Share Posted October 28, 2020 I so want this to work. infinite lights has always bugged me. Thought about trying to write a mod to do it. I have other ideas am working on though, so never started this. Let me know if I can help in anyway. I would love to see this. Link to comment Share on other sites More sharing options...
CrazyAluminum Posted October 29, 2020 Author Share Posted October 29, 2020 On 10/22/2020 at 11:43 PM, doughphunghus said: Hmmmm, I really don’t know I don’t know what happens if they are mods to other items. Like if they are literally just flashlight “items” attached to the gun/helmet and this are turned on/off as if you were holding them, or if there’s some special place in the code for mods/attachments. If they are just “attached” and still flashlights, and they worked by “mining” air blocks would they not then begin degrading themselves? I’m betting it doesn’t work like that. Of course, battery mods to vehicles can lose quality while inserted into the vehicle. Sorry!, just speculating about possible workarounds while at work What do you think about vehicle_part_slot in controls.xml? Link to comment Share on other sites More sharing options...
doughphunghus Posted October 31, 2020 Share Posted October 31, 2020 On 10/29/2020 at 9:48 AM, CrazyAluminum said: What do you think about vehicle_part_slot in controls.xml? I’ll check it out when I can I haven’t had power for a few days where I live (ice storm) and it may be a few more before it comes on. Update: @CrazyAluminumI looked at that and I'm not sure what you mean. Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.