Frictional Games Forum (read-only)
Help with variable ints! - Printable Version

+- Frictional Games Forum (read-only) (https://www.frictionalgames.com/forum)
+-- Forum: Amnesia: The Dark Descent (https://www.frictionalgames.com/forum/forum-6.html)
+--- Forum: Custom Stories, TCs & Mods - Development (https://www.frictionalgames.com/forum/forum-38.html)
+---- Forum: Development Support (https://www.frictionalgames.com/forum/forum-39.html)
+---- Thread: Help with variable ints! (/thread-24878.html)

Pages: 1 2


RE: Help with variable ints! - Mudbill - 03-19-2014

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.


RE: Help with variable ints! - PutraenusAlivius - 03-19-2014

(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.


RE: Help with variable ints! - Mudbill - 03-19-2014

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.