Install Steam
login
|
language
简体中文 (Simplified Chinese)
繁體中文 (Traditional Chinese)
日本語 (Japanese)
한국어 (Korean)
ไทย (Thai)
Български (Bulgarian)
Čeština (Czech)
Dansk (Danish)
Deutsch (German)
Español - España (Spanish - Spain)
Español - Latinoamérica (Spanish - Latin America)
Ελληνικά (Greek)
Français (French)
Italiano (Italian)
Bahasa Indonesia (Indonesian)
Magyar (Hungarian)
Nederlands (Dutch)
Norsk (Norwegian)
Polski (Polish)
Português (Portuguese - Portugal)
Português - Brasil (Portuguese - Brazil)
Română (Romanian)
Русский (Russian)
Suomi (Finnish)
Svenska (Swedish)
Türkçe (Turkish)
Tiếng Việt (Vietnamese)
Українська (Ukrainian)
Report a translation problem
add_bunch_of_ancies = function()
local ancies = {
"wh2_dlc10_anc_talisman_shieldstone_of_isha",
"wh2_dlc15_anc_weapon_star_lance", }
local f_obj = cm:get_faction(cm:get_local_faction_name(true))
for _, anci in ipairs(ancies) do
cm:add_ancillary_to_faction(f_obj, anci, false)
end
end
addsometraits = function()
if not mod.char_cqi then return end
local char = cm:get_character_by_cqi(mod.char_cqi)
if not char or char:is_null_interface() then return end
cm:force_add_trait(cm:char_lookup_str(char), "wh2_dlc15_trait_dragon_moon_imrik", true, 1, true)
cm:force_add_trait(cm:char_lookup_str(char), "wh2_dlc15_trait_dragon_star_imrik", true, 1, true)
end
Added exec_frontend.lua that gets executed when you press the chat button in the frontend. Note that callback doesn't work in the frontend, but you can use real_timer to delay stuff in the frontend.
This will dump the UI after a 5 sec delay: https://gist.github.com/Shazbot/edb8a3af536e35c030c1c29f46d5b800
Added some error catching code that will catch errors inside callbacks and listeners, that would otherwise cause a script break. I have this in my script mods but it's now included here as well since it should be very useful just for people writing scripts as well.
https://discord.gg/FNyCS5c
Indeed, having the Battle Manager itself do the pcall was the key to the solution afterall, but using bm:callback as a wrapper and adding it to the listener.. that's genious!! ...also kind of ridiculous ^^'
I'd like to make it a part of this mod, so they're all in one place.
Definitely some weird stuff, and I can't explain it. Don't believe it's due to missing libraries, I can force_require libs and it's still not working.
--> Log Output >> Player alliance number: function: 000000009FF322B8
Tried using "bm", since bm:pause() does somehow work. However, as you can see even the simplest function "get_player_alliance_num()" does not return the intended integer, but rather the memory address of the function itself.
I think there's something seriously wrong.. well, anyways, I hope this was helpful to you?
1. local my_bm = battle_manager:new(empire_battle:new());
--> Log Output >> LOADFILE_BATTLE: [string "c:\games\steam\steamapps\common\total war warhammer ii\exec_battle.lua"]:8: attempt to index global 'battle_manager' (a nil value)
So apparently he doesn't recognize the "battle_manager" object at all, maybe some library is missing or something?
I'd try running a complicated battle script mod like Find Idle Units and see if that works.
dout is tied to the campaign script, yeah, but it could be an easy port.
I've tried out the new loadfile_battle mod and I noticed the following issues:
1. tried to run a few extremely simple commands via the Battle Manager and not sure what to make of it:
a) bm:pause();
--> worked fine
b) bm:show_ui(false);
--> did not do anything
c) bm:show_army_panel(false);
--> did not do anything
d) dout("TEST")
--> does not work in conjunction with your other mod "Draw Debug Logs"
So d) I understand, it probably does not work in Battle Mode. But as for b) and c) I'm not sure what to make of it. I feel like that should work, so not sure if there's some issue with the mod or just my own stupidity at work here.
2. During Battle Mode the F9 Key is already bound to some Camera Bookmark, so pressing the key makes the camera jump (no idea if that might cause any of the aforementioned issues?). However, unbinding F9 breaks the mods ability to run the external .lua it seems.
https://www.dropbox.com/s/aw0quk59j2lkp97/pj_loadfile_battle.pack?dl=0
it uses a different file exec_battle.lua (or exec/exec_battle.lua) that gets run with F9
when using out in battles convert things to strings because the out function in battles is a different one than in campaign and does some concatenation internally, and that requires input to be a string:
out(tostring(get_bm()))
also complete the Javascript tutorial at codecademy.com , coding is coding, the languages aren't that different and the concepts carry over
join the modding discord and ask any modding/scripting questions you have there:
https://discord.gg/ZsT7KG
Fixed a pretty big issue with globals from the _lib folder missing in exec scripts: stuff like random_army_manager and invasion_manager.
Added an additional file you can run: exec2.lua with F10.
Also:
If the mod doesn't find exec.lua inside the Total War WARHAMMER II folder it will also check Total War WARHAMMER II/exec/exec.lua.
So basically you can put exec.lua and exec2.lua inside an intermediate exec folder so things are better structured.
But you don't have to.
If you're using vscode I suggest you add the exec folder to a modding workspace.
Note that since the point in time when the script gets executed can differ, that could matter in some scripts. I had an issues where effect.get_localised_string ended up getting called too early once put into a pack, and the game would crash.
And not sure if require would behave differently, would have to test.