Facebook Twitter YouTube Frictional Games | Forum | Privacy Policy | Dev Blog | Dev Wiki | Support | Gametee


Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Help with variable ints!
Mudbill Offline
Muderator

Posts: 3,881
Threads: 59
Joined: Apr 2013
Reputation: 179
#11
RE: Help with variable ints!

You're getting there, but there's still things to do to get it to work. Firstly, you do not need to name anything in the map BarrelCheck because this is just the integer's name and is only referenced in the script. Secondly, you must input your functions inside the if-statements. Where SR put the comments, you must put the script that is supposed to happen in that situation.

For example, instead of calling the function for when the container is cleaned or not, call ContainerOnBarrelCheck (don't forget to update the parameters if you do). Inside that function you put what happens when it is clearned inside the == 1 check, and what happens when it is not cleaned inside the other. What will happen is that only one of these if-statements are going to run when you use the item on the barrel, but which one it is is determined by what has happened before.

When you clean your barrel, run SetLocalVarInt("BarrelCheck", 1); to update the int. If you use the container on the barrel after this script has been run, it will execute the first if-statement instead of the second.

(This post was last modified: 03-19-2014, 01:58 PM by Mudbill.)
03-19-2014, 01:57 PM
Find
PutraenusAlivius Offline
Posting Freak

Posts: 4,713
Threads: 75
Joined: Dec 2012
Reputation: 119
#12
RE: Help with variable ints!

(03-19-2014, 01:57 PM)Mudbill Wrote: You're getting there, but there's still things to do to get it to work. Firstly, you do not need to name anything in the map BarrelCheck because this is just the integer's name and is only referenced in the script. Secondly, you must input your functions inside the if-statements. Where SR put the comments, you must put the script that is supposed to happen in that situation.

For example, instead of calling the function for when the container is cleaned or not, call ContainerOnBarrelCheck (don't forget to update the parameters if you do). Inside that function you put what happens when it is clearned inside the == 1 check, and what happens when it is not cleaned inside the other. What will happen is that only one of these if-statements are going to run when you use the item on the barrel, but which one it is is determined by what has happened before.

When you clean your barrel, run SetLocalVarInt("BarrelCheck", 1); to update the int. If you use the container on the barrel after this script has been run, it will execute the first if-statement instead of the second.

AddLocalVarInt is better IMO.

"Veni, vidi, vici."
"I came, I saw, I conquered."
03-19-2014, 02:02 PM
Find
Mudbill Offline
Muderator

Posts: 3,881
Threads: 59
Joined: Apr 2013
Reputation: 179
#13
RE: Help with variable ints!

Yeah, I suppose. I just like to use Set when I don't need to add so I don't add unnecessary values.

In this particular case, I would use a boolean though.

03-19-2014, 02:26 PM
Find




Users browsing this thread: 1 Guest(s)