TalonStarr Posted July 20, 2015 Share Posted July 20, 2015 I am attempting to add some realism to some weapons I am making for rp and want to create something like consumable ammunition that must be replenished from an exterior source. Such as getting more filled magazines for a pistol. Scripting wise what will I be needing to accomplish this? Link to comment Share on other sites More sharing options...
Sassy Romano Posted July 20, 2015 Share Posted July 20, 2015 A counter that when it gets to the limit, says "buy more ammo". Counter resets when more has been purchased. Link to comment Share on other sites More sharing options...
Nova Convair Posted July 20, 2015 Share Posted July 20, 2015 Tsk. Have you ever heard a gun saying "buy more ammo"? It makes a clicking noise! It's not that trivial. - you need a gun script and modify it so every shot decreases the ammo counter. Gun scripts usually have ammo counters - you need to take out the reload function then. - you need clips (no mod, no copy) and think about the handling. It's SL so you cant put the clip into the gun. Maybe just attach the clip. The clip then needs to communicate with your gun. Gun set ammo counter to clip size. Clip sets clip counter to 0. It would be great the clip doesn't become depleted if you are not wearing a gun or the gun already has ammo left. So there is some small stuff to script to make handling easy and foolproof. Communication to the right gun required. Easy since gun and clip have the same owner. - remove litter (depleted clip) Link to comment Share on other sites More sharing options...
Sassy Romano Posted July 20, 2015 Share Posted July 20, 2015 What wasn't clear to me was what the actual problem was. What I was getting at is that being consumable has no special requirement other than maintaining a counter about what's left and then what to do about it when depleted. As for not being trivial, the "gun" that we did (well my partner did) for our role play environment was probably the most ridiculously over engineered product of all. It used raytracing so no need to faff about with requiring rez permission in order to rez bullets. No real issue there since we have llCastRay. Ammunition was bought as a product which when rezzed, would increment a record of ammunition in a SQL database, externally hosted. The gun would initialise by reading the database for ammunition count, plus all the other gun variables as every part of the gun was defined in the SQL database and externally adjustable beyond the script through a web admin console. The gun would detect attachment to either left or right hand and use the appropriate animation for left or right hand hold. When a victim was "shot" (in our case a tranquiliser dart), a list of RLV commands were sent and "stuff happened". Oh and the database was decremented of a dart being shot. There was more but that's about the scope of "non trivial". I guess the issue that the OP has is how to make it "consumable" and not just able for someone to reset the script and get back unlimited ammunition? That was my point, I don't know what we're solving here because the original question wasn't detailed enough for me to understand what problem needed solving. Link to comment Share on other sites More sharing options...
Innula Zenovka Posted July 20, 2015 Share Posted July 20, 2015 Just to add the the new Key-Value Pairs (KVP) facility in Experience Tools makes this sort of thing even easier. No need to maintain external databases to hold your records of how much ammuntion is available -- just read and update the appropriate KVP via the dataserver. Link to comment Share on other sites More sharing options...
Xiija Posted July 20, 2015 Share Posted July 20, 2015 Sassy has a good point about resetting the script. from the llRezObject page .. http://wiki.secondlife.com/wiki/LlRezObject ** If the owner of the object does not have copy permission on inventory, the object will no longer be present in inventory after it is rezzed (so another attempt to rez (the same object) will fail); ** One could sell ammo clips with 20 bullets in them, and make the bullets NoCopy , so they would only rez till they are gone from inventory, and then the gun could give the "out of ammo" msg / sound? Link to comment Share on other sites More sharing options...
Recommended Posts
Please take a moment to consider if this thread is worth bumping.
Please sign in to comment
You will be able to leave a comment after signing in
Sign In Now