divide by 0 error?

Users who are viewing this thread

mercury19

Sergeant at Arms
So I get the feeling this is long dead but I pulled out the 1.51 modmerger version anyway and I'm getting a divide by 0 error when using the mod. It only seems to be active if I'm enlisted. It's in the Native "calculate_castle_prosperities_by_using_its_villages" script, presumably the line (store_div, ":castle_prosperity", ":total_prosperity", ":total_villages"), since that's the only division in that script. Which means that somehow the ":total_villages" is getting assigned zero, but I don't know what in freelancer would change that?

Any chance anyone still checks this board and could give me some advice?
 
check the rule the mod uses to associate villages and castles. With Native (usual set of rules) you would have a relation of 1 to 1 (each castle has 1 village). Seems your game has one (or more) castles without a village.

the Native script is bugged, but as the rule of 1 to 1 hides it (the bug), it works fine  :mrgreen:

You could simple re-write the script and fix it, or analyze why some castles are without villages. Either should solve this.

If you need help with the code visit the Forge, Q&A thread.
 
Hmm, I don't think I've messed with any of the castle-village relationships but I'll see what I can find. Thanks!

EDIT: I fixed the issue. In the freelancer_parties file, the way that modmerger was used was throwing off the count of the towns/villages/castles.

All you have to do is find this chunk:

Code:
find_i = list_find_first_match_i( orig_parties, "zendar" )
		OpBlockWrapper(orig_parties).InsertBefore(find_i, parties)

and change the "zendar" to "routed_enemies" and the InsertBefore to InsertAFter, so it looks like this:

Code:
find_i = list_find_first_match_i( orig_parties, "routed_enemies" )
		OpBlockWrapper(orig_parties).InsertAfter(find_i, parties)

That SHOULD fix it and not cause any other errors.
 
Back
Top Bottom