Mafia Scene - Mafia I & II Game Fan Site

Modders Corner => Mafia Editing => Mafia Mod Request => Topic started by: jaca37 on June 03, 2012, 06:40:00 AM

Title: Multiple models under one script.
Post by: jaca37 on June 03, 2012, 06:40:00 AM
Could anybody write a script for me, in which I could switch through multiple models using just one key?




I'm using this cript for single model:


 







QuoteDelayBuffer:Insert(function(l_1_0)CommandBuffer:Insert(l_6_0,{function(l_1_0)game.game:ChangePlayerModel("cpoli3")end})end,{l_1_0},100,1,false)

 




I'd be very grateful  (//wp-content/uploads/invision_emoticons/smile.png)" data-emoticon="" srcset="/wp-content/uploads/invision_emoticons/smile@2x.png 2x" width="20" height="20">
Title: Multiple models under one script.
Post by: Director on June 03, 2012, 08:36:01 AM
Hi, it is this.




You can change the player model anytime, anywhere.




100% working.


 


 


 




<div class="ipsSpoiler_header">



ply=game.game:GetActivePlayer()




if i==nil then i=0 end i=i+1 if i==13+1 then i=1 end




DelayBuffer:Insert(function(l_1_0)if i==1 then game.game:ChangePlayerModel("vitarmy")end end,{l_1_0},250,1,false)




DelayBuffer:Insert(function(l_1_0)if i==2 then game.game:ChangePlayerModel("vitksl2")end end,{l_1_0},250,1,false)




DelayBuffer:Insert(function(l_1_0)if i=(//smile3.gif) then game.game:ChangePlayerModel("vitnah_t")end end,{l_1_0},250,1,false)




DelayBuffer:Insert(function(l_1_0)if i==4 then game.game:ChangePlayerModel("vitoveral")end end,{l_1_0},250,1,false)




DelayBuffer:Insert(function(l_1_0)if i==5 then game.game:ChangePlayerModel("vitspo")end end,{l_1_0},250,1,false)




DelayBuffer:Insert(function(l_1_0)if i==6 then game.game:ChangePlayerModel("vittel")end end,{l_1_0},250,1,false)




DelayBuffer:Insert(function(l_1_0)if i==7 then game.game:ChangePlayerModel("vitukl")end end,{l_1_0},250,1,false)




DelayBuffer:Insert(function(l_1_0)if i==8 then game.game:ChangePlayerModel("vitvez")end end,{l_1_0},250,1,false)




DelayBuffer:Insert(function(l_1_0)if i==9 then game.game:ChangePlayerModel("vitvop")end end,{l_1_0},250,1,false)




DelayBuffer:Insert(function(l_1_0)if i==10 then game.game:ChangePlayerModel("vitvov")end end,{l_1_0},250,1,false)




DelayBuffer:Insert(function(l_1_0)if i==11 then game.game:ChangePlayerModel("vitvov2i")end end,{l_1_0},250,1,false)




DelayBuffer:Insert(function(l_1_0)if i==12 then game.game:ChangePlayerModel("vitvov3")end end,{l_1_0},250,1,false)




</div>

 
Title: Multiple models under one script.
Post by: eXistenZ34 on June 03, 2012, 12:47:06 PM
jaca37




DelayBuffer:Insert & CommandBuffer:Insert for one commande is not necessary.


 




in FR Script for change player model this is sufficient.







Quotegame.game:ChangePlayerModel("Name_model")

 




But the game crashes when using injector with direct control of this type.




that's why we use a delay.







QuoteDelayBuffer:Insert(function(l_1_0) xxxxx
 end,{l_1_0},250
,1
,false)

xxxxx
 = your command

250
 = delay (millisecond) before activation of the command




1
 = number of times to repeat the fonction


 




Test to understand the function "DelayBuffer":







QuoteDelayBuffer:Insert(function(l_1_0)game.game:SaveGame(1) end,{l_1_0},10000
,10
,false)
a backup is performed every 10
 second (10000 milli) for10
 times. 




So in the end, we have.







QuoteDelayBuffer:Insert(function(l_1_0)game.game:ChangePlayerModel("Name_model")end,{l_1_0},250,1,false)

 




and for "x" choices.







Quoteif i==nil then i=0 end i=i+1 if i==x+1
 then i=1 end

DelayBuffer:Insert(function(l_1_0)if i==1 then game.game:ChangePlayerModel("Name_model")end end,{l_1_0},250,1,false)




DelayBuffer:Insert(function(l_1_0)if i==2 then game.game:ChangePlayerModel("Name_model")end end,{l_1_0},250,1,false)




DelayBuffer:Insert(function(l_1_0)if i=(//smile3.gif) .......







don't write x+1
 but if you have 5 model, write 6.
Title: Multiple models under one script.
Post by: Director on June 03, 2012, 03:53:55 PM
Thank you eXistenZ34.




You are more experienced than me.




I'm just learning.
Title: Multiple models under one script.
Post by: jaca37 on June 03, 2012, 04:10:16 PM
Thank both of you guys. Especially Existenz for this small tutorial  <img src="/wp-content/uploads/invision_emoticons/wink.png" alt="(//wink.gif)" data-emoticon="" srcset="/wp-content/uploads/invision_emoticons/wink@2x.png 2x" width="20" height="20">