- #Total war attila mods multiplayer how to#
- #Total war attila mods multiplayer code#
- #Total war attila mods multiplayer Pc#
![total war attila mods multiplayer total war attila mods multiplayer](https://i.ytimg.com/vi/weeXdXfNghE/maxresdefault.jpg)
Local selected_cqi = lm:get_character_selected_cqi() Return context.string = "lichemaster_spawn_button"
#Total war attila mods multiplayer code#
If all you listen for is the ComponentLClickUp event, the game will desync without batting an eyelash.įor a quick for-instance, in Return of the Lichemaster, I have the following code (cut down for simplicity): Say you have a button and you want to spawn a unit into an army with it. There are many good reasons for this which I don’t really want to get into now, so I won’t.
#Total war attila mods multiplayer Pc#
So if I, Emprah Franzipants, click on a component, it’ll only trigger an event on my PC and not my buddy’s. It’s definitely significantly more complicated than the above, but it’s doable!Įssentially – the issue here is that the “ComponentX” events (such as “ComponentLClickUp”, “ComponentMouseOn”) and “XSelected” (such as “SettlementSelected” or “CharacterSelected”) only fire on the PC that the action was taken on. If you’re one of the brave pioneers doing UI modding, this part is pertinent to you. The above section is probably gonna cover the vast, vast majority of you. You should only really be using cm:get_local_faction() for singleplayer stuff, or for making any sort of UI edits for only specific factions. Instead of checking to see if this PC has this faction, just see if any PC has this faction, and it’s suddenly very MP safe! The optional arg in get_local_faction() determines whether the function will be run in mp or not if it’s set to false, or nil, then it’ll always return false, causing any if statements based on it to return false.Ģ) Instead of reading for cm:get_local_faction(true) = "faction_key", use cm:get_faction("faction_key"):is_human(). Thankfully – it’s incredibly simple to fix! There are two pretty fast ways.ġ) Use cm:get_local_faction(false) or cm:get_local_faction() when you want stuff to not fire in MP, and cm:get_local_faction(true) only when you’re 100% certain it’s MP-safe (not a model edit). In this case, my PC would try to spawn a big big army, but my friend’s PC will not want to spawn a big big army, because they aren’t playing as Da Emprah. If cm:get_local_faction(true) = "wh_main_emp_empire" then If you read that value, and decide to make a model edit as a result of its return value, it will desync. And that’s the end of my explanation of that function. It would print wh_main_emp_empire on my computer, and whatever_hexoatl's_key_is on my buddy’s. If I’m playing MP with my buddy, and I’m playing as Reikland, and they’re playing as Hexoatl, and we both run a script that has the following: By local player, I mean the player on that instance of the game – the player on that computer. So, cm:get_local_faction() is a pretty simple function – literally all it does is read what the “local” player’s faction key is.
#Total war attila mods multiplayer how to#
I’m gonna cover each now and explain how to handle both! Thankfully, there are two really common – and really simple to fix – situations where this might happen: making model edits based on cm:get_local_faction(true)‘s result, and making model edits based on “ComponentX” or “XSelected” events. txt file, or making UI edits will not cause a desync. Doing something like outputting text to a. Note: A “model” edit is something that makes an edit to the game itself, ie., spawning an army, applying an effect bundle. If conditions are different between the two computers, and one performs a model edit and the other doesn’t – kaput, no more synchronization. This stuff is usually handled pretty well by the C++ base-code – but, bad Lua coding can cause a desync!Ī desync will happen if you cause an edit to the model on one computer without doing the same edit on the other computer. In Total War, both PC’s are playing, technically, different instances of the game, and the game is sending messages back and forth between the two clients to make sure everything is the same on both PC’s.
![total war attila mods multiplayer total war attila mods multiplayer](https://images.gamewatcherstatic.com/image/file/5/17/115165/Total-War-Rise-of-Mordor-1.jpg)
At that point, the game will just kinda stop.Ī desync is what happens when the two players’ PC’s decide that different things are happening at the same time – they are no long in sync (not since 2002!). Throughout the course of a multiplayer campaign, there will be an annoying popup box that says “Desync Detected – BEGINNING EXTERMINATION” (paraphrasing). If you’re one of the aforementioned six multiplayer campaign players who uses mods, you’re probably incredibly familiar with the concept of desyncs. Before we get into how to resolve the desyncs and keep our code from ever being volatile, we should talk about what a desync is, and how they happen.