Modifying Notifications XML - doesn't work?

ispanets

Warlord
Joined
Apr 1, 2013
Messages
136
Location
Moscow
Hi all,

I have been reading in the thread about modding XML by LUA. But what I am trying to do is to modify Notifications XML to remove spies´ notification about "plotting" (for example... player X is plotting against Y). I am finishing a Lord of the Rings scenario, but the spies tell all the times that nations in an permanent alliance are plotting with each other.

What I have done is the following:

<?xml version="1.0" encoding="utf-8"?>
<!-- Created by ModBuddy on 01.04.2013 11:22:17 -->
<GameData>

<Notifications>
<Delete NotificationType="NOTIFICATION_INTRIGUE_DECEPTION"/>
<Delete NotificationType="NOTIFICATION_INTRIGUE_BUILDING_SNEAK_ATTACK_ARMY"/>
<Delete NotificationType="NOTIFICATION_INTRIGUE_BUILDING_SNEAK_ATTACK_AMPHIBIOUS"/>

<Delete NotificationType="NOTIFICATION_INTRIGUE_SNEAK_ATTACK_ARMY_AGAINST_KNOWN_CITY_UNKNOWN"/>
<Delete NotificationType="NOTIFICATION_INTRIGUE_SNEAK_ATTACK_ARMY_AGAINST_KNOWN_CITY_KNOWN"/>
<Delete NotificationType="NOTIFICATION_INTRIGUE_SNEAK_ATTACK_ARMY_AGAINST_YOU_CITY_UNKNOWN"/>
<Delete NotificationType="NOTIFICATION_INTRIGUE_SNEAK_ATTACK_ARMY_AGAINST_YOU_CITY_KNOWN"/>
<Delete NotificationType="NOTIFICATION_INTRIGUE_SNEAK_ATTACK_ARMY_AGAINST_UNKNOWN"/>
<Delete NotificationType="NOTIFICATION_INTRIGUE_SNEAK_ATTACK_AMPHIB_AGAINST_KNOWN_CITY_UNKNOWN"/>
<Delete NotificationType="NOTIFICATION_INTRIGUE_SNEAK_ATTACK_AMPHIB_AGAINST_KNOWN_CITY_KNOWN"/>
<Delete NotificationType="NOTIFICATION_INTRIGUE_SNEAK_ATTACK_AMPHIB_AGAINST_YOU_CITY_UNKNOWN"/>
<Delete NotificationType="NOTIFICATION_INTRIGUE_SNEAK_ATTACK_AMPHIB_AGAINST_YOU_CITY_KNOWN"/>
<Delete NotificationType="NOTIFICATION_INTRIGUE_SNEAK_ATTACK_AMPHIB_AGAINST_UNKNOWN"/>
<Delete NotificationType="NOTIFICATION_INTRIGUE_CONSTRUCTING_WONDER"/>
</Notifications>
</GameData>

But no way, it ignores everything. I have even DELETED all the Notifications and anyway it shows them all. It seems as if this XML was processed at all.


Any idea?

THANKS in advance.

Jose


Moderator Action: Moved to the main forum.
Because that's where questions belong to ;).
 
Hi again,

The log info says the following

[3698.253] Validating Notifications
[3698.253] Number of notification xml entries does not match enum size
[3698.253] **** VALIDATION FAILED *****

Does anyone know where can I find the enum size to decrease it?

Thanks
 
Notifications don't work like (boy do I wish they did!)

Notifications are generated by the C++ code in the game core DLL (and that's where you'll find the enum referred to in your second post). The Notification table is just used by the UI to display them in the panel at the right hand side of the screen (why Firaxis used a table and not the original C++ enum entries I don't know, as it serves no useful purpose and only confuses). Removing entries from that table will just cause the UI to misbehave/crash. If you want to remove the Spy notifications you'll need to make changes to the NotificationPanel.lua code, but that's not easy as that code is particularly convoluted.

EDIT: Weird, it ate the second part of my post!

If you use my UI - Notification Options (GK) mod (either by embedding it into your scenario mod or by making your mod depend on / reference it) you can switch the notifiications off from lua with

Code:
LuaEvents.NotificationOptionsShow(NotificationTypes.NOTIFICATION_INTRIGUE_SNEAK_ATTACK_ARMY_AGAINST_KNOWN_CITY_UNKNOWN, false)
etc
 
Hi, whoward69!

I have included your Notification MOD. It's working great! But I have one question about the code line you wrote...

Code:
LuaEvents.NotificationOptionsShow(NotificationTypes.NOTIFICATION_INTRIGUE_SNEAK_ATTACK_ARMY_AGAINST_KNOWN_CITY_UNKNOWN, false)
etc[/QUOTE]


... I have made an .lua script in my project, with only some lines like this, but it ignores it. THis is the script:
Code:
LuaEvents.NotificationOptionsShow(NotificationTypes.NOTIFICATION_INTRIGUE_SNEAK_ATTACK_ARMY_AGAINST_KNOWN_CITY_UNKNOWN, false)
LuaEvents.NotificationOptionsShow(NotificationTypes.NOTIFICATION_INTRIGUE_SNEAK_ATTACK_ARMY_AGAINST_KNOWN_CITY_KNOWN, false)
LuaEvents.NotificationOptionsShow(NotificationTypes.NOTIFICATION_INTRIGUE_SNEAK_ATTACK_ARMY_AGAINST_YOU_CITY_UNKNOWN, false)
LuaEvents.NotificationOptionsShow(NotificationTypes.NOTIFICATION_INTRIGUE_SNEAK_ATTACK_ARMY_AGAINST_YOU_CITY_KNOWN, false)
LuaEvents.NotificationOptionsShow(NotificationTypes.NOTIFICATION_INTRIGUE_SNEAK_ATTACK_AMPHIB_AGAINST_KNOWN_CITY_UNKNOWN, false)
LuaEvents.NotificationOptionsShow(NotificationTypes.NOTIFICATION_INTRIGUE_SNEAK_ATTACK_AMPHIB_AGAINST_KNOWN_CITY_KNOWN, false)
LuaEvents.NotificationOptionsShow(NotificationTypes.NOTIFICATION_INTRIGUE_SNEAK_ATTACK_AMPHIB_AGAINST_YOU_CITY_UNKNOWN, false)
LuaEvents.NotificationOptionsShow(NotificationTypes.NOTIFICATION_INTRIGUE_SNEAK_ATTACK_AMPHIB_AGAINST_YOU_CITY_KNOWN, false)
LuaEvents.NotificationOptionsShow(NotificationTypes.NOTIFICATION_INTRIGUE_SNEAK_ATTACK_AMPHIB_AGAINST_YOU_CITY_UNKNOWN, false)
LuaEvents.NotificationOptionsShow(NotificationTypes.NOTIFICATION_INTRIGUE_DECEPTION, false)
LuaEvents.NotificationOptionsShow(NotificationTypes.NOTIFICATION_INTRIGUE_BUILDING_SNEAK_ATTACK_ARMY, false)
LuaEvents.NotificationOptionsShow(NotificationTypes.NOTIFICATION_INTRIGUE_BUILDING_SNEAK_ATTACK_AMPHIBIOUS, false)
LuaEvents.NotificationOptionsShow(NotificationTypes.NOTIFICATION_INTRIGUE_SNEAK_ATTACK_ARMY_AGAINST_UNKNOWN, false)
LuaEvents.NotificationOptionsShow(NotificationTypes.NOTIFICATION_INTRIGUE_SNEAK_ATTACK_AMPHIB_AGAINST_UNKNOWN, false)
LuaEvents.NotificationOptionsShow(NotificationTypes.NOTIFICATION_SPY_CANT_STEAL_TECH, false)
LuaEvents.NotificationOptionsShow(NotificationTypes.NOTIFICATION_ENEMY_IN_TERRITORY, false)

Then, I have added the LUA script to be loaded...
Code:
<EntryPoints>
    <EntryPoint type="Map" file="Middle Earth.Civ5Map">
      <Name>Middle Earth</Name>
      <Description>An accurate map of Middle Earth, ideal for a Small or Standard sized game. Starting points are random.</Description>
    </EntryPoint>
    <EntryPoint type="DiplomacyUIAddin" file="Start.lua">
      <Name>Start</Name>
      <Description>Start</Description>
    </EntryPoint>
  </EntryPoints>

...but no way. Any idea of what I am doing bad?

THANKS in advance.

Jose Juan

Notifications don't work like (boy do I wish they did!)

Notifications are generated by the C++ code in the game core DLL (and that's where you'll find the enum referred to in your second post). The Notification table is just used by the UI to display them in the panel at the right hand side of the screen (why Firaxis used a table and not the original C++ enum entries I don't know, as it serves no useful purpose and only confuses). Removing entries from that table will just cause the UI to misbehave/crash. If you want to remove the Spy notifications you'll need to make changes to the NotificationPanel.lua code, but that's not easy as that code is particularly convoluted.

EDIT: Weird, it ate the second part of my post!

If you use my UI - Notification Options (GK) mod (either by embedding it into your scenario mod or by making your mod depend on / reference it) you can switch the notifiications off from lua with

Code:
LuaEvents.NotificationOptionsShow(NotificationTypes.NOTIFICATION_INTRIGUE_SNEAK_ATTACK_ARMY_AGAINST_KNOWN_CITY_UNKNOWN, false)
etc
 
DiplomacyUIAddin should be InGameUIAddin, there may be others but that's the most obvious.

Also, make sure you have logging enabled (see the post in the Tutorials sub-forum on how to do this) and check it for errors

Finally, if you add

Code:
print("Hello me!")

as the very first line of the start.lua file, it will appear in lua.log - so you will at least know your file is being executed
 
Well, actually yes, when I wrote the post I realised about InGameUIAddin, but anyway, it doesn't work. I found in the logs the following:

...
CityNotifications: OnCustomNotificationAddin()
CityNotifications: OnCustomNotificationAddin() - received id 13 to NOTIFICATION_CITY_GROWTH
CityNotifications: OnCustomNotificationAddin()
CityNotifications: OnCustomNotificationAddin() - received id 14 to NOTIFICATION_CITY_TILE
CityNotifications: OnCustomNotificationAddin()
CityNotifications: OnCustomNotificationAddin() - assigned id 114 to CITY_NOTIFICATIONS_GROWTH
CityNotifications: OnCustomNotificationAddin()
CityNotifications: OnCustomNotificationAddin() - assigned id 115 to CITY_NOTIFICATIONS_TILE
Syntax Error: [string "C:\Users\&#1061;&#1086;&#1089;&#1077;\Documents\My Games\Sid Meier's Civilization 5..."]:1: unexpected symbol near ''
Runtime Error: Error loading C:\Users\&#1061;&#1086;&#1089;&#1077;\Documents\My Games\Sid Meier's Civilization 5\MODS\The war of the ring, circa 2950 (v 2)\Test.lua.


Here is the error. It fails even when a void .lua file. When I add the EntryPoint, it stops processing it showing the error of above. Have you seen it before?

Thanks for all your help.
 
If Test.lua is what seems to be Start.lua listed above, then no, as there are no " in that code snippet.

If Test.lua includes the print given above, then double check the file is saved as UTF-8 (and not UTF-16)
 
one question here about xml files in the game. can i change any xml files without brake the game? for example change aggressive leaders by changing the number? and other stuff like units
 
Due to the impossibility of fixing the problem (I checked it's UTF-8), could I have your permission for adding the lines from above for disabling inside your mod the sneak options? When the mod is ready to be uploaded, I will conviniently show that it depends on your mod but it was modified previosly to unable some options? As always, THANKS in advance.
 
You don't need to ask (read Q5 of http://www.picknmixmods.com/main/privacy/usage.html) but as you did, here's how to do it the really easy way if you're embedding the code

In NotificationOptions.lua in my mod

Code:
g_Notifications[NotificationTypes.NOTIFICATION_INTRIGUE_BUILDING_SNEAK_ATTACK_ARMY] =
  {item="Spy", key="NOTIFICATION_INTRIGUE_BUILDING_SNEAK_ATTACK_ARMY", 
   show=[B][COLOR="red"]false[/COLOR][/B], ui=[B][COLOR="Red"]false[/COLOR][/B]}

The first false disables the notification, the second one stops the user turning them back on via the pop-up menu
 
Back
Top Bottom