There is the the idea of taking photos in my head. BorkBorkGoesTheCode and I want to try placing that in a mod. The question is if its possible at all?
Does the actual mechanics will allow it to wield an item (Camera) which generates a second item (Picture) by using it [via (A)ctivate or (f)ire)]. A simple example would be holding a Polaroid Camera, “fire” it at the corpse (e.g. Jaberwoock) and after that the char gets a “picture of a jabberwooks corpse”.
Is it possible to restrict some items to only show of by butchering a corpse with a special item?
Any ideas or comments are welcome. Lets brainstorm!
Not possible with jsons alone. It would need either C++ or Lua code to make it work.
Also, there are two ways to approach making photos: simple one and expensive one.
Simple one would be to save the description of the photo (“photo of zombie predator”, “photo of human corpse”, “photo of zombie predator over human corpse”).
Expensive would be to save the entire photographed critter/item in the photo, as json, like in save game.
Well, that answer was not unexpected. C++ or Lua are abouve my programming skills.
Both of your ideas are interesting. At the moment, I would say, the simple one will to it. Some days in the futer it might be necessary to switch to the second one. In the moment it depends much on the NPC and quest system.
In my mind a photography mechanic with cameras and pictures have a huge potential. First in questing as some kind of quest-item. It could also be a nice addition to the lore, like the newspaper pages or survival notes. And there are a lot more half-done ideas in my mind.
I have to speak with Bork. Maybe he has the required skills.
Thanks Coolthullu
I’m not good at lua, but there are good tutorials for basics. The problem is, lua mods can be hard to connect to the game if you don’t understand what is going on and how are the lua and C++ parts connected.
Tutorial at http://www.tutorialspoint.com/lua/index.htm looks pretty good.
It won’t cover the DDA lua interface obviously. For that, you will want to check out the sample mod in doc/sample_mods/lua_manhack_iuse
As for C++, it all depends on what you already know.
If you already understand Java, you would only really need to understand new syntax and pointer syntax (no pointer arithmetic, we don’t do that in DDA) to be able to write sensible code.
If you understand C, you need to learn objective programming to understand what’s going on.
It would be a good idea to set up compiling environment first. There was a thread about doing that somewhere, not sure if it’s still up to date. It’s not really possible to contribute C++ code without being able to compile and test it first.
Thanks for your help. I did a little research on the topic and searched for every related information I could get. Some examples helped me to gain a basic understanding what lua could do. Unfortunatelly I noticed the lack of some informations about hard coded stuff. So maybe one of the devs could give me a hint on some questions and also correct me if I am wrong.
My first thoughts where about the type of a camera item. I want to add SLR-camera systems with a lot of replaceable equipment. This is similar to the modifications of guns ingame.
As far as I could see it would be possible to code a new “iuse” for an item, which is triggered by activate it ingame. Is the same possible for weapons (or my camera)? If possible after the aiming?
Secondary at this point I want to ask if it’s possible to create a ‘new’ gun type, which would be “cameras”? Maybe with an extra skill? (like the arcana skill)
Can I interrupt the process of shooting with a ‘gun’? With a gun equipped you have to press f - then aim for the target - then press f again to shoot. Instead of the calculation for damage I need to execute a iuse-function.
I looked through the documentation and the code on github the last days. I was searching for an item which works already with some kind of modulation like the guns did. If I got it right the action of an item could be controlled by a new writen ‘iuse’.
So within my understanding it should be possible to write a new action (iuse) for a group of guns, which will be my cameras.
Is it only allowed to items with type “GUN” to have “valid_mod_locations”?
Yeah you are right.
In the code I read about that aiming ammo for vehicles (pointer fake ammo). I didn’t find a full functional system in my games yes. Will this ammo be consumed while shooting?
I found the flag “CUSTOM_EXPLOSION”. Is it possible to generate my own flag for an effect?
If an item has the custom_explosion flag the code will look to the ammo. With an extra flag I could trigger my action with lua?
All I need is a flag.
HelP?
^^ That was the last straw, now I have to go full lua.
I felt a bit sad because there are so few mods which add some scripts in lua. There is an example of 2013 with a modding prototype writen by CIB [link] I played a little around and replace the use_action “HICCUP” with my “ANALOG_CAMERA” (and the same in the main.lua file). But this throws an error every time I try to load a new game. With the original entries of hiccup everything is fine.
The example is now tree years old, so maybe there are some changes? The hiccup might work because of the preload.lua file in the main code.
Unfortunately I couldn’t found an other example which could give me the right syntax to use a lua file. The StatsThroughSkills mods didn’t work with use_action
I also crawled through the lua/class_definition.lua file. In combination with the lua from StatsThroughSkills I got a little into it.
There are the functions item:get_var and item:set_var. Does this mean I can create invisible variables with info of took pictures? And because I am a little confused about the conversation from the class_definition list to actual lua code: how exactly is the line of code to get/set this nonspecific var?