Hello, I've been trying my hand at fixing an old darthmod script that was broken but I'm not having much luck. It's the script that causes France to inherit Bavaria and Wurttemberg. Here is the original game script:

Code:
if conditions.FactionName("france", context) and not conditions.FactionIsHuman("france", context) and not BOOL_france_region_handover then
        out.ting("Handing regions to the French!")
        scripting.game_interface:grant_faction_handover("france", "bavaria", 0, 0, context)
        scripting.game_interface:grant_faction_handover("france", "wurttemberg", 0, 0, context)
        BOOL_france_is_AI = true
        BOOL_france_region_handover = true
    end
Obviously that functions in that if no human player is France then they get given Bavaria and Wurttemberg. However, the Darthmod script is this:

Code:
if conditions.FactionName("bavaria", context) and not conditions.FactionIsHuman("bavaria", context) and not BOOL_france_region_handover then
        out.ting("Handing regions to the French!")
        scripting.game_interface:grant_faction_handover("france", "bavaria", 0, 0, context)
        BOOL_france_is_AI = true
        BOOL_france_region_handover = true
    elseif conditions.FactionName("wurttemberg", context) and not conditions.FactionIsHuman("wurttemberg", context) and not BOOL_france_region_handover then
        out.ting("Handing regions to the French!")
        scripting.game_interface:grant_faction_handover("france", "wurttemberg", 0, 0, context)
        BOOL_france_is_AI = true
        BOOL_france_region_handover = true
    end

The issue here is that even when a human is France the script fires, but they also only get given Bavaria. The intended script, and how I hope to change it, would behave as follows:

1. If neither France, Bavaria nor Wurttemberg are Human then France is given Bavaria and Wurttemberg.
2. If France is a human player the script does not fire
3. If Bavaria or Wurttemberg are Human the script does not fire

I've tried several times but not really being a coder I can't seem to figure out exactly how I should write out the script, so any help to fix this would be gratefully received! And apologies in case this post doesn't format properly... its been a long time since having last been on this forum.

Thanks in advance