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
Scripting advice: Filling a bucket by three consecutive Item Callbacks.
AlexWM05 Offline
Junior Member

Posts: 4
Threads: 2
Joined: Oct 2013
Reputation: 0
#1
Scripting advice: Filling a bucket by three consecutive Item Callbacks.

Hey! So it looks like my very first post here is going to be me swallowing my pride and asking for help! What a way to make an introduction. Heck, I'm not even quite sure if this message board is anywhere near as active as it was when the mod tools came out two years ago. But I am making a really big custom story for myself, more for my resume specifically. Better late than never, especially since I've already put thousands of hours of work on this...

So yeah, to the topic... HELP!

So I am designing a puzzle that involves filling a bucket of water. Instead of giving you a wall of text, here's a quick outlined summary.

THE PREMISE
Phase One: In a labyrinth-esque level, you find a room that has a small hole and a bucket.

Phase Two: You need to obtain what's resting in the bottom of that hole, so the player should figure out that the bucket could be of some use.

Phase Three: This labyrinth will have three pathways to three small separate levels. Each of these levels will have a certain element to get the player further towards solving the "hole and bucket" puzzle, like how there are hidden orb fragments in the torture rooms of the original.

Phase Four: Inside each room is a small water source, and each water source that you approach will fill your bucket 1/3 full. Visiting and solving all three specific rooms should earn you a full bucket of water.

Phase Five: You should have enough water to fill the hole in the labyrinth, allowing the needed object to float to you.

WHAT I KNOW

- I know that I will have to use the model editor to create some new entities that changes the description and function of the bucket's water levels (a 1/3 full bucket and a 2/3 full bucket.) I would have one entity removed and replaces with a different version of it when an item callback is used on the correct script area.

- I know how to make Phase Five work. I will do a fade out, a water pour sound effect, and have the entities appear before a fade in. Simple!

WHAT I NEED HELP WITH

- I have separated the three specific rooms with the water source from the main labyrinth level, making them each it's own specific level. There was too much data for all the levels to handle in unison before some entities and static objects failed to appear.

- In relation to this, I have learned that apparently some entites that you obtain from on level is not respond to Item Callbacks on other levels. The best given example is when I pick up an empty bucket in the labyrinth hall, and it will not respond to a script area in a different level that will have the small water sources.

- This is a non-linear quest. So I'm trying to find a way to make the bucket filling process work in any room in any order.

- I'm starting to believe that this is a situation where using Global Variables would be the ticket, but I'm not quite as familiar with how they work and how they are supposed to be properly used.

I hope I was clear enough with my explanation. I will in-hesitantly give some extra clarifications if there are other questions about this puzzle. The best I can ask for is an explanation on how using Global Variables can help.

So, thanks guys! And hello! Big Grin
10-12-2013, 12:58 AM
Find
DeAngelo Offline
Senior Member

Posts: 263
Threads: 26
Joined: Feb 2013
Reputation: 11
#2
RE: Scripting advice: Filling a bucket by three consecutive Item Callbacks.

Someone else can probably help better, but putting a use item callback in the hps of each water level, and then having it add to a GLOBAL variable each time would allow you to do it in any order. In my experience global variables work pretty much exactly like local ones except they can be called in other maps. Which actually makes me wonder why local ones even exist (I'm sure there's a reason) If the bucket will be in your inventory the whole time I really see no good reason why you'd need to make a seperate model for each "fill level" Just have the description of the bucket in your inventory be "There's not enough water in it yet" and when you've filled it all 3 times, remove it and replace it with a bucket in the inventory that says "I have enough water."

If you're having trouble getting the bucket from one level to work in a callback on another level (You may be doing something wrong as I'm pretty sure items work in callbacks regardless of where you got the item) you could try letting the player "click" on the water area instead of using the bucket. or even better, just have a script area around the water so that when the player gets close it just does it automatically and says "You put the water into the bucket" (I find players tend to get giddy when the game does something for them like that.)

A Late Night Drink http://www.moddb.com/mods/a-late-night-drink
Check out my LP channel, CatBearGaming, I take all Custom Story requests!
10-12-2013, 04:21 PM
Find
TheGreatCthulhu Offline
Member

Posts: 213
Threads: 10
Joined: Oct 2010
Reputation: 32
#3
RE: Scripting advice: Filling a bucket by three consecutive Item Callbacks.

Basically, use a global variable to set a value that indicates something of interest (if the player got the bucket, if the bucket is filled, etc.) - the values can be simple integers, or booleans, or strings, as long as you know what each value represents, you're good.

For example, if an object can have a number of different states, you can use SetGolobalVarInt(...) and represent those states as numbers 1, 2, 3, ...

If something can only be in one of two states, you can use a global bool variable (true/false), etc.

Then, in OnEnter() (not in OnStart()!) check these values to figure out what is the current state of things, and update stuff and/or add required callbacks accordingly.

Global variables basically allow you to carry information across levels, you just need to figure out how to encode it (represent it).
(This post was last modified: 10-12-2013, 07:31 PM by TheGreatCthulhu.)
10-12-2013, 07:29 PM
Find
AlexWM05 Offline
Junior Member

Posts: 4
Threads: 2
Joined: Oct 2013
Reputation: 0
#4
RE: Scripting advice: Filling a bucket by three consecutive Item Callbacks.

Wanted to take a moment to thank you guys. I'm getting the idea now. Smile

I'll be sure to upload and promote my custom story once it's ready. Hope you all like it!
10-18-2013, 10:16 PM
Find




Users browsing this thread: 2 Guest(s)