Page 1 of 1
[RA] Start without MCV? (only prebuilt barracks)
Posted: Sat Mar 25, 2017 10:46 am
by xy
Hey
I'm working on a map with only infantry, and since it's a small map I don't want a clumsy MCV since there's no need for it anyway.
Is it possible to make a map with no MCV? and only access to the prebuilt barracks.
And then give some power so the players don't have low power, but without the power buildings.
Thanks in advance
Posted: Sat Mar 25, 2017 11:41 am
by MustaphaTR
You can edit rules in a map, changing the starting settings and power usage of barracks would be enough. I'm not sure if a building can be a starting unit, if not you can make MCV deploy to a barracks.
If you don't know how to add map specific code you can check some modmaps on resource site. For example this:
http://resource.openra.net/maps/19284/
Posted: Sat Mar 25, 2017 1:19 pm
by KOYK_GR
I assume you know how to edit an oramap,and how to create a rules file in side the map.
so use this code in your rules.yaml file in side your map.
Code: Select all
World:
MPStartUnits@mcvonlysov:
Class: none
ClassName: Construction Yard
Factions: soviet, russia, ukraine
BaseActor: barr
MPStartUnits@mcvonlyally:
Class: none
ClassName: Construction Yard
Factions: allies, england, france, germany
BaseActor: tent
-MPStartUnits@mcvonly:
-MPStartUnits@lightallies:
-MPStartUnits@lightsoviet:
-MPStartUnits@heavyallies:
-MPStartUnits@heavysoviet:
BARR:
Power:
Amount: 200
TENT:
Power:
Amount: 200
Be aware that you need to use the "TAB" key for spacing the words and not the spacebar.
example:
TENT:
"TAB"Power:
"TAB""TAB"Amount: 200
(i hope that this example makes sense)
If you have any more questions or you don't know how to edit your map,just ask here.
Posted: Sat Mar 25, 2017 3:56 pm
by xy
@KOYK_GR
EDIT: Nevermind! it works

I fucked up the indentation..
Thanks!!!
Posted: Sat Mar 25, 2017 4:21 pm
by xy
Now: Is it possible to set the start cash to $500 ? I searched the game's yaml files but couldn't find it anywhere.
Posted: Sat Mar 25, 2017 5:44 pm
by Blackened
I think playing around with this should do it.
Code: Select all
Player:
PlayerResources:
DefaultCash: 500
Posted: Sat Mar 25, 2017 6:33 pm
by xy
Blackened: Thanks!
This worked:
Code: Select all
Player:
PlayerResources:
SelectableCash: 500
DefaultCash: 500
Posted: Sat Mar 25, 2017 7:48 pm
by KOYK_GR
xy wrote: ↑@KOYK_GR
EDIT: Nevermind! it works

I fucked up the indentation..
Thanks!!!
happy to help out man.
Posted: Sun Mar 26, 2017 11:58 am
by xy
I need some help with Lua scripting
I want to know which team ID's are in the game, like Team 1 and Team 2 - or team 4 and team 3.
I have tried with this:
Code: Select all
players = Player.GetPlayers(nil)
for key, player in pairs(players) do
Media.DisplayMessage("Found a player! " .. player.Name)
end
But this returns 5 "players": me, neutral, creeps, bot and "everyone".
How can I filter actual players from via GetPlayers()?
My goal is to check if there's exactly 2 teams, and then at every 500 tick I'll message the points for each team.
I've made the triggers and it works, it just shows the wrong teams..
Does this make any sense?

Posted: Sun Mar 26, 2017 4:56 pm
by xy
Okay I figured it out:
Code: Select all
players = Player.GetPlayers(nil)
for key, player in pairs(players) do
if not player.IsNonCombatant then
Media.DisplayMessage("Found a player! " .. player.Name)
end
end
Posted: Sun Mar 26, 2017 5:40 pm
by xy
Sorry for spamming but need help again
How do I kill/destroy all players in a team?
I tried this:
Code: Select all
function kill_team(team_id)
-- Get all players in the team.
for key, player in pairs(players) do
if not player.IsNonCombatant and player.Team == team_id then
-- Kill all actors owned by the player.
local actors = player.GetActors()
for key, actor in pairs(actors) do
actor.kill()
end
end
end
end
but I got an error:
Code: Select all
Actor 'player' does not define a property 'kill'
Is there a more simpler way to do it?
Posted: Sun Mar 26, 2017 5:49 pm
by MustaphaTR
Doing that makes you try to kill the actual "Player:" actor too, you should try to filter it out somehow, i'm not sure how exactly tho.
https://github.com/OpenRA/OpenRA/issues/13006
Posted: Sun Mar 26, 2017 7:27 pm
by abcdefg30
xy wrote: ↑How do I kill/destroy all players in a team?
[...]
Is there a more simpler way to do it?
You should give them own objectives and mark them as failed (look at the missions on how to do that, or ask [me] again for a more detailed explanation).
If you want to destroy all units of a player, you can use something like
Code: Select all
local actors = Utils.Where(Map.ActorsInWorld, function(actor)
return actor.Owner == player and not actor.IsDead
end)
Utils.Do(actors, function(unit)
unit.Kill()
end)
inside your "for" loop.
Posted: Tue Mar 28, 2017 10:59 am
by xy
abcdefg30 wrote: ↑
You should give them own objectives and mark them as failed (look at the missions on how to do that, or ask [me] again for a more detailed explanation).
Thanks! I made it work with MarkFailedObjective for the failing team and MarkCompletedObjective for the winnig team.