I.S.Norden has written a script for T-Plus to allow piety to be increased or decreased, depending on the terrain you are standing on. However the script isn't working properly. At first it would not give any piety. Then Falcon posted a solution on the forum. Now the script adds piety no matter what territoy you are standing on. Can anyone help please?

function ___hook_angels_terrain() 

        local celestials = { GOD_MICHAEL, GOD_URIEL, GOD_HAGIA_SOPHIA, GOD_AZRAEL, GOD_GABRIEL }

        if not celestials[player.pgod] then return end

        local blessed_terrain = { 
        [FEAT_BLESSED_GROUND] = TRUE,
        [FEAT_BLESSED_GRASS] = TRUE,
        [FEAT_BLESSED_FLOWERS] = TRUE,
        [FEAT_BLESSED_FLOOR] = TRUE, }

        local cursed_terrain = { 
        [FEAT_CURSED_GROUND] = TRUE,
        [FEAT_CURSED_FLOOR] = TRUE,
        [FEAT_CURSED_ASH] = TRUE, }

        local fiery_terrain = { 
        [FEAT_SHAL_LAVA] = TRUE,
        [FEAT_DEEP_LAVA] = TRUE,
        [FEAT_GREAT_FIRE] = TRUE, }

        local watery_dark = {
        [FEAT_DARK_PIT] = TRUE,
        [FEAT_SHAL_WATER] = TRUE,
        [FEAT_DEEP_WATER] = TRUE, }

        --local where = (cave(player.py, player.px))
        local where = (cave(player.py, player.px).feat)

        for i, v in blessed_terrain do
                if v[where] then
                        if celestials[player.pgod] then
                                player.grace = 1 + player.grace
                        end
                end
        end

        for i, v in cursed_terrain do
                if v[where] then
                        if celestials[player.pgod] then
                                player.grace = player.grace - 1
                        end
                end
        end

        for i, v in fiery_terrain do
                if v[where] then
                        if player.pgod == GOD_URIEL then
                                player.grace = 1 + player.grace
                        end
                end
        end


        for i, v in watery_dark do
                if v[where] then
                        if player.pgod == GOD_URIEL then
                                player.grace = player.grace -1
                        end
                end
        end
end


add_hook_script(HOOK_PROCESS_WORLD, "___hook_angels_terrain", "___hook_angels_terrain")

DarkGod: lets see:

function ___hook_angels_terrain() 

        local celestials = { GOD_MICHAEL=TRUE, GOD_URIEL=TRUE, GOD_HAGIA_SOPHIA=TRUE, GOD_AZRAEL=TRUE, GOD_GABRIEL=TRUE }

        if not celestials[player.pgod] then return end

        local blessed_terrain = { 
        [FEAT_BLESSED_GROUND] = TRUE,
        [FEAT_BLESSED_GRASS] = TRUE,
        [FEAT_BLESSED_FLOWERS] = TRUE,
        [FEAT_BLESSED_FLOOR] = TRUE, }

        local cursed_terrain = { 
        [FEAT_CURSED_GROUND] = TRUE,
        [FEAT_CURSED_FLOOR] = TRUE,
        [FEAT_CURSED_ASH] = TRUE, }

        local fiery_terrain = { 
        [FEAT_SHAL_LAVA] = TRUE,
        [FEAT_DEEP_LAVA] = TRUE,
        [FEAT_GREAT_FIRE] = TRUE, }

        local watery_dark = {
        [FEAT_DARK_PIT] = TRUE,
        [FEAT_SHAL_WATER] = TRUE,
        [FEAT_DEEP_WATER] = TRUE, }

        local where = cave(player.py, player.px).feat

        if blessed_terrain[where] and celestials[player.pgod] then
                player.grace = 1 + player.grace
        end

        if cursed_terrain[where] and celestials[player.pgod] then
                player.grace = player.grace - 1
        end

        if fiery_terrain[where] and player.pgod == GOD_URIEL then
                player.grace = 1 + player.grace
        end


        if watery_dark[where] and player.pgod == GOD_URIEL then
                player.grace = player.grace -1
        end
end


add_hook_script(HOOK_PROCESS_WORLD, "___hook_angels_terrain", "___hook_angels_terrain")

Should work (not tested though ;)

Thanks, I will try it out :)

Module Developers Discussion/problem with piety in god script (last edited 2006-04-03 16:52:29 by host86-142-211-0)