Show Posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.


Topics - CodeSeg

Pages: [1]
1
The Toolbox - Code Help / Questions about generating items in Lua
« on: September 29, 2017, 05:39:10 AM »
Now I know how to use lua to define a use action function, and what I want to do next is to generate items dynamically in lua, is that possible?

The first thing I thought is artifacts. They are generated dynamically in game instead of parsing json data. What I want to achieve is to generate different weapons, randomlizing their size, weight, damage, material and other attributes. But I don't know how to do it in lua or even if it is possible... Is it about wrapping (artifact) class variables/functions? Or should I generate a json obj in lua dynamically and parse it into an item?

Any help would be appreciated. Thanks!

2
The Toolbox - Code Help / Questions about register_iuse in LUA
« on: September 27, 2017, 09:59:58 AM »
I'm very optimistic about LUA scripts in mods. So I'm trying to use LUA to create a new mod. I'm starting with "register_iuse", but I have some problem figuring out the details.
If I defined a iuse function in Lua, then what will the key/value be in json data? For example, we can implement an iuse function in Lua, which has the exact same effect with "transform" use action, right?
Code: [Select]
"use_action": {
         "menu_text": "Expand",
         "type": "transform",
         "target": "baton-extended",
         "msg": "You snap open your baton."
},
I couldn't find any existing code using this method. And I have tried to figure it out on my own, but could you please show some guidance about it? A little hint about which codes I should read is also appreciated. Thanks a lot!!

3
I got an idea for a new kind of city, quarantined city, just like the Raccoon City in Resident Evil.

These cities are where the zombie virus firstly outbreak. The government tried to quarantine those cities to stop the cataclysm and obviously they failed.

The cities are totally surrounded by very high and thick walls, and there are only a few checkpoints for getting in or out. These checkpoints are usually guarded by soldiers (already became zombies) and turrets. The item spawn rate is higher inside the cities, because no survivor has looted these city since they can't get in. But the zombie spawn rate is also higher since no one has ever got out.

To implement this idea, I think a few new kinds of map sites should be added: the walls and checkpoints.
The walls take a whole block and there might be some secret passages inside the walls. Similar to roads the walls have 8 different directions.
The checkpoints stands where roads and walls cross. There is a main gate controls by a console, so that your vehicle can get through.

My English is not very good, so sorry for possible grammar mistakes :)

4
Currently, the effects of the artifacts are hard coded in the enums.h and artifact.h. I thought, to separate logic from data, maybe we should create an artifact.json which contains all the data of the artifacts?

That idea came to me when I was trying to add an item "Powered Exoskeleton" in my mod. The Exoskeleton is designed to have "Strength +1" effect when worn and turned on. I thought some artifacts have the effects to modify player's stats and the Powered Exoskeleton could be implemented as an artifact. However, I couldn't find related json files, and I wander whether it is okay to create one? Creating artifact.json also allows customizing messages when the effects are trigged.

BTW, I find the "effect" class very powerful. Great extensibility as well as wonderful functionality. So maybe add an effect field to the item class? (I only read a few codes of the project, so I wander whether this is a proper suggestion to make...  :)
Thanks!

5
DDA中文讨论 / 怎么给衣物添加“力量+1”特性?
« on: July 08, 2016, 08:29:19 AM »
如题。我想通过mod添加一个叫做“动力外骨骼”的物品,穿上之后会有力量增加等特性。然而我怀疑并没有相关的接口可用.....
某些神器能够增加属性(以及其他buff和debuff),然而这些buff是写死的,详见src/enums.h line 95-139, 枚举类art_effect_passive。这些buff:1.没有可扩展性,不能添加新的自定义的效果;2.严格来讲属于神器的属性,而普通物品并不属于神器的类;3.在使用(穿戴)时会强制输出文字“力+4”、“速+20”等,这些不能取消,也不能自定义(其实还是可扩展性的问题)。因此这个方法,虽然能够给“动力外骨骼”添加力量增加的效果,却很不优雅....
然后我想用effect类来实现,然而并不能为衣物添加effect,更不用说在穿戴的时候才出发的被动effect。但effect这个类本身非常好,可以自定义各种effect,和相应的文字输出,甚至可以用实现清除其他effect的功能。
看了酷炫的RM13的实现,,居然是写死在代码里的,好失望~
不知各位有何高见?

6
Currently, the features which vehicle parts might have are limited. A vehicle part could have one or more flags in
Code: [Select]
KITCHEN, FAUCET, WELDRIG, CRAFTRIG, FORGE, CHEMLAB, CARGObut not ones added in mods. I designed a new tool with a new flag "CHEMLAB_ADVANCED" and realized I couldn't design a new vehicle part having the same tool feature.
So I thought allowing defining new vehicle parts' FLAG in mods might be a cool idea.
For example, a large keg installed allows you to make wine while you are driving around. :)

Pages: [1]