• We have updated our Community Code of Conduct. Please read through the new rules for the forum that are an integral part of Paradox Interactive’s User Agreement.
Solved

Jean le Chauve

Second Lieutenant
24 Badges
Sep 2, 2006
141
0
  • 500k Club
  • Crusader Kings II: Holy Fury
  • Shadowrun Returns
  • Crusader Kings II: Jade Dragon
  • Age of Wonders III
  • Surviving Mars
  • Knights of Honor
  • Crusader Kings II: Monks and Mystics
  • Crusader Kings II: Reapers Due
  • Crusader Kings II: Conclave
  • Crusader Kings II: Horse Lords
  • Crusader Kings II: Way of Life
  • Cities in Motion 2
  • Warlock: Master of the Arcane
  • Diplomacy
  • Crusader Kings II: Sword of Islam
  • Crusader Kings II: Sunset Invasion
  • Crusader Kings II: Sons of Abraham
  • Crusader Kings II: The Republic
  • Crusader Kings II: Rajas of India
  • Crusader Kings II: The Old Gods
  • Crusader Kings II: Legacy of Rome
  • Crusader Kings II: Charlemagne
  • Crusader Kings II
The 2 following functions doesn't seem to work.
Is this a bug or not activated functions?

Code:
-- unemployed Colonists have increased Comfort
function OnMsg.ColonistStatusEffect(colonist, status_effect, bApply, now)
    if status_effect =="StatusEffect_Unemployed" then
        if bApply then
            colonist:ChangeComfort(30*const.Scale.Stat, "unemployed")
        end
    end
end
~~~~
Code:
-- increase the Morale of all Colonists when a Rocket from Earth lands on Mars
function OnMsg.RocketLanded(rocket)
    local morale = 15*const.Scale.Stat
    local mod_id = "get_letter_from_earth"..rocket.name
    local display_text = T{"<green>Letter form Earth! +<amount> </green>"}
    local colonists = {}
    for _, colonist in ipairs(UICity.labels.Colonist or empty_table) do
        colonist:SetModifier("base_morale", mod_id, morale, 0, display_text)
        colonists[#colonists+1] = colonist
    end
    CreateGameTimeThread( function()
        Sleep(3*const.DayDuration)
        for _, colonist in ipairs(colonists) do
            if IsValid(colonist) then
                colonist:SetModifier("base_morale", mod_id, 0, 0)
            end
        end
    end )
end
~~~~