Mafia 3 – Godmodescript – Need help

Download Mods for the Mafia Games Forums Mod Creation Mafia 3 – Godmodescript – Need help

This topic contains 2 replies, has 2 voices, and was last updated by LaZzieHeifer LaZzieHeifer 7 months, 1 week ago.

Viewing 3 posts - 1 through 3 (of 3 total)
  • Author
    Posts
  • #163363
    LaZzieHeifer
    LaZzieHeifer
    Participant

    Hello I’m Heifer or LaZzie,

    I wanted to make a godmodescript for the mafia 3 but I can’t get it to work and for some reasons this script keeps me from using meds. It does NOT work at all. The ammo or godmode. Any help would be much appreciated.

    togglePlayerGodMode = 0;

    togglePlayerGodMode = [[
    if togglePlayerGodMode == 0 then
    game.game:GetActivePlayer():InventorySetUnlimitedAmmo(true);
    game.game:GetActivePlayer():invulnerability(true);
    togglePlayerGodMode = 1;
    elseif togglePlayerGodMode == 1 then
    game.game:GetActivePlayer():InventorySetUnlimitedAmmo(false);
    game.game:GetActivePlayer():invulnerability(false);
    togglePlayerGodMode = 0;
    end
    ]]

    unbindKey(“o”);
    bindKey(“o”, togglePlayerGodMode);

    Again thanks for the help. I know I might seem stupid for this but I do want to learn so yeah.

     

    BTW This is what it executes each time:

    if togglePlayerGodMode == 0 then
    game.game:GetActivePlayer():InventorySetUnlimitedAmmo(true);
    game.game:GetActivePlayer():invulnerability(true);
    togglePlayerGodMode = 1;
    elseif togglePlayerGodMode == 1 then
    game.game:GetActivePlayer():InventorySetUnlimitedAmmo(false);
    game.game:GetActivePlayer():invulnerability(false);
    togglePlayerGodMode = 0;
    end

    • This topic was modified 7 months, 2 weeks ago by LaZzieHeifer LaZzieHeifer.
    • This topic was modified 7 months, 2 weeks ago by LaZzieHeifer LaZzieHeifer.
    #163393
    Sladernimo
    Sladernimo
    Participant

    First problem is that togglePlayerGodMode never can be 0 or 1 because you say

     

    togglePlayerGodMode = 0; — here you set variable value to 0.

    togglePlayerGodMode = [[ — here you use the same variable and set value to a code block.

     

    Also invulnerability should be used like that:

    game.game:GetActivePlayer().invulnerability = true; — the “;” sign is not needed in lua but can be used

     

    So for example your code could look like this:

    togglePlayerGodModeSetting = 0

    togglePlayerGodModeFunction = [[
    if togglePlayerGodModeSetting == 0 then
    game.game:GetActivePlayer():InventorySetUnlimitedAmmo(true)
    game.game:GetActivePlayer().invulnerability = true
    togglePlayerGodModeSetting = 1
    elseif togglePlayerGodModeSetting == 1 then
    game.game:GetActivePlayer():InventorySetUnlimitedAmmo(false)
    game.game:GetActivePlayer().invulnerability = false
    togglePlayerGodModeSetting = 0
    end
    ]]

    unbindKey(“o”)
    bindKey(“o”, togglePlayerGodModeFunction)

     

    For additional help take a look at the scripting wiki and its links at http://mafia3scripting.wikia.com/

    Everyone can help to contibute the wiki 🙂

    • This reply was modified 7 months, 1 week ago by Sladernimo Sladernimo.
    #163394
    LaZzieHeifer
    LaZzieHeifer
    Participant

    Wow thanks man and thanks for explaining how to do it, I want to make a few script mods and this is going to help with that.

     

    Thanks again, If I happen to  add this to something I upload here or anywhere else what name should I use as credit?

Viewing 3 posts - 1 through 3 (of 3 total)

You must be logged in to reply to this topic.