Mafia Scene - Mafia I & II Game Fan Site

Modders Corner => Mafia Editing => Mafia mods => Topic started by: vapno92 on August 21, 2012, 06:43:06 PM

Title: VARIABLES - help!
Post by: vapno92 on August 21, 2012, 06:43:06 PM
Hello guys




Let's just tell, that I have two script


 




1. is like:




bla bla bla bla.....




let flt[0] = 2




bla bla bla bla.....




label 1




let flt[0] = flt[0]-1


 




2. is like:




bla bla bla bla.....




if flt[0]=1,1000,-1




bla bla bla bla.....




label 1000




do something


 




It doesn't work. How do I mafia get to share flt[0] between scripts? It seems like variables are local for each script.




I temporrary edited scripts so they are like:


 




1. is like:




findactor 1, "script2"




let flt[0] = 2




bla bla bla bla.....




bla bla bla bla.....




label 1




let flt[0] = flt[0]-1




label 69




if flt[0]=1,1000,-1




label 1000




setevent 1,100,-1


 




2. is like:




bla bla bla bla.....




bla bla bla bla.....




event 100




do something


 


 




It doesn't work. What am I doing wrong?




let flt[0] = 2 is before any labels, so it will do only once
Title: VARIABLES - help!
Post by: djbozkosz on August 21, 2012, 08:54:19 PM
Use get_remote_float or set_remote_float


 




get_remote_float xx, yy, zz - returns to xx a value in variable zz which is in script yy




xx - ID of variable in current script




yy - ID of actor remote script




zz - ID of remote variable in script yy


 




set_remote_float xx, yy, zz - sets variable xx as variable zz in script yy




xx - ID of variable in current script




yy - ID of actor remote script




zz - ID of remote variable in script yy


 




In your script:







<pre class="ipsCode">script_1:

...

let flt[1] = 2

...

label 1

let flt[1] = flt[1] - 1</pre>






 







<pre class="ipsCode">script_2:

// eg

findactor 3, "script_1"

...

// you have to use get_remote_float always, when you want to get a value from remote variable

get_remote_float 0, 3, 1

if flt[0] = 1, 1000, -1

...

label 1000

...</pre>
Title: VARIABLES - help!
Post by: AsaSK on August 21, 2012, 10:10:42 PM
As far as I was aware, variables have to be flagged in the hex, otherwise the script bypasses them as ordinary and inanimate commands.
Title: VARIABLES - help!
Post by: vapno92 on August 21, 2012, 10:21:35 PM
Thanks guys, I've already solved it. I typed "fintactor" instead "findactor", I am such a dickhead  :-[