Coming soon - Get a detailed view of why an account is flagged as spam!
view details

This post has been de-listed (Author was flagged for spam)

It is no longer included in search results and normal feeds (front page, hot posts, subreddit posts, etc). It remains visible only via the author's post history.

5
[Coding help] - "if" effect not working as intended?
Post Flair (click to view more posts with a particular flair)
Author Summary
GTAIVisbest is in Coding help
Post Body

I ran into this problem before while coding MotE. MotE has essentially the same coding structure as eu3 divine wind, which is what I'm working on at the moment. The problem I'm encountering is that the "if" effect doesn't work at times but at other times it does. Here's an example:

Here's the option of a triggered-only test event 1:

option = {
    name = XXXXXX
    if = {
        limit = {
            NOT = {
                has_country_modifier = test_modifier
                has_country_flag = test_event_blocker #You'll see where I'm going with this in a second
            }
        }
        add_country_modifier = {
            name = test_modifier
            duration = -1
        }
        set_country_flag = test_event_blocker #This flag is to signify that one of the IF conditions have been met and nothing else in this event should fire. If I don't put this here, then all the other IF conditions might fire below by accident.
    }
    if = {
        limit = {
            has_country_modifier = test_modifier
            NOT = { has_country_flag = test_event_blocker }
        }
        remove_country_modifier = test_modifier
        set_country_flag = test_event_blocker #See above
    }
    clr_country_flag = test_event_blocker #The temporary event blocker flag is removed at the end of the event
}

Now, this event will not work as intended. At first it will give me the modifier, but when I trigger the event again it says it will take it away but I still have the modifier. Something is bugged here preventing these IF scopes from working correctly.

Alternatively, consider Test Event 2:

option = {
    name = XXXXXX
    if = {
        limit = {
            tag = TUN
        }
        capital_scope = {
            change_province_name = "You're Tunisia!"
        }
    }
    if = {
        limit = {
            NOT = {
                tag = TUN
            }
        }
        capital_scope = {
            change_province_name = "You're Not Tunisia!"
        }
    }
}

This simple Test Event 2 works as intended every time. For further information, below is the actual event I'm trying to code that is fucking up:

option = {
    name = "EVTNAME8012"



    if = {
        limit = {
            region = maine_region
        }
        add_core = MAS
    }
    if = {
        limit = {
            region = new_hampshire_region
        }
        add_core = NHS
    }
    if = {
        limit = {
            region = vermont_region
        }
        add_core = VMS
    }
    if = {
        limit = {
            region = massachusetts_region
        }
        add_core = MCS
    }
    if = {
        limit = {
            region = rhode_island_region
        }
        add_core = RIS
    }
    if = {
        limit = {
            region = connecticut_region
        }
        add_core = CCS
    }
    if = {
        limit = {
            region = new_york_region
        }
        add_core = NYS
    }
    if = {
        limit = {
            region = new_jersey_region
        }
        add_core = NJS
    }
    if = {
        limit = {
            region = pennsylvania_region
        }
        add_core = PVS
    }
    if = {
        limit = {
            region = delaware_region
        }
        add_core = DWS
    }
    if = {
        limit = {
            region = maryland_region
        }
        add_core = MLS
    }
    if = {
        limit = {
            region = virginia_region
        }
        add_core = VGS
    }
    if = {
        limit = {
            region = west_virginia_region
        }
        add_core = WVS
    }
    if = {
        limit = {
            region = ohio_region
        }
        add_core = OHS
    }
    if = {
        limit = {
            region = kentucky_region
        }
        add_core = KTS
    }
    if = {
        limit = {
            region = indiana_region
        }
        add_core = IAS
    }
    if = {
        limit = {
            region = michigan_region
        }
        add_core = MGS
    }
    if = {
        limit = {
            region = illinois_region
        }
        add_core = INS
    }
    if = {
        limit = {
            region = wisconsin_region
        }
        add_core = WCS
    }
    if = {
        limit = {
            region = north_carolina_region
        }
        add_core = NCS
    }
    if = {
        limit = {
            region = south_carolina_region
        }
        add_core = SCS
    }
    if = {
        limit = {
            region = georgia_region
        }
        add_core = GGS
    }
    if = {
        limit = {
            region = tennessee_region
        }
        add_core = TSS
    }
    if = {
        limit = {
            region = florida_region
        }
        add_core = FDS
    }
    if = {
        limit = {
            region = alabama_region
        }
        add_core = ABS
    }
    if = {
        limit = {
            region = mississippi_region
        }
        add_core = MSS
    }
    if = {
        limit = {
            region = arkansas_region
        }
        add_core = ARS
    }
    if = {
        limit = {
            region = louisiana_region
        }
        add_core = LAS
    }
    if = {
        limit = {
            region = texas_region
        }
        add_core = TEX
    }
    if = {
        limit = {
            region = oklahoma_region
        }
        add_core = OKS
    }
    if = {
        limit = {
            region = kansas_region
        }
        add_core = KSS
    }
    if = {
        limit = {
            region = nebraska_region
        }
        add_core = NBS
    }
    if = {
        limit = {
            region = south_dakota_region
        }
        add_core = SDS
    }
    if = {
        limit = {
            region = north_dakota_region
        }
        add_core = NDS
    }
    if = {
        limit = {
            region = new_mexico_region
        }
        add_core = NMS
    }
    if = {
        limit = {
            region = colorado_region
        }
        add_core = CRS
    }
    if = {
        limit = {
            region = wyoming_region
        }
        add_core = WOS
    }
    if = {
        limit = {
            region = montana_region
        }
        add_core = MTS
    }
    if = {
        limit = {
            region = arizona_region
        }
        add_core = AZS
    }
    if = {
        limit = {
            region = utah_region
        }
        add_core = UTS
    }
    if = {
        limit = {
            region = idaho_region
        }
        add_core = IHS
    }
    if = {
        limit = {
            region = california_region
        }
        add_core = CAL
    }
    if = {
        limit = {
            region = nevada_region
        }
        add_core = NVS
    }
    if = {
        limit = {
            region = oregon_region
        }
        add_core = OGS
    }
    if = {
        limit = {
            region = washington_region
        }
        add_core = WAS
    }
    if = {
        limit = {
            region = minnesota_region
        }
        add_core = MIT
    }
    if = {
        limit = {
            region = iowa_region
        }
        add_core = IOS
    }
    if = {
        limit = {
            region = missouri_region
        }
        add_core = MRS
    }
}

This is the option for a province event, so I know what's in the limit scope is correct- it's checking to see if there's a match for any one of the above regions. When I test the event, though, every single province gets every single core.

Does anyone have an idea about how to use the IF scope correctly, or what I'm doing wrong?

Author
Account Strength
0%
Account Age
13 years
Verified Email
Yes
Verified Flair
No
Total Karma
97,708
Link Karma
26,710
Comment Karma
69,365
Profile updated: 7 months ago
Posts updated: 8 months ago

Subreddit

Post Details

Location
We try to extract some basic information from the post title. This is not always successful or accurate, please use your best judgement and compare these values to the post title and body for confirmation.
Posted
6 years ago