Jump to content

Project Forth: Flowgraph Controlled Generic Buttons


mdgunn
 Share

Recommended Posts

Interlinked generic lockable toggle button with flowgraph controlled inputs outputs.  These are the same buttons. The on/off state of one unlocked button operating the locked/unlocked state of another which then (in this case) acts on the doors, controlling both at once.   Flowgraph based maps can be a problem at times (losing connections on changes) but in this scenario with quite generic objects it seems an attractive solution. I'll see how it goes, can always recode to work against references instead.


 

 

Heres the flow graph.  The lights are not fully complete but were going to more clearly indicate that the door was in a locked state at a distance. 

image.thumb.png.c5c5faf7ab988dc7cb60bd98e3dfb1f1.png

Link to comment
Share on other sites

I think I don't have these buttons set up in the  cryo level, just the test levels.  I still cannot work with the cryo level and it looks like I will have to rebuild which I wouldn't mind anyway.

The code here is not really tied to the code graph. You can call it in code as normal.

If you wanted to unlock the door you can just get a reference to the the button that is linked to the door through code and call the same unlock function yourself.  

You will know how to get a reference to an object I think?  Get it from setting up a link via dragging entity onto a public field  of the object from which you want to control the target (know what I mean?), or find it by scanning the world for named object (possibly bad performance).  Sometimes I will set up an invisible control object (CSG item with invisible/editor-only material on it) if I want to control things in code but have the object visible to editors on the map. 

-- Get a reference to the self.cryo_room_door_button by whatever means first.
if type(self.cryo_room_door_button.script.Unlock)=="function" then 
	self.cryo_room_door_button.script:Unlock()
end
-- door button should now response to user pressing it.
-- You could also open the door without user by calling similar functions on the door itself or calling unlock then open on the button.
-- If things done out of order or going round the back then user may not see what expect.  E.g. button may say not open but door could be open.

Note: things may still be open to some changes.

Note: I check the function exists on the script of the object before calling it for safety. Note that in the existence check it is .Unlock(with a dot)  but in actual call it is :Unlock (semi-colon). 

You probably know all this.  Maybe you want some more specific info.  Just let me know.

The doors I was going to avoid being manually open and force opening by a press button which can then open whatever door it is linked to even if has multiple parts.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

 Share

×
×
  • Create New...