Page 1 of 1

Request: code to add buildings that autoproduce units

Posted: Thu May 19, 2016 8:42 am
by noobmapmaker
Back in the days I used to play Z. If you dont know it, check this youtube movie with gameplay.

In Z the players capture territories by walking onto a flag. If a productionfacility happens to be in that territory it will start producing units. They don't cost money, they just pop out periodically (and sometimes you can set the factory to producing tanks or switch to infantry groups if you want to).

Just like an oil derrick I think it would be pretty nice to have some kinds of weird barracks or a little town on maps that engineers can capture. If you have captured them they will produce an infantry every 1 minute, for example.

So who is able to write code that changes a Neutral Barrack (or the prison or whatever building) into a CAPTURABLE building that PERIODICALLY spits out a unit? It would be a nice addition to maps, just like the oild derricks.

Posted: Thu May 19, 2016 9:23 am
by Henry_the_Slav
I think I can do it in lua. If you check how units are produced in missions, it would be same loop, but always calling itself at the end, and it would have to check for owner at the time unit is to be created. Otherwise it would be a copy of barracks code-wise.

Posted: Thu May 19, 2016 12:32 pm
by Graion Dilach
I'm actually planning to code a trait like that to reimplement ZH Reinforcement Pads. Notsure if I'd commit it up to upstream OpenRA though, it sounds out of scope for the main project.

That and I have no idea atm how messy it'll look in the end. Besides, I also tend to be slow on actually implementing the things I plan and do want to do, so take this with a grain of salt.

Posted: Thu May 19, 2016 3:47 pm
by noobmapmaker
No rush, do important stuff first!

Ill open it as a feature in github for the map editor. Think it really is a fun addition, just like the oil derrick is a nice monetary aid, this would be a small reinforcement aid.

But how should they work? Generate random infantry? Or always rifle? Or a warfactory: what kind of tank?

Would be great if there was a visual feature that shows that it is a reinforcementbuilding.

Posted: Tue May 24, 2016 12:43 pm
by Mike_
Hi !
Two years ago i have coded first part of my idea:
http://www.sleipnirstuff.com/forum/view ... torder=asc

It looks like "slow z". This Mod was based on TD official mod.
And it does'nt work now (

Here is Lua from this mod. It produced different units for different buildings types:
https://yadi.sk/d/jCtr1mO7rxFVM
(chose English language in the bottom)

When player selected another unit to produce - lua replaced selected building )))

----------

Developers of OpenRa core refused to implement some little (several lines of code !) functions in the OpenRa core for my "map-mod", so now i found Unity3d indie developers to implement my ideas.

Posted: Tue May 24, 2016 12:54 pm
by Mike_
traits to implement ExternalCapturable in CnC mod (for E1 infantry):

defaults.yaml
---------------

^Building:
........ExternalCapturable:
........ExternalCapturableBar:


infantry.yaml
----------------
E1:
........ ExternalCaptures:
................Type: building


(replace dots to tabs)

Posted: Tue May 24, 2016 2:41 pm
by Graion Dilach
Well, yeah, because you were unreasonable, Mike. I was there, you remember? You demanded everything in an instant and was unwilling to take compromises or anything alike that. You refused to listen first.

Posted: Wed May 25, 2016 9:04 am
by Mike_
Graion, sorry, but i can't remember the details of our conversations (((
It was long ago and i had conversations with several developers.

I asked for two things:
1. Create trait in CnC mod, , that unit's weapon damage can depend on unit's current helth.
2. Create possibility to overwrite terrain type for some terrain tiles in "mod-map"


But there was another bad thing. After creating my mod version 0.1 I realized, that current OpenRA pathfinding model is bad for my mod. Units must not try to avoid other units. It works horrible in the battles near narrow mountain passes.


Now it's better to me finish my russian friend's Unity3d project. THis way i can understand what is good and wrong with my ideas.