Total War: PHARAOH DYNASTIES

Total War: PHARAOH DYNASTIES

Create and Share Custom Mods
The best mods for A Total War: PHARAOH DYNASTIES live here. Mods are made by players, for players. Click 'Learn More' below to read our Modder’s Guide.
Learn More
Kendji 34 11 Aug, 2024 @ 3:46pm
Advice on lua
Hello, so I've been going up the walls for a few days. So what I'm trying to do is faily simple but turns out to not work no matter what I try.

I'm using total war Warhammer resources to help me: https://chadvandy.github.io/tw_modding_resources/WH3/campaign/episodic_scripting.html

Originally I had a for loop counting down on i to stop when it hit 0, but watching guides it seems in theory I could do it simply.

That said, I've been modding for maybe 20 years, but am very new to Total War and even newer to Lua and it's syntax etc.

No matter which way I try it I can't figure it out, it looks correct to me how I've read the guides. I just want a generic general, and another general to get some extra stuff, no unique art or anything.

What am I missing? Is the Warhammer resources not applicable to Pharaoh?

So this is my Lua script:
out("Loading isr.lua") function general_spawner() if cm:is_new_game() then cm:spawn_character_to_pool("phar_main_ashkelon", "412602252", "", "", "", 18, true, "general", "phar_main_general_canaan", false, "phar_main_bodyguard_hero_can_gen_khopesh_heavy_large"); cm:force_add_ancillary("715129654","phar_main_common_general_13", false, false); cm:force_add_ancillary("715129654","phar_main_common_general_14", false, false); cm:force_add_ancillary("715129654","phar_main_common_general_15", false, false); cm:force_add_ancillary("715129654","phar_main_common_general_17", false, false); end, end, [/quote]
Last edited by Kendji; 11 Aug, 2024 @ 3:48pm
< >
Showing 1-3 of 3 comments
Nuin 5 12 Aug, 2024 @ 5:07am 
Is this function being called by a listener? As is it won't run at all.
Kendji 34 12 Aug, 2024 @ 9:14am 
Your advice got me forward with the problem

--out("Loading isr.lua ") local function init() pelle = true core:add_listener("general_listner","general_spawner_event", pelle, true) function spawn_general() if cm:is_new_game() then cm:spawn_character_to_pool("phar_main_ashkelon", "names_name_412602252", "", "", "", 18, true, "general", "phar_main_general_canaan", false, "phar_main_bodyguard_hero_can_gen_khopesh_heavy_large") cm:force_add_ancillary("715129654","phar_main_common_general_13", false, false) cm:force_add_ancillary("715129654","phar_main_common_general_14", false, false) cm:force_add_ancillary("715129654","phar_main_common_general_15", false, false) cm:force_add_ancillary("715129654","phar_main_common_general_17", false, false) pelle = false else pelle = true end end core:remove_listener("general_listner") end --cm:add_first_tick_callback(init)
I've tried many iterations, including adding same code under if to the else statement and other. It seems it never gets to the if statement at all. If I remove the comment from that last line the cm:add_first_tick_callback, it breaks the religious buildings in-game (you can build any god's temple), so the code at least runs now. The vc code debugger won't allow me to move the listeners end parenthesis post-if statement. But like that it passes the debugger. So now I'm trying to make it listen to a variable "pelle", no difference what value I give pelle.

I think I'm doing something wrong with the listener but I don't know what. I've been using this same[chadvandy.github.io] source as last time. If I understand it correctly pelle should be a boolean.
Ganossa 2 12 Aug, 2024 @ 4:36pm 
You are missing your callback function in the listener:

core:add_listener("general_listner","general_spawner_event", pelle, function(context) spawn_general() end, true)
< >
Showing 1-3 of 3 comments
Per page: 1530 50