[RA] Start without MCV? (only prebuilt barracks)

I'm working on a map with only infantry

Information and discussion for custom maps and mods.
Post Reply
xy
Posts: 11
Joined: Wed Mar 02, 2016 4:06 pm

[RA] Start without MCV? (only prebuilt barracks)

Post 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

User avatar
MustaphaTR
Posts: 203
Joined: Mon Aug 04, 2014 6:38 am
Location: Kastamonu, Turkey

Post 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/

User avatar
KOYK_GR
Posts: 68
Joined: Fri Aug 26, 2011 12:46 pm

Post 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.

xy
Posts: 11
Joined: Wed Mar 02, 2016 4:06 pm

Post by xy »

@KOYK_GR


EDIT: Nevermind! it works :) I fucked up the indentation..
Thanks!!!
Last edited by xy on Sat Mar 25, 2017 4:47 pm, edited 1 time in total.

xy
Posts: 11
Joined: Wed Mar 02, 2016 4:06 pm

Post 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.

User avatar
Blackened
Posts: 347
Joined: Sat May 21, 2016 6:27 pm

Post by Blackened »

I think playing around with this should do it.

Code: Select all

Player:
	PlayerResources:
		DefaultCash: 500

xy
Posts: 11
Joined: Wed Mar 02, 2016 4:06 pm

Post by xy »

Blackened: Thanks!
This worked:

Code: Select all

Player:
	PlayerResources:
		SelectableCash: 500
		DefaultCash: 500

User avatar
KOYK_GR
Posts: 68
Joined: Fri Aug 26, 2011 12:46 pm

Post by KOYK_GR »

xy wrote: @KOYK_GR


EDIT: Nevermind! it works :) I fucked up the indentation..
Thanks!!!
happy to help out man.

xy
Posts: 11
Joined: Wed Mar 02, 2016 4:06 pm

Post 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? :)

xy
Posts: 11
Joined: Wed Mar 02, 2016 4:06 pm

Post 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

xy
Posts: 11
Joined: Wed Mar 02, 2016 4:06 pm

Post 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?

User avatar
MustaphaTR
Posts: 203
Joined: Mon Aug 04, 2014 6:38 am
Location: Kastamonu, Turkey

Post 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

abcdefg30
Posts: 643
Joined: Mon Aug 18, 2014 6:00 pm

Post 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.

xy
Posts: 11
Joined: Wed Mar 02, 2016 4:06 pm

Post 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.

Post Reply