running water script help plz

Started by Paranoia, Tue 08/07/2003 14:21:46

Previous topic - Next topic

Paranoia

Can you help me with this please?
I have two rooms, the first room has two pipes joined together leading to the second room… one pipe is open, the other has an object stuck in it, so when water is turned on the water runs through the open one, if you block the open pipe, the water diverts and pushes the other object out.of the other pipe
How would the script be for….
Turn on tape…if the pipe is open run an animation to show water coming out of pipe
If the pipes blocked run an animation of the object coming out of the other pipe, leaving that object in the room with the pipes

I hoped I explained that ok! :-[

thanks Paranoia

straston

I hope I undestood this correctly.

The way I would do it:

Define a global int Variable that indicates the state of the two pipes.

Value 0 : initial water completely turned off
Value 1 : open pipe has water running through
Value 2 : open pipe blocked, water running out of other pipe, object appears
Value 3 : whatever else you need...

In the room with the pipes, you can switch Objects on or off in the enter-room-before-fadein-script according to the value of the Global int

int pipe_state = GetGlobalInt(10);
if (pipe_state == 0)
{
// do nothing
}
else if (pipe_state == 1)
{
// run floating animation
...
}
...

Paranoia

sorry i'm thick,  :-[, script isn't my strong point, i'm not sure about the first part...
i'm sure its spot on straston, but i've got my "homer" head on at the moment..
Paranoia+script=DOH!

straston

Quote from: Paranoia on Wed 09/07/2003 00:12:51
sorry i'm thick,  :-[, script isn't my strong point, i'm not sure about the first part...
i'm sure its spot on straston, but i've got my "homer" head on at the moment..
Paranoia+script=DOH!

Spot on me? No, actually, there are probably better "scripters" than me round here.

I'm afraid you'll have to do scripting, sorry.  :-\

Maybe if the whole affair would be in just one room, it will work without too much scripting, but I'm not sure either. With two rooms, you'll have to bring the state of one room to the other and the only way to do that in AGS (as far as I know) is by using global variables.

It's hard to give you the exact code, because it will take a little while to consider and will be distributed among a lot of objects (the tap, both water streams, the object to fall out, the blocked pipe, possibly the start script of both rooms)

Maybe someone else can help?

evilspacefart

I don't even think you would need global ints.
Just objects. This works if you are willing to use One BIG room instead of two separate rooms. As straston explained, you need a global int to remember each room's state if you have two rooms.

ok here goes:

tap is off: there is no "tap-on" object. it is OFF. You simply check for this to know if tap is on or off.
turn on tap: turn "tap-on" object ON.

the anims are just views of more Objects.

if pipe is blocked, obviously "pipe-block" object set to ON. You can simply use this to check the blocked status.

change the anim VIEW of the running water depending if it is blocked or not.

when the item falls out to the other side of the room, turn that Object ON and all else off OR turn running water anim ON.

Then we know if the player can pick it up or not and it's presence also notes we have solved the puzzle. You can change a Room variable if you want.

I hope that made sense.   ;):P
I don't use too many globals since I forget which ones I used. (sorrry its a lame excuse)
I also like big scrollable rooms. 8)

Paranoia

thanks straston & evilspacefart, ok i've got 3 options..

1/ pray someone will do it for me, i'd IM the full room details etc

2/ go with the all in the same room idea, which i can do!, means making the room bigger scrolly one  but what the hell

3 mess about trying to learn script, throw my toys out of my pram a lot , and be a grumpy pain in the ass ;)

i'll go with the single room, so i can get the game finished, but if i have enuff time i'll work on the 2 room idea, at least if i fail or crack up the game is finished!, i've got to learn script for my big game anyway

thanks for all your help ;D

SMF spam blocked by CleanTalk