Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

FPSC Classic Scripts / Transporter Question

Author
Message
SOLO DESIGN
16
Years of Service
User Offline
Joined: 30th Jul 2008
Location:
Posted: 21st Jun 2010 16:45
Hi,
Sorry in advance as I am not a progammer, but is it possible to have one transporter IN and many transporter Out's and switches that turn on/off the transporter Out's?

Simply put, X1 TRANSPORTER IN which links to a single TRANSPORTER OUT, but in the level there are multiple transporter outs that are tunred on/off by switches, so the player action is as follows -
Player walks into TRANSPORTER IN and comes out on 1st active TRANSPORTER OUT, flicks a switch which deactivates the 1st TRANSPORTER OUT and turns on another TRANSPORTER OUT (2nd one) somewhere else in the level.Player then goes to TRANSPORTER IN and moves to that position and so on.....

Any examples of code (no mod loaded) or thoughts for this would be appreciated, many thanks

Solo
Conjured Entertainment
AGK Developer
19
Years of Service
User Offline
Joined: 12th Sep 2005
Location: Nirvana
Posted: 21st Jun 2010 23:07 Edited at: 21st Jun 2010 23:44
The switches set a global variable, whereas each switch has a unique script that assigns the variable a unique value. (switch 3 sets global variable to 3)

The teleport in would then simply read that global variables value and then take appropriate action based on the value.

So, it would look kinda like this...

:state=0,plrwithinzone=1:state=1

:state=1:globalvar=18
:state=1,varequal=0:plrmoveto=nameoftarget1,state=2
:state=1,varequal=1:plrmoveto=nameoftarget2,state=2
:state=1,varequal=2:plrmoveto=nameoftarget3,state=2

:state=2,plrwithinzone=0:state=0

Again, the switches would set the variables values.
That would look something like this...

:state=0,plrwithizone=1,plrusingaction=1:state=1

:state=1:globalvar=18
:state=1,plrusingaction=0:setvar=1,state=2

...I chose global variable 18 at random.
That could be any number within range that is not being used in another script.

This is just one idea, so I am sure there are other ways of doing this effect or something similar.

It would also be possible for each switch to incorporate a place holder for the variable if you want the switch to toggle to the previous value.
That would look something like this...

:state=0,plrwithinzone=1,plrusingaction=1:state=1

:state=1,plrusingaction=0:state=2

:state=2:globalvar=18
:state=2,varequal=0:state=4
:state=2:decvar=1,state=3

:state=3:localvar=1
:state=3:incvar=1,state=2

:state=4:globalvar=18
:state=4:setvar=3,state=5

:state=5,plrwithinzone=1,plrusingaction=1:state=6

:state=6:globalvar=18
:state=6,plrusingaction=0:setvar=0,state=7

:state=7:localvar=1
:state=7,varequal=0:state=0
:state=7:decvar=1,state=8

:state=8:globalvar=18
:state=8:incvar=1,state=7


Here we can see that we reduce the global variable's current value to zero and at the same time we increment a local variable for the placeholder. (states 2 and 3)
Then we set the value of the global variable to 3 in state=4.

If the player hits the switch again then we set the global to zero and reduce the local variable place holder whilst we increment the global variable.
This resets the global variable to its original value.
We then loop the process by returning to state=0.

This creates a toggle for the switch.
I did not include the actions for sounds or alt textures to simplify illustration.

   Conjured Entertainment

 WARNING: Intense Madness
SOLO DESIGN
16
Years of Service
User Offline
Joined: 30th Jul 2008
Location:
Posted: 22nd Jun 2010 12:50
Many thanks Conjured I will give it a go.

Just one question though, would this type of scripting with variables work with X10 aswell as X9?

Regards

Solo

Conjured Entertainment
AGK Developer
19
Years of Service
User Offline
Joined: 12th Sep 2005
Location: Nirvana
Posted: 22nd Jun 2010 16:46 Edited at: 22nd Jun 2010 16:47
Quote: "Just one question though, would this type of scripting with variables work with X10 aswell as X9?"

No, unless they updated it to include the variables because it did not have them listed in its manual.
v109 brought the user variables to X9, but I'm not sure about X10 because I haven't used it in awhile so I don't know about its updates.
Maybe the user variables are the reason I went back to X9. (I don't remember)

   Conjured Entertainment

 WARNING: Intense Madness

Login to post a reply

Server time is: 2024-11-24 21:48:46
Your offset time is: 2024-11-24 21:48:46