d2k sietch on custom map

help request to spawn fremen

Information and discussion for custom maps and mods.
User avatar
Carnildohtar
Posts: 13
Joined: Wed Apr 02, 2025 3:01 pm

d2k sietch on custom map

Post by Carnildohtar »

Greetings to everyone.

I am mostly a single player of openRa for Dune 200, and I like to make some minor mods to add to my custom maps and skirmish play.
I am not a programmer, so writing the code from zero for me is something i am unable to do, but until now I have managed to modify the code to obtain what I liked fro my play (for example sturdier walls, turrets more effective agains infantry and minor changes such these).

I would like to make the otherwise useless sietch spawn fremen who will attack random player (player or AI).
Until now, trough trial and error i managed to copy and paste the code that let the Atreides palace spawn free fremen, but there are two issues i can't solve:

1) now the sietch have the sprite of the palace, and i cannot change it in any way, and I have seen that the appearence is related to the RenderSprites section, but eliminating it or changing it with anything different from faction-specifici building result in the game crashing.

2) if in my map I assign the Sietch (or any production building) to a neutral faction ot the creeps, it does nothing, it builds nothing. This i can try to circumvent assigning the building to a multiplayer out of the map, but if there is a simple solution I would gladly accept it.


Asking primary help for the sietch aspect issue, I thank anyone willing to help me, or at least helping me understand if the problem has a simple solution or if it is deeply rooted.

JovialFeline
Posts: 12
Joined: Mon May 15, 2023 12:58 pm

Re: d2k sietch on custom map

Post by JovialFeline »

Some thoughts:

1) RenderSprites in the default rules often has no Image set because it defaults to the name of the actor. In this case, you may want to specify the Sietch image.

2) You mentioned copying the Palace, and that building's production requires power. Have you given the Creep/Neutral player power or removed the power requirement for the Sietch?

I'll build a test map later to check if I've forgotten something. Did, but it seems that was pointless.
Last edited by JovialFeline on Sat Apr 05, 2025 4:14 am, edited 2 times in total.

User avatar
Carnildohtar
Posts: 13
Joined: Wed Apr 02, 2025 3:01 pm

Re: d2k sietch on custom map

Post by Carnildohtar »

I reply in inverse order, since the second thought is simplier:
The code is simply enough for such things, and under the power i set the amount to 20 (as a construction yard).
In the test map the creep faction simply does not build or spawn anything, even if I give it a prebuilt base.

For the first thought is is out reach for me to fully understand.
- If I delete the lines for RenderSprites (the original sietch does not have any specification) the game crashes (as i try to load a testing map the game crashes)
- If i leave the palace entries, the sietch appear as a palace, but it functions as intended (except for the creep faction, who seems to not use any building)
- If I change the RenderSprites with any from the "sequences\structures.yaml" that is not house specific (e.g. walls) the game crashes. -> I have tried the entry in that file because it is the only I have found. I mean, I searched the palace.atreides, palace.harkonnen etc entry listed in RenderSprites in all the files, to find where it is and try so substitute it with other things and experiment.
- If I change the RenderSprites with a faction specific from the "sequences\structures.yaml", i can open the editor with the test map and the assigned sprites appear correctly, but when I try to playtest the map the game crashes (I have tried with the barracks)
- If i change the sprites with the sietch (i think that the sprite is listed in the "rules\arrakis.yaml") but as soon as i try to load the map in the editor the game crashes. The same happens if I copy-paste the sietch entry in the "sequences\structures.yaml" file.

For what i understand how the code works, it is all that comes in my mind to test in try and error. I thought it would be far more easyer to change the appearence, but my understanding of the code and programming is completely lacking (consider me a boomer who punch the printer to solve any problem) and I appreciate any suggestion. i only hope that my idea isn't impossible.
Thank you for any help!

Adrian
Posts: 135
Joined: Wed Feb 12, 2020 5:44 pm

Re: d2k sietch on custom map

Post by Adrian »

(...) to make the otherwise useless sietch spawn fremen who will attack random player (player or AI).
Actually, it can be done in a completely different way.
Do you interested just to find error with Palace only?

---

UPD. Are Fremen must belong to player or to enemy?

User avatar
Carnildohtar
Posts: 13
Joined: Wed Apr 02, 2025 3:01 pm

Re: d2k sietch on custom map

Post by Carnildohtar »

Actually, it can be done in a completely different way.
I had also the idea to make it function like a barrack, but the AI would not train anything even if i put the sietch to produce energy and set the cost of the fremen units to zero.

So for my capabilities i have run out of ideas.
Do you interested just to find error with Palace only?
Since up to now the palace way has been the most succesful (even if not completely working) attempt, I think it could be the easiest way, at least for me, to copy-paste an already functioning code.
UPD. Are Fremen must belong to player or to enemy?
Assigning them to a player I think would be too unbalancing and breaking off the lore flavour.
It would be great to have them belong to a neutral and hostile to all faction, but i fear that this case will imply to write and implement an AI for them.

The best workaround i have found is to create maps where a player have only a starting point on the map border and where the Construction yard cannot move, and give them only the sietch as a building.

Adrian
Posts: 135
Joined: Wed Feb 12, 2020 5:44 pm

Re: d2k sietch on custom map

Post by Adrian »

Assigning them to a player I think would be too unbalancing and breaking off the lore flavour.
I think so too.
That's why I asked that question.
It would be great to have them belong to a neutral and hostile to all faction
Now I understand your aim. I'll think and answer later.

About palace.
Maybe you can show some code with the Palace?
I don't promise, but maybe I can do something...

Adrian
Posts: 135
Joined: Wed Feb 12, 2020 5:44 pm

Re: d2k sietch on custom map

Post by Adrian »

As a solution option.

Just simplified general idea.

You can create Fremen with command Create.
(!) Without any resources! So for player side it is too imbalanced.

-------------------------------------

You can write in lua file something like this.
In Tick function.

Code: Select all

-- my creation of the fremen
if DateTime.GameTime % DateTime.Seconds(7) == 0 then
	soldat = Actor.Create("nsfremen", true, { Owner = Atreides, Location = FrEntry.Location })
	soldat.AttackMove(soldat.Location + CVec.New(1, 1))
	soldat.Stance="AttackAnything"
end 
Some explanation.

Actually the code can be modified into more complex (if needed).

DateTime.Seconds(7) :
time (period) of unit appearing. NB! It is very short! just for test, but not for game.

Location = FrEntry.Location :
Fremen Entry. Visually — place over Sietch. In program — object "waypoint" named "FrEntry". Look at Map Editor.
I give the link to source code below.

Owner = Atreides :
Here it is simply the same faction as enemy in general.
I suppose it can be made more complex.

soldat.AttackMove :
We can to set here attack direction.
In my program, fremen just moves at one square of map, from Sietch.

soldat.Stance="AttackAnything" :
Unit is ready to find and attack anything nearby.

----------

Example of map with Sietch.
Based on the map "Harkonnen 03b".
Harkonnen vs Atreides.
https://resource.openra.net/maps/63185/

------------

Is something unclear?
Last edited by Adrian on Thu Apr 03, 2025 11:08 pm, edited 1 time in total.

User avatar
Carnildohtar
Posts: 13
Joined: Wed Apr 02, 2025 3:01 pm

Re: d2k sietch on custom map

Post by Carnildohtar »

Ok, i'll answer in order. it will be a long post, if you want to skip the things i have tryed to make so far, scroll until the red line.
About palace.
Maybe you can show some code with the Palace?
I don't promise, but maybe I can do something...
That is what i have taken from the code, and what i have understood about it.
ietch:
Inherits: ^Building
Inherits@PRIMARY: ^PrimaryBuilding
Tooltip:
Name: actor-sietch-name
RallyPoint:
CommandBarBlacklist:
DisableStop: false
D2kBuilding:
Footprint: xx xx
Dimensions: 2,2
TerrainTypes: Cliff
Health:
HP: 60000
Armor:
Type: wood
RevealsShroud:
Range: 10c0
RenderSprites:
Image: palace.ordos
FactionImages:
atreides: palace.atreides
fremen: palace.atreides
harkonnen: palace.harkonnen
corrino: palace.corrino
WithBuildingBib:
HasMinibib: True
WithSupportPowerActivationOverlay:
RequiresCondition: !build-incomplete && !launchpad-damaged && harkonnen
GrantConditionOnDamageState@LAUNCHPADDAMAGED:
Condition: launchpad-damaged
Power:
Amount: 20
PrimaryBuilding:
RequiresCondition: atreides || ordos
WithTextDecoration@primary:
RequiresCondition: primary && (atreides || ordos)
ProduceActorPower@fremen:
Name: actor-palace.produceactorpower-fremen-name
Description: actor-palace.produceactorpower-fremen-description
Icon: fremen
PauseOnCondition: disabled
Actors: fremen, fremen
Type: Fremen
ChargeInterval: 2250
EndChargeTextNotification: notification-fremen-ready
ReadyAudio: Reinforce
ReadyTextNotification: notification-reinforcements-have-arrived
BlockedAudio: NoRoom
BlockedTextNotification: notification-no-room-for-new-unit
OrderName: ProduceActorPower.Fremen
SupportPowerPaletteOrder: 20
Exit@1:
SpawnOffset: 0,0,0
ExitCell: 0,2
Exit@2:
SpawnOffset: 0,0,0
ExitCell: 1,2
Production@Atreides:
Produces: Fremen
RequiresCondition: atreides
Production@Ordos:
Produces: Saboteur
RequiresCondition: ordos
GrantConditionOnFaction@Atreides:
Condition: atreides
Factions: atreides, fremen
GrantConditionOnFaction@Harkonnen:
Condition: harkonnen
Factions: harkonnen
GrantConditionOnFaction@Ordos:
Condition: ordos
Factions: ordos, mercenary, smuggler
SupportPowerChargeBar:
RequiresCondition: atreides || harkonnen || ordos
ProvidesPrerequisite@buildingname:
Inherits: ^Building
Inherits@PRIMARY: ^PrimaryBuilding
Tooltip:
Name: actor-sietch-name
RallyPoint:
CommandBarBlacklist:
DisableStop: false
D2kBuilding:
Footprint: xx xx
Dimensions: 2,2
TerrainTypes: Cliff
Health:
HP: 60000
Armor:
Type: wood
RevealsShroud:
Range: 10c0
This part is where it tells that the palace has the base characteristics of a generic building (described in another file), but "Inherits@PRIMARY" and "CommandBarBlacklist" are two entries which i haven't understood, so i does not touched them. The others give information about space occupied, health, armour, and the area in wich it eliminates the fog of war.
RenderSprites:
Image: palace.ordos
FactionImages:
atreides: palace.atreides
fremen: palace.atreides
harkonnen: palace.harkonnen
corrino: palace.corrino
Here lies the main source of my problem, i cannot eliminate or change this without dire consequences (crashes)
WithBuildingBib:
HasMinibib: True
WithSupportPowerActivationOverlay:
RequiresCondition: !build-incomplete && !launchpad-damaged && harkonnen
GrantConditionOnDamageState@LAUNCHPADDAMAGED:
Condition: launchpad-damaged
"HasMinibib" is completely in the land of darkness, while the subsequent lines i think are related to the missile not gettin launched if the palace is damaged, i haven't tried to touch this part yet.
Power:
Amount: 20
PrimaryBuilding:
RequiresCondition: atreides || ordos
WithTextDecoration@primary:
RequiresCondition: primary && (atreides || ordos)
Beside the "Power" entry wich regulates the amount of power the building require/give, i have not idea of the function of the rest.
ProduceActorPower@fremen:
Name: actor-palace.produceactorpower-fremen-name
Description: actor-palace.produceactorpower-fremen-description
Icon: fremen
PauseOnCondition: disabled
Actors: fremen, fremen
Type: Fremen
ChargeInterval: 2250
EndChargeTextNotification: notification-fremen-ready
ReadyAudio: Reinforce
ReadyTextNotification: notification-reinforcements-have-arrived
BlockedAudio: NoRoom
BlockedTextNotification: notification-no-room-for-new-unit
OrderName: ProduceActorPower.Fremen
SupportPowerPaletteOrder: 20
This is the palace power, i left only the Fremen spawning, i have seen i can change the type of unit and theyr number, but most of its inner functions are pure esoteric Omnissaiah secrets.
Exit@1:
SpawnOffset: 0,0,0
ExitCell: 0,2
Exit@2:
SpawnOffset: 0,0,0
ExitCell: 1,2
this is the exit point of the units, trough trial and error i managed to fix it from the center of the sietch (when i simply copy-pasted the barrack code)
Production@Atreides:
Produces: Fremen
RequiresCondition: atreides
Production@Ordos:
Produces: Saboteur
RequiresCondition: ordos
GrantConditionOnFaction@Atreides:
Condition: atreides
Factions: atreides, fremen
GrantConditionOnFaction@Harkonnen:
Condition: harkonnen
Factions: harkonnen
GrantConditionOnFaction@Ordos:
Condition: ordos
Factions: ordos, mercenary, smuggler
SupportPowerChargeBar:
RequiresCondition: atreides || harkonnen || ordos
ProvidesPrerequisite@buildingname:
For me this is totally beyond the grasp of my comprehension, the Omnissaiah denied me the access to this knowledge. I have tried to delete this, but the game crashes, so i left it here.

______________________________________________________________________________________________________________________________
As a solution option.

Just simplified general idea.
(editing right now...)

You can create Fremen with command Create.
(!) Without any resources! So for player side it is too imbalanced.
Before your post i didn't even know what a lua file is. I'll try to copy your code and see if i can do it, looking at the map you linked.
And i thank you very much, at least I owe you an aperitif if you stumble near Venice.

Maybe I'll take me some try, your reply is clear, but my only programming attempt was with a teacher so bad that makes me refusing to learn even the most basics of C++


EDIT

I have made some tries on the map you linked.
The fremen appear exactly as intended, but then tey remain idle near the sietch, I looked at the lua file, but it is a bit too complicated (at least now, is the first time i look at this kind of files).

As for the owner (set to Atreides) does that mean that if i play with an Atreides opponent the spawned fremen belongs to him, and are no more enemy to all?

Adrian
Posts: 135
Joined: Wed Feb 12, 2020 5:44 pm

Re: d2k sietch on custom map

Post by Adrian »

As for the owner (set to Atreides) does that mean that if i play with an Atreides opponent the spawned fremen belongs to him, and are no more enemy to all?
In this case — yes.
I made (quickly) most simple variant.

Maybe I will think later about separate faction for Fremen.

-----
The fremen appear exactly as intended, but then tey remain idle near the sietch (...)
And again, I made most simple variant. As example.
So... you have no enough programming experience, unfortunately. So a hint was not enough.

First solution. We can change the line, where is "AttackMove".
Second solution. There is a function Hunt in these games (OpenRa).
Maybe later I will write how...
Last edited by Adrian on Thu Apr 03, 2025 11:07 pm, edited 3 times in total.

User avatar
Carnildohtar
Posts: 13
Joined: Wed Apr 02, 2025 3:01 pm

Re: d2k sietch on custom map

Post by Carnildohtar »

Maybe I will think later about separate faction for Fremen.
Creating the script for an entire faction for my perspective is quite long, and maybe it has to be integrated in the game mechanics. This seem a long work to do, there isn't a simplier way?
You can write in lua file something like this.
In Tick function.

Code: Select all

-- my creation of the fremen
if DateTime.GameTime % DateTime.Seconds(7) == 0 then
soldat = Actor.Create("nsfremen", true, { Owner = Atreides, Location = FrEntry.Location })
soldat.AttackMove(soldat.Location + CVec.New(1, 1))
soldat.Stance="AttackAnything"
end
Besides I have understood how your code works but creating a lua file and the other files (such as seen in your map) is beyond my capabilities.
The files you created for the mission map are full of codes specific for the map (missions, triggers, reinforcments, etc), and I do not understand what to keep in the map I create.

EDIT
you have no enough programming experience
Sadly, yes. You can say I have no experience at all. I have attended schools too much time ago (and Italy is always too late into implementing such kind of studies), and the necessity/pleasure of modding came to me at an age plagued by the ignorance of programming.

So I have to stick to simpler solution, and if I am unable to do something, I have to wait until someone more capable come with an idea similar to mine.

User avatar
Carnildohtar
Posts: 13
Joined: Wed Apr 02, 2025 3:01 pm

Re: d2k sietch on custom map

Post by Carnildohtar »

Project update

IT! COULD! WORK!

Ok, after another couple of hours of trial and error, i have managed to make the sietch work like the atreides palace, with the correct sprite, and for all three houses.

The code very likely is far from perfect, since i have tried to delete some pieces here and there, but it seems to work.

The only problem is that when on a map the sietch is assigned to a player or a bot, it produces the Fremen as expected, but if it is owned by the Creep and Neutral factions, they will not spawn anything.

For now i have solved this problem assigning the sietch to an extra player (bot) with only a spawning location in an impassable corner of the map (reachable by weapons to be destroyed and let the game to end) and the sietch.

the next step would be to make the neutral faction able to produce fremen and attack (not needing a starting position and to be controlled by a bot), but this task is far outside the border of my comprehension, since a mere copy-paste will be largely insufficient.

I consider my idea far from completed, but this is the best of what i can do with my current skills, i thank Adrian for the help and invaluable insight (without this i would have abandoned all hope so far), so if any better idea or course of action is viable, i would gladly accept it, for now being able only to test it.

Adrian
Posts: 135
Joined: Wed Feb 12, 2020 5:44 pm

Re: d2k sietch on custom map

Post by Adrian »

i thank Adrian for the help and invaluable insight
You're welcome.
Modding is a kind of game also, for me. An entertaiment, when I have free time.

i have managed to make the sietch work like the atreides palace, with the correct sprite, and for all three houses.
It would be interesting for me to see it already :-)
Would you like to upload the map here?
https://resource.openra.net/

If this is not diificult for you, of course.
(It needs registration. And it makes pause before uploading, during several hours, first time only.)

Adrian
Posts: 135
Joined: Wed Feb 12, 2020 5:44 pm

Re: d2k sietch on custom map

Post by Adrian »

If it's still interesting, I made new map. Player is Harkonnen.
In Lua. Sorry, topicstarter Carnildohtar, — it's much shorter and easier for me, than in Yaml. :-)

https://resource.openra.net/maps/63203/

------------------------------------------------------------------------------------------------------------

Fremen are "creeps" here.
So they are hostile for both sides: Atreides and Harkonnen.

Code: Select all

	Atreides = Player.GetPlayer("Atreides")
	Harkonnen = Player.GetPlayer("Harkonnen")
	Fremen = Player.GetPlayer("Creeps")
I began to write more complex and big scenario... but who is need it? :-)

So... main idea is — Fremen are semi-neutral. They have own sector of desert and control it.
They don't attack Atreides and Harkonnen bases normally. Just defend own land.

I use command "Patrol".

Code: Select all

soldat.Patrol({AtreidesRally6.Location, AtreidesRally7.Location, AtreidesRally4.Location}, true, DateTime.Seconds(5))
Fremen are patrolling, going of the rounds along the chain of the waypoints. And they meet and fight Atreides there.
So this is advantage for player (Harkonnen).
A player just must avoid this sector. It is slightly difficult, but possible.

------------------------------------------------------------------------------------------------------

If player wants more agressive manner from Fremen, then he can change Patrol to Hunt, in source code.

Code: Select all

soldat.Hunt()
------------------------------------------------------------------------------------------------------

Total number of Fremen.

Sietch produces 20 Fremen (total number) during 2 minutes (120 sec). One soldier for 6 sec.

Code: Select all

	if (DateTime.GameTime % DateTime.Seconds(6) == 0)  
	and (DateTime.GameTime < DateTime.Seconds(120))
	then
		soldat = Actor.Create("nsfremen", true, { Owner = Fremen, Location = FrEntry.Location })
   (...)

Of course, it is possible to add some reinforcements (with some conditions), but that's all, still.

Adrian
Posts: 135
Joined: Wed Feb 12, 2020 5:44 pm

Re: d2k sietch on custom map

Post by Adrian »

Code: Select all

Besides I have understood how your code works but creating a lua file and the other files (such as seen in your map) is beyond my capabilities.
Some basics of the Lua.
Tick function, etc.

https://github.com/cookgreen/Yuris-Reve ... g-Tutorial

Adrian
Posts: 135
Joined: Wed Feb 12, 2020 5:44 pm

Re: d2k sietch on custom map

Post by Adrian »


Post Reply