Get the opportunity to target objects other than units in cutscene controller

Post Reply
User avatar
WIZ4
Fast Inserter
Fast Inserter
Posts: 209
Joined: Thu Apr 07, 2016 1:36 pm
Contact:

Get the opportunity to target objects other than units in cutscene controller

Post by WIZ4 »

Hi Devs, using the cutscene controller, I can follow the unit using this code:

Code: Select all

global.waypoints = {}
function compilatron()
	local s = game.surfaces[1] 
	local non_colliding = s.find_non_colliding_position("compilatron", {0,0}, 10, 1) 
	local compilatron = s.create_entity{name = "compilatron", position=non_colliding, force="player"}
	global.waypoints[#global.waypoints+1] = {target = compilatron ,transition_time = 500,time_to_wait = 100}
end
Scre4enshot_11.jpg
Scre4enshot_11.jpg (42.89 KiB) Viewed 1173 times

Code: Select all

function cutscene(player_index)
game.players[player_index].set_controller{
	type = defines.controllers.cutscene,
	waypoints = global.waypoints, 
	final_transition_time = 300}
end	
But I cannot choose a player’s target or any other entitys:

Code: Select all

function character()
	global.waypoints[#global.waypoints+1] = {target = game.players[player_index].character ,transition_time = 500,time_to_wait = 100}
end
Screenshot_14.jpg
Screenshot_14.jpg (43.68 KiB) Viewed 1173 times

Code: Select all

function player()
	local s = game.surfaces[1] 
	local non_colliding = s.find_non_colliding_position("player", {0,0}, 10, 1) 
	local player = s.create_entity{name = "player", position=non_colliding, force="player"}
	global.waypoints[#global.waypoints+1] = {target = player ,transition_time = 500,time_to_wait = 100}
end
Screenshot_15.jpg
Screenshot_15.jpg (44.2 KiB) Viewed 1173 times
I immediately get an error:
Screenshot_16.jpg
Screenshot_16.jpg (15.85 KiB) Viewed 1173 times
In LuaSurface::set_multi_command, you can select any object in target.

Code: Select all

s.set_multi_command{
	command = {
		type=defines.command.attack,
		target=game.players[1].character, 
		distraction=defines.distraction.by_enemy},
unit_count = 1,
unit_search_distance = 2000}
So, why don't we get the same for cutscene controller?
My native language is russian. Sorry if my messages are difficult to read.

Bilka
Factorio Staff
Factorio Staff
Posts: 3155
Joined: Sat Aug 13, 2016 9:20 am
Contact:

Re: Get the opportunity to target objects other than units in cutscene controller

Post by Bilka »

Okay, added for the next version.
I'm an admin over at https://wiki.factorio.com. Feel free to contact me if there's anything wrong (or right) with it.

User avatar
WIZ4
Fast Inserter
Fast Inserter
Posts: 209
Joined: Thu Apr 07, 2016 1:36 pm
Contact:

Re: Get the opportunity to target objects other than units in cutscene controller

Post by WIZ4 »

You are wonderful!
My native language is russian. Sorry if my messages are difficult to read.

Post Reply

Return to “Implemented mod requests”