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.


Messages - CodeSeg

Pages: [1]
1
Other Games / Re: What are you currently playing ? (Mandatory topic)
« on: October 11, 2017, 08:53:12 AM »
Middle-Earth: Shadow of War. Awesome.

2
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!

3
The Toolbox - Code Help / Re: Questions about register_iuse in LUA
« on: September 27, 2017, 02:27:36 PM »
Wow, that helps a lot! Thank you very much @Zhilkin ! I'll have a try right away :)

4
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!!

5
Then maybe more military staffs? More policemen, SWATs or even national guards and army troopers were sent to maintain order.  And there are burnt houses, artillery pits and crashed helicopters due to the riot.

6
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 :)

7
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!

8
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的实现,,居然是写死在代码里的,好失望~
不知各位有何高见?

9
Check out data/json/vehicleparts/engineering.json
It has tool qualities on vehicle parts.
I mean, what about new tools that consume power?
For example, I designed a tool named Advanced Chemistry Set(has lv3 "CHEM" quality), which is used to make Methanol and other chemicals added in my mod. And I want to implement a similar vehicle part which consumes vehicle's power. However, when deciding tools on a vehicle, only these flags are checked: KITCHEN, FAUCET, WELDRIG, CRAFTRIG, CHEMLAB and CARGO.
Here's the codes in inventory.cpp, line 468:
Code: [Select]
        const int kpart = veh->part_with_feature(vpart, "KITCHEN");
        const int faupart = veh->part_with_feature(vpart, "FAUCET");
        const int weldpart = veh->part_with_feature(vpart, "WELDRIG");
        const int craftpart = veh->part_with_feature(vpart, "CRAFTRIG");
        const int forgepart = veh->part_with_feature(vpart, "FORGE");
        const int chempart = veh->part_with_feature(vpart, "CHEMLAB");
        const int cargo = veh->part_with_feature(vpart, "CARGO");
        if (cargo >= 0) {
            // ...
        }
        if(faupart >= 0 ) {
            // ...
        }
        .....

Earlier today, I saw your idea about separating "engine" and "game" and making the core game into a "core mod". It is really a great idea!
And it will definitely solve my problem, right? :)

10
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. :)

11
DDA中文讨论 / Re: 嗯,贴吧来的过来打个招呼?
« on: June 29, 2016, 07:27:47 AM »
Hello! 我是贴吧的HelloWorld_cpp。贴吧里一直潜水,这边也一直潜水。。。。

12
Well, I've built something like that.... First, I built stone walls around my home location; then built a house lacking one tile of the walls; and then I built a strange vehicle named "Basement" inside the house, which extended outside through the missing tile of the wall. I installed a chem lab, a mini refrigerator, a FOODCO kitchen buddy, an electric forge and some cargo spaces on the inside part  of Basement. On the outside part of Basement, there are lots of solar panels and a funnel for collecting rain. And it's super convenience! In the evening, I can even turn the floodlight on without considering battery consumption.

//Hello, I'm new here and I ain't a native speaker of English... I'm sorry for possible grammar or spell mistakes...
//BTW, how can I add a picture here?

Pages: [1]