Popup messages

A forum to discuss custom scenarios, campaigns and modding in general.

Moderator: Panzer Corps 2 Moderators

Post Reply
nexusno2000
Colonel - Fallschirmjäger
Colonel - Fallschirmjäger
Posts: 1405
Joined: Mon Feb 24, 2014 5:15 pm

Popup messages

Post by nexusno2000 » Sun Jul 19, 2020 12:13 pm

I'm assuming this subforum is as close to a modding subforum as we get?

I've tried to both change existing and add new strings for tutorial popup boxes, but the changes are not reflected in the game. Indeed, all popupboxes are empty. Is this related to localization? So that I basically can't change/add strings for popup messages?
Green Knight
https://www.youtube.com/c/GreenKnight2001

peterw
Senior Corporal - Destroyer
Senior Corporal - Destroyer
Posts: 114
Joined: Fri Apr 25, 2014 7:08 am

Re: Popup messages

Post by peterw » Tue Jul 21, 2020 8:33 am

As far as I know you have to write a LUA script for in-game messages.
But this is not easy to use at all.
My Italian Panzer Corps campaign Italia Victor!:
http://www.streitmacht.com/downloads.php?view=detail&df_id=53

nexusno2000
Colonel - Fallschirmjäger
Colonel - Fallschirmjäger
Posts: 1405
Joined: Mon Feb 24, 2014 5:15 pm

Re: Popup messages

Post by nexusno2000 » Tue Jul 21, 2020 9:03 am

peterw wrote:
Tue Jul 21, 2020 8:33 am
As far as I know you have to write a LUA script for in-game messages.
But this is not easy to use at all.
Heard from Rudankort.

Problem: The localization system in Unreal treats US English as just another localization. So if you mod in strings using LUA, the new strings will not be displayed.

Solution: Rename the 'localization' folder (I called mine Xlocalization). Now the game gets strings directly from LUA. The downside is that this effectively kills all localizations. But I play in English anyway, so not really a problem.
Green Knight
https://www.youtube.com/c/GreenKnight2001

peterw
Senior Corporal - Destroyer
Senior Corporal - Destroyer
Posts: 114
Joined: Fri Apr 25, 2014 7:08 am

Re: Popup messages

Post by peterw » Thu Jul 23, 2020 6:04 am

As I don't need the ingame messages in English, I solved it with LUA.

In the editor you need to enable it in "Edit -> Triggers".
I used EndTurnAction as condition. It works generally but triggers one round too early.
Addititional to the message I placed a plane (which is the real purpose of my script).

The LUA script can be like (please ignore the German commends behind "--"):

function cond1() -- Bedingung im Editor: Trigger Rundenende
return world.round == 6 -- Runde 5 definieren
end

titel = "Warnung"
message1 = "Es wurden neue Feindflugzeuge im Westen gesichtet."

function F1() -- neue Einheit erzeugen und platzieren + Ausgabe Nachricht
local feld = {3,15} -- Ort
local einheit = "I16" -- ID von I-16, siehe units.csv
local player = world:GetPlayer(1) -- welcher Spieler? (hier: 2.Spieler=Feind)
local create_action = world:MakePurchaseAction(player, einheit, "", 0) -- Einkauf welcher Einheit?
create_action.auxiliary = false -- Hilfs- oder Kerneinheit? (Kerneinheit)
create_action.cost = 0 -- Preis? 0
world:Exec(create_action) -- Kaufaktion!
local unit = world:GetUnit(create_action.id) -- welche Einheit?
local hex = world:GetHex(feld) -- welches Hex?
if (hex:GetUnit(0) == nil) then -- prüfen, ob Hex frei ist
deploy_action = world:MakeDeployAction(unit,feld) -- definieren, was wo platziert wird
world:Exec(deploy_action) -- Platzierung der Einheit!
end

MessageBox(titel, message1) -- Ausgabe Nachricht
end
My Italian Panzer Corps campaign Italia Victor!:
http://www.streitmacht.com/downloads.php?view=detail&df_id=53

Post Reply

Return to “Panzer Corps 2 Scenario Design”