Issue with new classes

Users who are viewing this thread


Sergeant at Arms
I'm currently scenning for this new persistent mod, and just noticed an issue.

When I place down the custom classes that the coder made, there is no window showing the stats of that class, just a word saying "Use". I know usually you get to see the stats of the class you are changing to, but it just seems to be be coming up with his custom classes.

Here's a picture about what I mean: (I have tested it in a dedicated server aswell and the issue still remains)


This one shows that regular classes show their stat windows:


I know this is a coding issue but he can't seem to fix it either. Help would be appreciated.
I think you have to check module_presentations for that. Not 100% sure and not at home so I can't check.
It's a extension of use tooltip, placing strings under the use.
domipoppe said:
I think you have to check module_presentations for that. Not 100% sure and not at home so I can't check.
It's a extension of use tooltip, placing strings under the use.
Thanks for the tip, will check in with the team, cheers!
There shouldn't be any need to edit presentations, since the popup hard coded and only takes a composed string in script game_get_use_string: firstly ensure you are using the same custom module code as the server is running (and it must have a different module name than PW, as specified in the usage conditions), then check that the training scene prop is using the spr_change_troop_triggers generator function like the other troop training stations (it sets up the correct slots and triggers, slot_scene_prop_troop_id in this case). If you really must write your own scene prop triggers, use spr_change_troop_triggers as a guide: it is a Python function that returns the appropriate M&B script trigger block, customised by the function parameters.
Like Vornne said above me, The person that made your new class must of used the wrong trigger on the scene prop.
Just have Him look at the already existing scene props that are used to change classes and then make your own using that as reference.
Coder in question here.

I copied the trigger on the scene props from the pre-existing train point scene props from the start, that's not the issue. Here's a picture of the code lines in question that correspond to the currently broken class training points:


Is there an identifier that needs to be checked before new classes are added? The classes above the hashed out ones (which are the ones effected) are from normal PW and have no issue, its the complete fresh made classes that have the issue which leads me to believe that I need to do some more work in a yet to be known file to actually make the scene prop identify the class.

If you are properly creating a new mod, with identical module files on the server and all clients (not trying to make an incompatible server side change to official PW, which is not permitted by the usage conditions), the code should work fine: to add a new troop type, the only things that need to be done are to create the troop entry in, add a training scene prop entry with spr_change_troop_triggers(), and set the slots in script initialize_game_rules (slot_troop_ranking for the players in faction list, slot_troop_spawn_health_percent for the appropriate respawn health when the extra feature is enabled).

The spr_change_troop_triggers generator function sets slot_scene_prop_troop_id for the training prop, which is checked in script game_get_use string whether it is a valid troop id before the else_try section that sets the default fallback "Use" popup. So the crucial thing is that the player client has all the correct troop and scene prop data in the module: the use string functionality is entirely client side, not touching the server at all except for stock counts, hit points, and castle names - relevant for other types of scene props.
Top Bottom