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
Script Help Movable Book [Solved]
ethics Offline
Member

Posts: 51
Threads: 18
Joined: Jan 2014
Reputation: 0
#1
Movable Book [Solved]

I had the idea that if you pull one of these movable books (located in a shelf) a door will be unlocked.
I've tried it with
SetEntityConnectionStateChangeCallback()
but I don't think these books are considered as levers.
I also tried to put a script area in front of it, so if I pull the book and it touches the area, a callback will be called.
I got stuck there because it seems to work with variables and "if int=1, int=<3, int++" and I don't understand that.
Do you have any idea on how to complete this?

(This post was last modified: 05-10-2014, 10:29 AM by ethics.)
05-01-2014, 09:14 PM
Find
Mudbill Offline
Muderator

Posts: 3,881
Threads: 59
Joined: Apr 2013
Reputation: 179
#2
RE: Movable Book

I think what you saw was a for-loop, not an if-statement. For-loops generally look something like

PHP Code: (Select All)
for(int i 0<= 3i++) {
    
OtherCode();


They basically repeat the code within for a set amount of times.

But you don't need these to make the script area trigger the event. Did you set an AddEntityCollideCallback in OnStart using the book on the area?

(This post was last modified: 05-01-2014, 09:30 PM by Mudbill.)
05-01-2014, 09:30 PM
Find
daortir Offline
Senior Member

Posts: 422
Threads: 9
Joined: Sep 2013
Reputation: 18
#3
RE: Movable Book

For one book just add an entitycollidecallback between the book and a small area near it, that calls a function which unlocks the door. No need for variables with only 1 book ! : >

05-01-2014, 10:09 PM
Find
ethics Offline
Member

Posts: 51
Threads: 18
Joined: Jan 2014
Reputation: 0
#4
RE: Movable Book

(05-01-2014, 09:30 PM)Mudbill Wrote: I think what you saw was a for-loop, not an if-statement. For-loops generally look something like

PHP Code: (Select All)
for(int i 0<= 3i++) {
    
OtherCode();


They basically repeat the code within for a set amount of times.

But you don't need these to make the script area trigger the event. Did you set an AddEntityCollideCallback in OnStart using the book on the area?

Nope. I just used "SetEntityConnectionStateChangeCallback()".
I gonna try that, but yesterday evening I was too confused to figure it out by myself.
As always, thanks for your help.

(05-01-2014, 10:09 PM)daortir Wrote: For one book just add an entitycollidecallback between the book and a small area near it, that calls a function which unlocks the door. No need for variables with only 1 book ! : >

Yeah, I saw that too. I also looked in your script, but it had "for-loops" in it. That confused me quite a bit.
Thanks for helping!

(This post was last modified: 05-02-2014, 09:38 AM by ethics.)
05-02-2014, 09:36 AM
Find
DnALANGE Offline
Banned

Posts: 1,549
Threads: 73
Joined: Jan 2012
#5
RE: Movable Book

Solved or?
Just a hint Ztp;
When your question \ tread is solved add this to your tread so people like me do not have to go into your tread anymore.
Do this for example : [SCRIPT] Movable Book = SOLVED
05-02-2014, 02:30 PM
Find
ethics Offline
Member

Posts: 51
Threads: 18
Joined: Jan 2014
Reputation: 0
#6
RE: Movable Book

(05-02-2014, 02:30 PM)DnALANGE Wrote: Solved or?
Just a hint Ztp;
When your question \ tread is solved add this to your tread so people like me do not have to go into your tread anymore.
Do this for example : [SCRIPT] Movable Book = SOLVED

I'm adding it to all my solved threads now.
Thanks for noticing.

05-10-2014, 10:27 AM
Find




Users browsing this thread: 1 Guest(s)