Adding map to tutorial scenario

Can you help improve your favourite game? Hardcore C mages, talented artists, and players with any level of experience are welcome!
Post Reply
udawos
Posts: 5
Joined: Wed Jun 02, 2021 9:18 pm

Adding map to tutorial scenario

Post by udawos »

How can I add a pre-made map from another scenario to the tutorial scenario?

I tried just pasting the [map] section into the tutorial .sav file but that didn't work.
udawos
Posts: 5
Joined: Wed Jun 02, 2021 9:18 pm

Re: Adding map to tutorial scenario

Post by udawos »

Essentially the end state I want to reach is to create scenarios with more scripting, and working with the tutorial seems like a good base because all the scripts seem to work there.

Some scripts seem to work in other scenarios, but not reliably. For example, if I take the 1750 Start scenario and put this script:
function tutorial_turn_callback(turn, year)
if turn == 1 then
notify.event(nil, nil, E.SCRIPT,
_("Welcome to Freeciv. You lead a civilization. Your\ntask is to conquer the world! You should start by\nexploring the land around you with your explorer,\nand using your settlers to find a good place to build\na city. Use the number pad to move units around."))
end
end
signal.connect('turn_begin', 'tutorial_turn_callback')

in the

[script]
code=$

$

It won't execute if pasted into the 1750 start scenario. More testing indicated that it doesn't seem to work in any scenario other than the tutorial scenario, where most other scripts seem to work fine. What might be getting in the way of this?

What I *really* want to do is re-create the old World of Jules Verne from Civ 2 inside FreeCiv, and the only real barrier I can see to that is unlocking the secret of scripting in FreeCiv.


I'm aware of the https://freeciv.fandom.com/wiki/Event_Scripting page, and it's great. All the code there can be pasted in reliably and it will function. But the fact I can't take the turn == 1 code from the tutorial to create a basic 'welcome' message in a scenario is something I find vexing.

I've attached the file as a rar if you want to look at it.
Attachments
Start_1750_CE.rar
(51.5 KiB) Downloaded 149 times
cazfi
Elite
Posts: 3069
Joined: Tue Jan 29, 2013 6:54 pm

Re: Adding map to tutorial scenario

Post by cazfi »

Code: Select all

> freeciv-server --warnings -f Start_1750_CE.sav
gives a lot of warnings and errors. The most important part seems to be

Code: Select all

1: lua error:
	[string "script.code"]:16: Signal "turn_begin" does not exist.
stack traceback:
	: in field 'connect'
	[string "script.code"]:16: in main chunk

	    13:	_("Welcome to Freeciv.  You lead a civilization.  Your\ntask is to conquer the world!  You should start by\nexploring the land around you with your explorer,\nand using your settlers to find a good place to build\na city.  Use the number pad to move units around."))
	    14:	  end
	    15:	end
	--> 16:	signal.connect('turn_begin', 'turn_cal
The tutorial scenario has:

Code: Select all

signal.connect('turn_started', 'turn_callback')
udawos
Posts: 5
Joined: Wed Jun 02, 2021 9:18 pm

Re: Adding map to tutorial scenario

Post by udawos »

Yeah, it's weird. Start_1750_CE is the only one I've seen so far where I can't paste the code directly in and have it work.

If I take, for example, the Hagworld map and copy-paste the tutorial code in exactly, it works in Hagworld no problem.

Is there some other setting or map types that will mess with scripts and prevent them from running properly?
Attachments
hagworld.rar
(13.13 KiB) Downloaded 140 times
Post Reply