Frictional Games Forum (read-only)

Full Version: Movable Book [Solved]
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
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?
I think what you saw was a for-loop, not an if-statement. For-loops generally look something like

PHP Code:
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?
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, 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:
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!
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)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.