Red Alert: Tiberium Origins MOD

Information and discussion for custom maps and mods.
User avatar
Sleipnir
Posts: 878
Joined: Wed Apr 10, 2002 11:52 pm
Contact:

Post by Sleipnir »

Take a look at GDI01 for setting up the gunboat like you want.

The GDI02 / NOD01 / NOD03 missions have also been scripted in lua, and can be found one directory up from there.

You can set initial stances, and also specify specific activities like hunt from within the map script.

kaneCVR
Posts: 93
Joined: Tue Dec 10, 2013 9:20 pm

Post by kaneCVR »

Sleipnir wrote: Take a look at GDI01 for setting up the gunboat like you want.

The GDI02 / NOD01 / NOD03 missions have also been scripted in lua, and can be found one directory up from there.

You can set initial stances, and also specify specific activities like hunt from within the map script.
Can you provide a bit of code as an example? From GDI01 I could only find a simple script where the gunboat spawned, moved to the edge, dissapeared and came back for another run - it seems to involve two scripts. I need something really simple:

- an actor, say Actor01: 3tnk needs to patrol between Waipoint01 and Waypoint02. It moves from one point to another. See below:

Here is a picture of Nod Mission 02:

Image

I also attached the Mission to this post... details are below:

Briefing

Brother, the prophet Kane has tasked you with the capture of the Voroshilov weapons research and production facility. With this asset, the Brotherhood will be able to stage attacks all through Europe, and fulfill our leader's vision. Locate the base and capture the Forward Command Center.

You will be deployed near a small town servicing the facility. "Persuade" the civilians to "relocate" by any means available, and establish a base at that location. Our newest experimental weapon, the Devil's Tongue flame tank will be made available to you during this mission.

For the Brotherhood!

What I need scripted:

- Mission briefing displayed before mission starts
- Mission accomplished: Capture FCOM (forward command centre)
- Mission failed: Destroy the above mentioned buildings / lose your base.
- Soviet AI will deploy attacks at 4 minute intervals, consisting of three 3tnk, two E4 and three E1.
- Soviet AI must attempt to rebuild destroyed base defences and buildings.
- Soviet units patrol the area like shown in the picture above.


if anyone could provide a bit of code for these functions, I will be forever in your debt (an of course, you will be mentioned in the credits :D)


Could you please provide some traits for a given actor in the map script? So far, I only got:

Actor Name: Actor type (from rules.ini)
Location: x,y
Owner:
Health:
Facing:
SubCell:

What can I add to this to make a unit guard an area (it moves to attack an enemy unit it detects) - because so far they just stay there. They will attack if you are in range, but they will not pursue, and if you attack with a unit that has a longer weapon range, it will just sit there with it's turret pointed at the attacker :(

Also, the AI in campaign mode seems to do NOTHING. How can I get it to start building units, replace destroyed buildings and stuff like that? Can I assign a multiplayer hacky@ai to it?[/img]

After looking trought Allies03 mission, I noticed it has a 'MissionObjectivesPanel". Also found a reference to that trait in the Traits page for openra, but no arguments / instructions on how to use it. Where do I add the mission briefing? How do I use the MissionObjectivesPanel?
Attachments
nod02.oramap
(11.49 KiB) Downloaded 377 times

User avatar
zypres1
Posts: 276
Joined: Mon Oct 24, 2011 8:22 pm

help in irc

Post by zypres1 »

come to irc to get some help

Matt
Posts: 1144
Joined: Tue May 01, 2012 12:21 pm
Location: Germany

Post by Matt »

kaneCVR wrote: - Mission briefing displayed before mission starts
- Mission accomplished: Capture FCOM (forward command centre)
- Mission failed: Destroy the above mentioned buildings / lose your base.
- Soviet AI will deploy attacks at 4 minute intervals, consisting of three 3tnk, two E4 and three E1.
- Soviet AI must attempt to rebuild destroyed base defences and buildings.
- Soviet units patrol the area like shown in the picture above.
We currently don't have briefings and not yet established a best practice on how to integrate HackyAI (build base, train units, attack once amassed an army) into missions without getting it out of hand.

However have a look at https://github.com/OpenRA/OpenRA/blob/b ... ission.lua for patrols and winning the mission by capturing a building.

I documented it at https://github.com/OpenRA/OpenRA/wiki/Map-scripting

kaneCVR
Posts: 93
Joined: Tue Dec 10, 2013 9:20 pm

Post by kaneCVR »

Cmd. Matt wrote:
kaneCVR wrote: - Mission briefing displayed before mission starts
- Mission accomplished: Capture FCOM (forward command centre)
- Mission failed: Destroy the above mentioned buildings / lose your base.
- Soviet AI will deploy attacks at 4 minute intervals, consisting of three 3tnk, two E4 and three E1.
- Soviet AI must attempt to rebuild destroyed base defences and buildings.
- Soviet units patrol the area like shown in the picture above.
We currently don't have briefings and not yet established a best practice on how to integrate HackyAI (build base, train units, attack once amassed an army) into missions without getting it out of hand.

However have a look at https://github.com/OpenRA/OpenRA/blob/b ... ission.lua for patrols and winning the mission by capturing a building.

I documented it at https://github.com/OpenRA/OpenRA/wiki/Map-scripting
"Actor.OnCaptured" victory condition seems to not be implemented in the latest release (OpenRA-release-20131223). Debugger spits out an error when I use it in mission.lua - i get - attempt to call string "OnCaptured" (a nil value)

Actor.OnKilled works fine.

kaneCVR
Posts: 93
Joined: Tue Dec 10, 2013 9:20 pm

Post by kaneCVR »

There is an "Objectives" Tab in Allies 03 mission - how do I get that to work? Could not find a mission.lua for Allies03, and the map.yaml calls a

MissionObjectivesPanel:
ObjectivesPanel: MISSION_OBJECTIVES

but I could not find the briefing text for said panel anyware, and inserting the above code in my map.yaml crashes the game...

User avatar
Sleipnir
Posts: 878
Joined: Wed Apr 10, 2002 11:52 pm
Contact:

Post by Sleipnir »

The objectives code is part of the legacy C# scripting, and hasn't been exposed to Lua yet.

Matt
Posts: 1144
Joined: Tue May 01, 2012 12:21 pm
Location: Germany

Post by Matt »

kaneCVR wrote: "Actor.OnCaptured" victory condition seems to not be implemented in the latest release (OpenRA-release-20131223). Debugger spits out an error when I use it in mission.lua - i get - attempt to call string "OnCaptured" (a nil value)

Actor.OnKilled works fine.
Has been merged two weeks ago https://github.com/OpenRA/OpenRA/pull/4408 and will be in the next unstable playtest.

kaneCVR
Posts: 93
Joined: Tue Dec 10, 2013 9:20 pm

Post by kaneCVR »

I'll wait for the next release then.

kaneCVR
Posts: 93
Joined: Tue Dec 10, 2013 9:20 pm

Post by kaneCVR »

In one mission, I need four actors killed to win the mission (General1, General2, General3 and General4). How would I go about scripting this?

If I script using the examples:

Actor.OnKilled(General1, MissionAccomplished)
Actor.OnKilled(General2, MissionAccomplished)
Actor.OnKilled(General3, MissionAccomplished)
Actor.OnKilled(General4, MissionAccomplished)

The mission ends as soon as I kill any of them. How can I make it so they all have to die to win the mission?

User avatar
Sleipnir
Posts: 878
Joined: Wed Apr 10, 2002 11:52 pm
Contact:

Post by Sleipnir »

Allies-01-classic has an example of that:

Code: Select all

	labGuardsTeam = Team.New({ LabGuard1, LabGuard2, LabGuard3 })
	Team.AddEventHandler(labGuardsTeam.OnAllKilled, LabGuardsKilled)

kaneCVR
Posts: 93
Joined: Tue Dec 10, 2013 9:20 pm

Post by kaneCVR »

That worked like a charm. I used:

Code: Select all

    MustBeKilledTeam = Team.New({ General1, General2, General3, General4, Leader, Comm1, Comm2, Tech1, Tech2 }) 
   Team.AddEventHandler(MustBeKilledTeam.OnAllKilled, MissionAccomplished)

I still cannot figure out how to make units patrol an area. I know how to make an actor, say Patrol1 move to a waypoint (say PatrolPointA), but I can't find a way to make Actor.Patrol1 move to another waypoint (say PatrolPointB) when it reaches ParolPointA.Location... I need it to keep moving between the two waypoints... It's getting very frustrating...

I used:

Code: Select all

Actor.Move( PatrolT1, Patrol1WA.Location )
Where Actor PatrolT1 moves to Waypoint Patrol1WA - but I need a piece of code that make Actor PatrolT1 move to waypoint Patrol1WB when it reaches Patrol1WA, and when it reaches waypoint PatrolWB to move back to Patrol1WA...

How do I establish an interaction between an actor and a location - that triggers said actor to move to another location? Code example or a function trait name would be awsome...

UPDATE

So I figured out I can que actions for actors, but how do I get this script to LOOP?

Code: Select all

Actor.AttackMove( PatrolT1, Patrol1WB.Location )
Actor.AttackMove( PatrolT1, Patrol1WA.Location )
As it is, the actor moves to Point B, then to Point A, then stops... is there a way to loop these?

Angusm3
Posts: 33
Joined: Fri Oct 18, 2013 2:00 am

Post by Angusm3 »

you can get it to loop by pointing to a function() that points back to it after it finishes

like this:

Code: Select all

Patrol1 = function()
[tab]Actor.AttackMove( PatrolT1, Patrol1WB.Location )
[tab]Patrol2()
end

Patrol2 = function()
[tab]Actor.AttackMove( PatrolT1, Patrol1WA.Location )
[tab]Patrol1()
end
and you can get help faster if you go and ask in the IRC you know, right?
Last edited by Angusm3 on Fri Jan 24, 2014 7:51 pm, edited 1 time in total.

User avatar
Sleipnir
Posts: 878
Joined: Wed Apr 10, 2002 11:52 pm
Contact:

Post by Sleipnir »

You can loop things by putting into a function that calls itself once the actors have completed the loop. Something like:

Code: Select all

LoopPatrol = function(actor, waypoints)
	Utils.Do(waypoints, function(waypoint)
		Actor.AttackMove(actor, waypoint.Location)
	end)
	Actor.CallFunc(actor, function() LoopPatrol(actor, waypoints) end)
end
which you can trigger by calling:

Code: Select all

LoopPatrol(PatrolT1, { Patrol1WA, Patrol1WB })
I suspect we will want to move this (or something similar) into the standard library.

kaneCVR
Posts: 93
Joined: Tue Dec 10, 2013 9:20 pm

Post by kaneCVR »

This got it working - Thanks guys!

Code: Select all

LoopPatrol = function(actor, waypoints) 
   Utils.Do(waypoints, function(waypoint) 
      Actor.AttackMove(actor, waypoint.Location) 
   end) 
   Actor.CallFunc(actor, function() LoopPatrol(actor, waypoints) end) 
end

WorldLoaded = function()
	player = OpenRA.GetPlayer("Nod")
	Allies = OpenRA.GetPlayer("Allies")
	Gdi = OpenRA.GetPlayer("Gdi")
	LoopPatrol(PatrolT1, { Patrol1WB, Patrol1WA })
	LoopPatrol(PatrolT2, { Patrol1WB, Patrol1WA })
end

Post Reply