Mafia Scene - Mafia I & II Game Fan Site

Modders Corner => Mafia Editing => Mafia II mods => Topic started by: ahmeeed_321 on January 28, 2019, 12:34:11 PM

Title: Lua codes to take shower, use toilet, wash hands in joe's flat
Post by: ahmeeed_321 on January 28, 2019, 12:34:11 PM
Before performing these animations you should first have basic_anim.sds with all required animations in it








You can download it here with all lua files, injector included http://www.mediafire.com/file/1ar7645pqcxarb1/Interact.zip/file (http://www.mediafire.com/file/1ar7645pqcxarb1/Interact.zip/file)








After downloading copy all files to mafia ii/pc folder and backup basic_anim.sds if you want








After launching game and injector, Press F1 to "use toilet", F2 to "take shower", F3 to return to default walk style after taking shower, F4 to wash hands, F5 to sit down








Note: these animations only works in Joe's flat due to newvector commands. You can change the vector if you want other places








Here's video showcase 








<div>

<iframe allowfullscreen="true" frameborder="0" height="270" src="https://www.youtube.com/embed/PLZzGYl3-z8?feature=oembed" width="480"></iframe>



</div>





 








Sorry if some of these are buggy as I am pretty newbie in such lua codes. It even took me hours to figure out how to use lua and edit sds files








I am also having trouble in "setdir" commands to set the direction of the player. Every time I use this command with the recorded coordinate the lua refuses to perform these animations. Also I am still finding ways to use the E key without the need of injector. If any expert in lua codding here please tell me how can I improve these lua scripts by using E key and how can I change the direction of the player using vector commands and not just the position. Thanks








 






<pre class="ipsCode prettyprint lang-html prettyprinted">

ply=game.game:GetActivePlayer()

DelayBuffer:Insert(function(l_1_0)

CommandBuffer:Insert(l_6_0,{

function(l_1_0)return ply:SetControlStyle(enums.ControlStyle.LOCKED)end,

function(l_2_0)return ply:SetPhysState(enums.PhysicsState.DISABLED)end,

function(l_2_0)return ply:SetPos(Math:newVector(78.977386474609, 894.04113769531, -13.307103157043))end,

function(l_2_0)return ply:AnimPlay("sc_worker_pissing_in", false)end,

function(l_3_0)return ply:AnimPlay("sc_worker_pissing_stat", false)end,

function(l_4_0)return ply:AnimPlay("sc_worker_pissing_stat", false)end,

function(l_5_0)return ply:AnimPlay("sc_worker_pissing_wide", false)end,

function(l_6_0)return ply:AnimPlay("sc_worker_pissing_out", false)end,

function(l_2_0)return ply:SetPhysState(enums.PhysicsState.ENABLED)end,

function(l_8_0)return ply:SetControlStyle(enums.ControlStyle.FREE)end})

end,{l_1_0},500,1,false)</pre>



<pre class="ipsCode prettyprint lang-html prettyprinted">

ply=game.game:GetActivePlayer()

DelayBuffer:Insert(function(l_1_0)

CommandBuffer:Insert(l_6_0,{

function(l_1_0)return ply:SetControlStyle(enums.ControlStyle.LOCKED)end,

function(l_2_0)return game.hud:FaderFadeOut(500)end,

function(l_3_0)return ply:SetPos(Math:newVector(86.15470123291, 891.68402099609, -13.3220911026))end,

function(l_4_0)game.game:ChangePlayerModel("vitnah_t")end,

function(l_5_0)return game.hud:FaderFadeIn(500)end,

function(l_6_0)return ply:AnimPlay("sc_prisoner_shower_wash_in", false)end,

function(l_7_0)return ply:AnimPlay("sc_prisoner_shower_wash_stat", false)end,

function(l_8_0)return ply:AnimPlay("sc_prisoner_shower_wash_c", false)end,

function(l_9_0)return ply:AnimPlay("sc_prisoner_shower_wash_out", false)end,

function(l_10_0)return ply:AnimPlay("sc_prisoner_shower_wash_in", false)end,

function(l_7_0)return ply:AnimPlay("sc_prisoner_shower_wash_stat", false)end,

function(l_11_0)return ply:AnimPlay("sc_prisoner_shower_wash_b", false)end,

function(l_14_0)return ply:AnimPlay("sc_prisoner_shower_wash_in", false)end,

function(l_16_0)return ply:AnimPlay("sc_prisoner_shower_wash_a", false)end,

function(l_7_0)return ply:AnimPlay("sc_prisoner_shower_wash_stat", false)end,

function(l_17_0)return ply:AnimPlay("sc_prisoner_shower_wash_out", false)end,

function(l_18_0)return game.hud:FaderFadeOut(500)end,

function(l_19_0)return ply:SetPhysState(enums.PhysicsState.Disabled)end,

function(l_20_0)return ply:SetPos(Math:newVector(85.935424804688, 892.66986083984, -12.976872444153))end,

function(l_21_0)return game.hud:FaderFadeIn(500)end,

function(l_22_0)return ply:SetAnimStyle("common","ManWinterCrossHands")end,

function(l_23_0)return ply:SetControlStyle(enums.ControlStyle.FREE)end})

end,{l_1_0},500,1,false)</pre>





 






<pre class="ipsCode prettyprint lang-html prettyprinted">

ply=game.game:GetActivePlayer()

DelayBuffer:Insert(function(l_1_0)

CommandBuffer:Insert(l_6_0,{

function(l_1_0)return ply:SetControlStyle(enums.ControlStyle.LOCKED)end,

function(l_2_0)return ply:SetPhysState(enums.PhysicsState.DISABLED)end,

function(l_3_0)return ply:SetPos(Math:newVector(79.203666687012, 894.61267089844, -13.322269439697))end,

function(l_2_0)return ply:AnimPlay("sc_gangster_WC_wash", false)end,

function(l_2_0)return ply:AnimPlay("sc_gangster_WC_wash", false)end,

function(l_2_0)return ply:SetPhysState(enums.PhysicsState.Enabled)end,

function(l_8_0)return ply:SetControlStyle(enums.ControlStyle.FREE)end})

end,{l_1_0},500,1,false)</pre>