Run a Lua function when game initializes

I have the same firewall settings. I don't remember what else I did to get it working. Maybe it's a problem with your home network? I'm running a windows 7 home network.
 
I think I have a similar issue, I can get the test function working on game start but not my function (movesettlers) anybody knows why?

Code:
-- Lua Script1
--------------------------------------------------------------


local trackarg1 = nil;
local trackarg2 = nil;
local trackarg3 = nil;
local trackarg4 = nil;
local moveai = 0;


function utrack (arg1, arg2, arg3, arg4)

    trackarg1 = arg1;
    trackarg2 = arg2;
    trackarg3 = arg3;
    trackarg4 = arg4;

    local player = Players[ arg1 ];
    local unit = player:GetUnitByID( arg2 );
	local hx, hy  = ToGridFromHex( trackarg3, trackarg4 );
    local plot = Map.GetPlot(hx, hy);            
	unit:SetXY(hx, hy);

end


function validplot (pciv,unittag,arg1,arg2)
  
    valid = 0;
	iterations =0;
	local hx, hy  = ToGridFromHex( arg1, arg2 );
	
	local plot = Map.GetPlot(hx, hy);
	
	--not owned
	if ( not plot:IsOwned() ) then
	  --is passable
	  if ( not plot:IsImpassable() ) then
		--is land
		if ( not plot:IsWater() ) then
			--has no units
			if ( plot:GetNumUnits()==0 ) then
				valid=1;
			end
		end
	  end
	end
	print(valid);

	if (valid==0) then
	    --choose another random spot
		local iW, iH = Map.GetGridSize();
		--validplot (rand)
		posx = math.random (1,iW);
		posy = math.random (1,iH);		
		validplot (pciv,unittag,posx,posy);		
	else
		--order move unit		
		utrack (pciv,unittag,arg1,arg2);		
	end
end


function movesettlers ()
	    local player = Players[ 0 ];            
                for unit in player:Units() do                    					
					if (string.find( unit:GetName(), 'Settler') ) then
						local iW, iH = Map.GetGridSize();						
						--validplot (rand)
						posx = math.random (1,iW);
						posy = math.random (1,iH);
						validplot (0,unit:GetID(),posx,posy);
					end
                end            
end
Events.SequenceGameInitComplete.Add ( movesettlers );


function realstart ()
                print("Really really just started a game!");
end
--Events.SequenceGameInitComplete.Add ( realstart );
 
Pretty smart for a smellymummy. :) I bet that's it.

Incidentally, tho I haven't been able to get gameinit to output to the lua console, I thought I saw it mentioned in the lua code somewhere while I was looking for something else. Probably in InGame.lua. Anyway, tho I didn't look closely, I got the sense that the base files themselves call gameinit and the lack of an error suggests gameinit is functioning properly for the base files. <scratch head>

Maybe I'll try experimenting with it sometime today.
 
fairly sure init comes before the initial settler creation. easy to test with onunitcreated

but anyhow, since finding that gameinit crashes when using it in lua scripts loaded through entrypoints i'm just not using it at all anymore. instead, game initialization can be done with checks/loops/whathaveyou outside of functions so they are ran when the game loads up the lua for the first time
 
Code:
-- first let the game read in objects
local a = 0;

function init ()
    print( "Hello World!" );
end

-- now that those are processed, the script can use those 
if ( a == 0 ) then
    init();
end
 
I have found these two events that could be the ones you are looking for?

Event.GameplaySetActivePlayer
Launched sometime after all mods and game files are loaded. I think in single player it's only launched once, but that might change in multiplayer?

Event.LoadScreenClose
Launched after the user presses that "Begin your journey" button.
 
Hello,

PROBLEM DESCRIPTION
I have made a map script for multiplayers games. This script has some important additional setting in Advance Menu. I would like to show this setting to all players. I try to show it by popup windows with text description of all setting but I cant even lunch print function as Event at game start.

this is my code
Spoiler :
Code:
function realstart ()
     print("====Really really just started a game!");
end

Events.SequenceGameInitComplete.Add ( realstart );
Events.GameplaySetActivePlayer.Add ( realstart );
Events.LoadScreenClose.Add ( realstart );
LuaEvents.DisplayMessage("test3");

I try to use DisplayMessage by alpaca

Spoiler :
Code:
--[[
	MessagePopup.lua
	
	Creator: alpaca
	Last Change: 27.01.2011
	
	Description: 
	Creates an event to display a generic pop-up message with a title and a text. Copies a lot of code from GenericPopup.lua
]]--


-- Shows popup window.
function ShowWindow()
	ResizeWindow();
	UIManager:QueuePopup( ContextPtr, PopupPriority.GenericPopup );
end

-- Hides popup window.
function HideWindow()
    UIManager:DequeuePopup( ContextPtr );
    ClearChildren();
end

function ResizeWindow()
    Controls.ButtonStack:CalculateSize();
	Controls.ButtonStackFrame:DoAutoSize();
end

function AddText(popupText)
	local instance = {}
	ContextPtr:BuildInstanceForControl("MessageLabelInstance", instance, Controls.ButtonStack)
	instance.MessageLabel:SetText(popupText)
	instance.MessageLabel:SetHide(false)
end

function SetPopupTitle(popupTitle)
	if popupTitle then
		Controls.PopupTitle:SetText(popupTitle);
		Controls.PopupTitle:SetHide(false);
	else
		Controls.PopupTitle:SetHide(true);
	end
end

function ClearChildren()
	Controls.ButtonStack:DestroyAllChildren();
	ResizeWindow();
end

-- Add a button to popup.
-- NOTE: Current Limitation is 4 buttons
function AddButton(buttonText, buttonClickFunc, strToolTip)
	local instance = {}
	ContextPtr:BuildInstanceForControl("MessageButtonInstance", instance, Controls.ButtonStack)
	local button = instance.MessageButton --Controls["Button"..i];
	
	if button then
		local buttonLabel = instance.MessageButtonText
		buttonLabel:SetText( buttonText );
		
		if strToolTip then
			button:SetToolTipString(strToolTip);
		end

		--By default, button clicks will hide the popup window after
		--executing the click function
		local clickHandler = function()
			if buttonClickFunc then
				buttonClickFunc();
			end
			
			HideWindow();
		end
		
		button:RegisterCallback(Mouse.eLClick, clickHandler);
		
		button:SetHide(false);
		
		return;
	end
end


function ShowHideHandler( bIsHide, bIsInit )
	if bIsInit or bIsHide then
		Controls.ButtonStackFrame:SetHide(true)
	else
		Controls.ButtonStackFrame:SetHide(false)
	end
end
ContextPtr:SetShowHideHandler( ShowHideHandler );


--[[
	Displays a pop-up with a custom set-up.
	Arguments:
		fSetupFunction: function. Function that sets up all the buttons and texts itself
]]--
function DisplayPopup(fSetupFunction)
	fSetupFunction()
	ShowWindow()
end
LuaEvents.DisplayPopup.Add(DisplayPopup)


--[[
	Displays a pre-made message pop-up
	Arguments:
		sText: string. Text to display. Required
		sTitle: string. The title, will default to "Message"
		tButtons: table. A table containing the buttons you want to display. Table keys are what to put on the button label, values is a tooltip (use false if you don't want one). Optional use: string. Interpreted as text for a single button, in which case tButtonIDs is interpreted as an optional tooltip and tHandlers as a callback function
		tButtonIDs: table. A numeric table containing an ordered list of buttons if desired
		tHandlers: table. Click handler functions for the buttons. Must be indexed by the key
]]--
function DisplayMessage(sText, sTitle, tButtons, tButtonIDs, tHandlers)
	ClearChildren()
	AddText(sText)
	SetPopupTitle(sTitle)
	if type(tButtons) == "table" then
		-- buttons are given
		if tButtonIDs then
		-- ordered list
			for _, buttonText in ipairs(tButtonIDs) do
				local handler
				if tHandlers then
					handler = tHandlers[buttonText] or nil
				end
				local tooltip = tButtons[buttonText] and tButtons[buttonText] or nil
				AddButton(tostring(buttonText), handler, tooltip)
			end
		else
		-- unordered list
			for buttonText, buttonTip in pairs(tButtons) do
				local handler
				if tHandlers then
					handler = tHandlers[buttonText] or nil
				end
				AddButton(tostring(buttonText), handler, buttonTip and tostring(buttonTip) or nil)
			end
		end
	elseif type(tButtons) == "string" then
		-- only one button, interpret as strings
		AddButton(tButtons, tHandlers, tostring(tButtonIDs))
	else
		AddButton(Locale.ConvertTextKey("TXT_KEY_CLOSE"))
	end
	ShowWindow()
end
LuaEvents.DisplayMessage.Add(DisplayMessage);

RESULT:
No popup window, no print result in LineTuner during singleuser tests. No error info. Nothing,

QUESTION:
1) Is it possible to add Events in map script?
2) How to transfer information about Advance Setting to all players. Maybe i can modify map details description?

Spoiler :

 

Attachments

  • mapdesc.jpg
    mapdesc.jpg
    48.1 KB · Views: 372
Double check your VFS settings?

It's kind of the first question for just about anything it seems. Like that first line in the trouble shooting guide of any wall powered product: Is the unit plugged in?

I have all debugoption on, i think.
config:
Spoiler :
[Debugging]

; Set to 1 to enable the fire tuner to connect to the game.
EnableTuner = 1

; Set remark levels (ex. /R0 /R1:Video - means all off except video level 1) (default "/R1"
Remarks = /R1

; Set remark log filename; empty for no remark log
RemarkLog =

; Sets a breakpoint on a specified object allocation order number (debug only).
CrtBreakAllocNum = 0

; Set to 1 to send FRemark output to the tuner
SendRemarksToTuner = 0

; Set to 1 to enable mem tracking when using a mem tracker build
EnableMemTrackerSystem = 0

; Set to 1 to do various embedded memory tracker dumps
DoMemTrackerDumps = 0

; Set to 1 to disable hotloading of objects
DisableHotLoader = 1

; Set to 1 to enable asserts in debug mode
EnableAsserts = 1

; Set to 1 to have loose files override PAK files if the loose file is newer
LooseFilesOverridePAK = 0

; Set to 1 to quiet D3D warning and leak msgs
D3D Mute = 0

; Sub-directory where the game code DLL resides, set to empty string to let the game decide
GameCoreSubDirectory =

[User Settings]

; Set to 1 to enable threaded submission to D3D11
Threaded Submission = 1

; This is capped at runtime to the number of logical processors
MaxSimultaneousThreads = 8

; Set to 1 to activate the debug panel
DebugPanel = 1

; How close you can get (11.0=default, 4.0=debug zoom)
Minimum Zoom Level = 10.000000

; Whether or not to use screen space terrain overlays
Use Screen Space Overlay = 1

; The currently selected steam language
SteamLanguage = english

; The currently selected language.
Language = en_US

; The currently selected spoken language.
AudioLanguage = en_US

; The URL to the Community Hub.
CommunityHubUrl = http://civ5.sake.gamespy.com/SakeStorageServer/FiraxisServices.asmx

; Set to 1 to disable Fall-back Language Support in the Localization System.
DisableFallbackLanguageSupport = 0

[MiniMap]

; Mini-map width.
Width = 320

; Mini-map height.
Height = 190

; Thickness of camera rectangle, in pixels
CameraRectThickness = 10.000000

; If ratio of explored area to visible region size is less than this (on both axes), do not draw camera rect.
CameraRectThreshold = 1.000000

; Extra space, in pixels, to leave on edge of explored region
ExploredRegionGutter = 20.000000

; Alpha value for fog
FogAlpha = 1.000000

[DisableSystems]

; Set to 1 to disable Terrain system
Terrain = 0

; Set to 1 to disable LandmarkSystem system
LandmarkSystem = 0

; Set to 1 to disable Overlay system
Overlay = 0

; Set to 1 to disable OverlayDebug system
OverlayDebug = 1

; Set to 1 to disable Decal system
Decal = 0

; Set to 1 to disable City system
City = 0

; Set to 1 to disable Unit system
Unit = 0

; Set to 1 to disable Forest system
Forest = 0

; Set to 1 to disable River system
River = 0

; Set to 1 to disable LeaderHead system
LeaderHead = 0

; Set to 1 to disable Audio system
Audio = 0

; Set to 1 to disable Combat system
Combat = 0

; Set to 1 to disable Particle system
Particle = 0

; Set to 1 to disable Projectile system
Projectile = 0

; Set to 1 to disable FOW system
FOW = 0

; Set to 1 to disable FluidFOW system
FluidFOW = 0

; Set to 1 to disable YieldIcons system
YieldIcons = 0

; Set to 1 to disable DistanceFog system
DistanceFog = 0

; Set to 1 to disable StrategicView system
StrategicView = 0

; Set to 1 to disable Minimap system
Minimap = 0

; Set to 1 to disable ColorKeyEdit system
ColorKeyEdit = 1

; Set to 1 to disable Waves system
Waves = 0

; Set to 1 to disable Arrows system
Arrows = 0

; Set to 1 to disable MovementPath system
MovementPath = 0

[TextKey Settings]

; Enable triggered sounds from units (3dsmax Note tracks) (default 1)
Enable markered sounds = 1

[Audio]

; Disable sounds from gamecore (also can set via tuner) (default 0)
Disable Sid Sounds = 0

; Enable in-game music (default 1)
Enable music = 1

; Ignore any variation cap settings (default 0) (Sound guys, set this to 1)
Disable audio variation cap = 0

[DEBUG]

; Enables stack-trace collection on random number generators and FAutoVariables. Slightly slower and uses more memory
EnableOutOfSyncDebugging = 0

; Set App on Auto-Run
Autorun = 0

; Number of turns to autorun before exiting (0 for no limit)
AutorunTurnLimit = 0

; Enable message logging
MessageLog = 1

; Rand event logging bitfield. bit 0 = on/off, bit 1 = log callstacks, bit 2 = log pregame calls, bit 3 = log asynchronous RNGs
RandLog = 0

; Enable synchronization logging
SynchLog = 0

; Enable AI logging
AILog = 0

; Enable Builder AI logging
BuilderAILog = 0

; Enable Serialization logging
SerializationLog = 1

; Enable Tutorial logging
TutorialLog = 0

; Enable Tutorial debug window
TutorialDebug = 0

; Split AI Logging into separate files for each Player & City
PlayerAndCityAILogSplit = 0

; Overwrite old network and message logs
OverwriteLogs = 1

; Enable the logging system
LoggingEnabled = 1

; upload assert logs and crash dumps to the server
UploadReports = 1

; Delete reports after uploading to the server
MoveReports = 1

; Show combat debugging overlays
CombatDebug = 1

; Controls the threading strategy: (0=default,1=no display lists,2=one DL per command set, 3=split mode, 4=aggregate mode)
ThreadingMode = 0

; Number of commands per diplay list to aim for in SPLIT and AGGREGATE thread modes
TargetJobSize = 100

[CONFIG]

; QuickStart - SinglePlayer games only!
QuickStart = 0

; Bandwidth options are modem or broadband
Bandwidth = broadband

; Number of seconds to accept live game list updates from GameSpy (-1 for initial snapshot only, 0 for no live updates
GameUpdateTime = 10

; Number of seconds the end turn timer counts before automatically ending the turn
EndTurnTimerLength = 10

; Random seed for game sync, or '0' for default
SyncRandSeed = 0

; Random seed for map generation, or '0' for default
MapRandSeed = 0

[GAME]

; In-game Alias
Alias = Nefliqus

; Email Address
Email = wrocmax@gmail.com

; Save Path - relative to working (Civ5) folder
FileName =

; Handicap for quick play
QuickHandicap = HANDICAP_CHIEFTAIN

; Blocks players from entering the city screen
CityScreenBlocked = 0

; How many turns between advisors showing up to help you out (0 means never!)
TurnsBetweenAdvisorCounsel = 0

; Allows the player to give right click movement movement orders while the camera is scrolling
AllowRClickMovementWhileScrolling = 0

; Force quick combat animations
QuickCombat = 1

; Game Name
GameName = My Game

; Worldsize options are WORLDSIZE_DUEL/WORLDSIZE_TINY/WORLDSIZE_SMALL/WORLDSIZE_STANDARD/WORLDSIZE_LARGE/WORLDSIZE_HUGE
WorldSize = WORLDSIZE_SMALL

; Climate options are CLIMATE_ARID/CLIMATE_TEMPERATE/CLIMATE_TROPICAL
Climate = CLIMATE_TEMPERATE

; Sealevel options are SEALEVEL_LOW/SEALEVEL_MEDIUM/SEALEVEL_HIGH
SeaLevel = SEALEVEL_MEDIUM

; Era options are ERA_ANCIENT/ERA_CLASSICAL/ERA_MEDIEVAL/ERA_RENAISSANCE/ERA_INDUSTRIAL/ERA_MODERN
Era = ERA_ANCIENT

; GameSpeed options are GAMESPEED_QUICK/GAMESPEED_STANDARD/GAMESPEED_EPIC/GAMESPEED_MARATHON
GameSpeed = GAMESPEED_STANDARD

; Victory Conditions
VictoryConditions = 11111111

; Game Options
GameOptions = EMPTY

; Max number of turns (0 for no turn limit)
MaxTurns = 0

; Allow AI in multiplayer games
EnableMultiplayerAI = 1

; GameType options are singlePlayer/spLoad
GameType = singlePlayer

; Map Script file name
Map = Assets/Maps/Continents.lua

[UserSettings]

; Last Civilization Played
LastCiv = -1

; Last Game Speed Played
LastSpeed = 3

; Last Map Type Played
LastMapScript = Assets\Maps\NOVAL_JAGA_v5_5plTESTY.lua

; Last Map Script Was Random
LastMapScriptRandom = 0

; Last Map Size Played
LastMapSize = 0

; Last Map Size Was Random
LastMapSizeRandom = 0

; Last Map Type Was Earth
LastMapWasEarth = 0

; Last Game Difficulty Played
LastDifficulty = 3



user ini
Spoiler :
[AutoSave]

TurnsBetweenAutosave = 10

NumAutosavesKept = 5

[GameSettings]

AutoWorkersDontReplace = 1

AutoWorkersDontRemoveFeatures = 1

NoCitizenWarning = 0

NoRewardPopups = 0

NoTileRecommendations = 0

CivilianYields = 1

NoBasicHelp = 0

StraightZoom = 0

GridOn = 1

ScoreList = 1

ResourceOn = 1

YieldOn = 1

PolicyInfo = 1

SkipIntroVideo = 1

Tooltip1Seconds = 150

Tooltip2Seconds = 500

DebugMode = 1

; Disables the advisor speech (GAME_ADVISOR_SPEECH volume knob)
DisableAdvisorSpeech = 0

SinglePlayerAutoEndTurnEnabled = 0

MultiplayerAutoEndTurnEnabled = 0

BindMouse = 0

[InterfaceSettings]

SmallUIAssets = 1

AutoUIAssets = 1

AutoUnitCycle = 1

[TutorialSettings]

TutorialLevel = -1

AdvisorBadAttackInterrupt = 1

AdvisorCityAttackInterrupt = 0

TutorialPopupSeen = 540

TutorialSeen_LowBits = 0

TutorialSeen_HighBits = 1024

[User Settings]

Music.Volume = 16

Effects.Volume = 17

Ambience.Volume = 52

Speech.Volume = 55



VFS result:

Spoiler :

Map Script: Map Generation - Placing Luxuries
Map Script: Map Generation - Normalize City State Locations
Map Script: >>>> Wheat on desert with river
Map Script:
Map Script: >>>> ================================== start DoMirrorPlayers ==================================
Map Script:
Map Script: --------Creating players lists:--------
Map Script: >>>> Player # 0 belongs to Team # 0 = teamWestID (WEST) Team position Err. 22
Map Script: >>>> Player # 1 belongs to Team # 1 = teamEastID (EAST) Team position ok 29
Map Script: >>>> Player # 2 belongs to Team # 1 = teamEastID (EAST) Team position Err. 6
Map Script: >>>> Player # 3 belongs to Team # 0 = teamWestID (WEST) Team position ok 15
Map Script: >>>> Player # 22 belongs to Team # 22 which is neither West nor East! Player is CS
Map Script: >>>> Player # 23 belongs to Team # 23 which is neither West nor East! Player is CS
Map Script: >>>> Player # 24 belongs to Team # 24 which is neither West nor East! Player is CS
Map Script: >>>> Player # 25 belongs to Team # 25 which is neither West nor East! Player is CS
Map Script: >>>> Player # 26 belongs to Team # 26 which is neither West nor East! Player is CS
Map Script: >>>> Player # 27 belongs to Team # 27 which is neither West nor East! Player is CS
Map Script: >>>> Player # 28 was DISCARDED!
Map Script: >>>> Player # 29 was DISCARDED!
Map Script:
Map Script: ------- EAST PLR LIST -----------------
Map Script: >>>> LIST EastList, k/player_ID= 1 / 1
Map Script: >>>> LIST EastList, k/player_ID= 2 / 2
Map Script: ------- WEST PLR LIST -----------------
Map Script: >>>> LIST WestList, k/player_ID= 1 / 0
Map Script: >>>> LIST WestList, k/player_ID= 2 / 3
Map Script: >>>> ALERT: City States ID: 0 failed to be placed due to overcrowding. Attempting 'last chance' placement method.
Map Script: >>>> City State 0 has been RESCUED from the trash bin of history and started at Fallback Plot: 5 12
Map Script: ------- CS and OTHER PLR LIST after sorting ---------
Map Script: >>>> LIST otherList, k/player_ID/MinorCivTrait= 1 / 22 / 2
Map Script: >>>> LIST otherList, k/player_ID/MinorCivTrait= 2 / 24 / 2
Map Script: >>>> LIST otherList, k/player_ID/MinorCivTrait= 3 / 23 / 2
Map Script: >>>> LIST otherList, k/player_ID/MinorCivTrait= 4 / 26 / 2
Map Script: >>>> LIST otherList, k/player_ID/MinorCivTrait= 5 / 25 / 0
Map Script: >>>> LIST otherList, k/player_ID/MinorCivTrait= 6 / 27 / 0
Map Script:
Map Script: ---------------------------------------
Map Script: >>>> Positions colizion: x/y/name: 29 18 Genoa ,=ColizionChk( 23 )= Ramesses II
Map Script: >>>> ALERT: City States ID: 23 failed to be placed due to overcrowding. Attempting 'last chance' placement method.
Map Script: >>>> City State 23 has been RESCUED from the trash bin of history and started at Fallback Plot: 8 15
Map Script: ---------------------------------------
Map Script: >>>> LUXURY Resources:
Map Script: - Whale...: 0 12
Map Script: - Pearls..: 5 13
Map Script: - Gold....: 4 14
Map Script: - Silver..: 0 15
Map Script: - Gems....: 3 16
Map Script: - Marble..: 3 17
Map Script: - Ivory...: 0 18
Map Script: - Fur.....: 1 19
Map Script: - Dye.....: 0 20
Map Script: - Spices..: 3 21
Map Script: - Silk....: 2 22
Map Script: - Sugar...: 6 23
Map Script: - Cotton..: 5 24
Map Script: - Wine....: 0 25
Map Script: - Incense.: 2 26
Map Script: + TOTAL....: 99
Map Script: >>> Luxs_useroption/luxTypesQty/loops/: 4 11 7
Map Script: >>> DEL resourceType/ktoryluxID/x/y: 23 23 13 12
Map Script: >>> DEL resourceType/ktoryluxID/x/y: 23 23 16 16
Map Script: >>> DEL resourceType/ktoryluxID/x/y: 23 23 26 7
Map Script: >>> DEL resourceType/ktoryluxID/x/y: 23 23 29 11
Map Script: >>> DEL resourceType/ktoryluxID/x/y: 19 19 7 6
Map Script: >>> DEL resourceType/ktoryluxID/x/y: 19 19 35 17
Map Script: >>> DEL resourceType/ktoryluxID/x/y: 26 26 9 9
Map Script: >>> DEL resourceType/ktoryluxID/x/y: 26 26 33 14
Map Script: >>> DEL resourceType/ktoryluxID/x/y: 24 24 15 14
Map Script: >>> DEL resourceType/ktoryluxID/x/y: 24 24 16 9
Map Script: >>> DEL resourceType/ktoryluxID/x/y: 24 24 17 16
Map Script: >>> DEL resourceType/ktoryluxID/x/y: 24 24 25 7
Map Script: >>> DEL resourceType/ktoryluxID/x/y: 24 24 26 14
Map Script: >>> DEL resourceType/ktoryluxID/x/y: 24 24 27 9
Map Script: -------------------------------
Map Script: Map Generation - Adding Goodies
Map Script: ** The game specified NO GOODY HUTS
Map Script: Determining continents for art purposes (MapGenerator.Lua)
CivilopediaScreen: SetSelectedCategory(12)
CivilopediaScreen: CivilopediaCategory[CategoryTerrain].DisplayList
CivilopediaScreen: SetSelectedCategory(1)
CivilopediaScreen: CivilopediaCategory[CategoryHomePage].DisplayList
Tutorial: Enabling Tutorial
GenericPopup: Loaded Popup - Assets\UI\InGame\PopupsGeneric\ConfirmImprovementRebuildPopup.lua
GenericPopup: Loaded Popup - Assets\UI\InGame\PopupsGeneric\CityPlotManagementPopup.lua
GenericPopup: Loaded Popup - Assets\UI\InGame\PopupsGeneric\ConfirmCommandPopup.lua
GenericPopup: Loaded Popup - Assets\UI\InGame\PopupsGeneric\MinorCivEnterTerritoryPopup.lua
GenericPopup: Loaded Popup - Assets\UI\InGame\PopupsGeneric\LiberateMinorPopup.lua
GenericPopup: Loaded Popup - Assets\UI\InGame\PopupsGeneric\ReturnCivilianPopup.lua
GenericPopup: Loaded Popup - Assets\UI\InGame\PopupsGeneric\AnnexCityPopup.lua
GenericPopup: Loaded Popup - Assets\UI\InGame\PopupsGeneric\DeclareWarMovePopup.lua
GenericPopup: Loaded Popup - Assets\UI\InGame\PopupsGeneric\BarbarianRansomPopup.lua
GenericPopup: Loaded Popup - Assets\UI\InGame\PopupsGeneric\ConfirmGiftPopup.lua
GenericPopup: Loaded Popup - Assets\UI\InGame\PopupsGeneric\ConfirmCityTaskPopup.lua
GenericPopup: Loaded Popup - Assets\UI\InGame\PopupsGeneric\PuppetCityPopup.lua
GenericPopup: Loaded Popup - Assets\UI\InGame\PopupsGeneric\DeclareWarRangeStrikePopup.lua
GenericPopup: Loaded Popup - Assets\UI\InGame\PopupsGeneric\ConfirmPolicyBranchPopup.lua
GenericPopup: Loaded Popup - Assets\UI\InGame\PopupsGeneric\MinorCivGoldPopup.lua
ProductionPopup: AdvisorControl could not be found
TechPopup: AdvisorControl could not be found
CityStateGreetingPopup: AdvisorControl could not be found


Is it possible to add events from map script?
 
I have all debugoption on, i think.

Not what he means. Go into the mod's modinfo file, and check if the files in question have
import="1"
instead of
import="0"
for any Lua files that override existing logic. In ModBuddy, you can check this in the Properties window (it'll be true/false there with a pulldown), but the modinfo file is how you'd show us if it's working.
 
Not what he means. Go into the mod's modinfo file, and check if the files in question have
import="1"
instead of
import="0"
for any Lua files that override existing logic. In ModBuddy, you can check this in the Properties window (it'll be true/false there with a pulldown), but the modinfo file is how you'd show us if it's working.

but it is a map script not a mod. I dont use ModBuddy :) map script file is just copied to maps folder
Is it possible to add event from map script level?
 
Is it possible to add event from map script level?

I don't think so. They get processed at a point well before the game has fully initialized, so I don't think you can get a popup-type event to work inside them. A lot of things are like that.
Map scripts can have altered versions of existing Lua functions, which will override the core game's versions. One of the more annoying bits is that maps also override mods; if my mod has changed AssignStartingPlots.lua, and the map script has its own variants of the resource distributions, then it'll use the map's version in preference to my own (which to me is backwards). But that's VERY different than triggering a new event.

And you don't need ModBuddy for ANY mods, really. All ModBuddy does when it "compiles" is copy all of your files to a Mods directory and create a .modinfo text file, which you can adjust by hand. It's not an actual software compiler; the only complex parts of the modinfo file are the checksum bits, AFAIK. So the fact that a map script can be done without it doesn't really mean much.
 
I don't think so. They get processed at a point well before the game has fully initialized, so I don't think you can get a popup-type event to work inside them. A lot of things are like that.
Map scripts can have altered versions of existing Lua functions, which will override the core game's versions. One of the more annoying bits is that maps also override mods; if my mod has changed AssignStartingPlots.lua, and the map script has its own variants of the resource distributions, then it'll use the map's version in preference to my own (which to me is backwards). But that's VERY different than triggering a new event.

And you don't need ModBuddy for ANY mods, really. All ModBuddy does when it "compiles" is copy all of your files to a Mods directory and create a .modinfo text file, which you can adjust by hand. It's not an actual software compiler; the only complex parts of the modinfo file are the checksum bits, AFAIK. So the fact that a map script can be done without it doesn't really mean much.

I think the same way, you can't add event from map script level. :(
I don't need ModBuddy. It is easier just to copy newmap.lua file to maps folder. We use it only for multiplayer games and mods unfortunately are blocked in multiplayer so ModBoddy is useless for me.

EDIT:
i have found the solution of my problem:
player:AddNotification(NotificationTypes.NOTIFICATION_DIPLOMACY_DECLARATION, ScripSetText , "Map setup description...", plotX, plotY);

Code:
-----------------------------------------------------------------------------------
	-----------------------------Map settings info-------------------------------------
	-----------------------------------------------------------------------------------
	local IronHorse_useroption = Map.GetCustomOption(9);
	if IronHorse_useroption == 7 then
		ScripSetText = ScripSetText .. " IronHorseQty=Random";
	else
		IronHorse_useroption = IronHorse_useroption + 1;
		ScripSetText = ScripSetText .. " IronHorseQty=" .. IronHorse_useroption ;
	end
	
	local Uranium_useroption = Map.GetCustomOption(3);
	if Uranium_useroption == 1 then
		ScripSetText = ScripSetText .. " UraniumQty=None";
	end
	if Uranium_useroption == 2 then
		ScripSetText = ScripSetText .. " UraniumQty=Rare" ;
	end
	if Uranium_useroption == 3 then
		ScripSetText = ScripSetText .. " UraniumQty=Balanced" ;
	end

	for player_ID = 0, GameDefines.MAX_MAJOR_CIVS - 1  do
		player = Players[player_ID];
		if ( isValidPlayer(player) and player:IsHuman() == true ) then
			local CivName1 = player:GetName();
			playerStartPlot = player:GetStartingPlot();
			plotX = playerStartPlot:GetX();
			plotY = playerStartPlot:GetY();
			local playerteam_ID = player:GetTeam();
			local lineQty = 1 ;
			local areaID = playerStartPlot:GetArea();
			local area = Map.GetArea(areaID);
			local numTiles = area:GetNumTiles();
			ScripSetText = ScripSetText .. " AreaTitles=" .. numTiles .. "                                                ";
			for i = 0, GameDefines.MAX_MAJOR_CIVS - 1  do
				if i ~= player_ID then
					local playerProx = Players[i];
					if isValidPlayer(playerProx) then
						local playerProxteam_ID = playerProx:GetTeam();
						if playerProxteam_ID ~= playerteam_ID then
							local playerProxStartPlot = playerProx:GetStartingPlot();
							local plotX2 = playerProxStartPlot:GetX();
							local plotY2 = playerProxStartPlot:GetY();
							local ProximityToPlayer = Map.PlotDistance(plotX, plotY, plotX2, plotY2);
							
							if (ProximityToPlayer > 0 and lineQty < 6 ) then 
								local CivName2 = playerProx:GetName(); 
								if mirrordebug == 1 then
									print(">>>> ProximityToPlayer:",ProximityToPlayer,CivName1,CivName2);
								end
								lineQty = lineQty + 1;
								ScripSetText = ScripSetText .. " " .. CivName1 .. "<-->" .. CivName2 .. "=" .. ProximityToPlayer .. "                                   ";
							end
						end
					end
				end
			end
			if(ScripSetText ~= nil) then
				if mirrordebug == 1 then
					print(">>>> ScripSetText:",ScripSetText);
				end
				[B]player:AddNotification(NotificationTypes.NOTIFICATION_DIPLOMACY_DECLARATION, ScripSetText , "Map setup description...", plotX, plotY);[/B]
			end
		end
	end

its work ok and I can send info about map script setup this way
 
Top Bottom