Scripts / [SOLVED] Video Switch Script?

Author
Message
EyeFly
2
Years of Service
User Offline
Joined: 8th Nov 2021
Location: Oregon, United States
Posted: 2nd Jul 2022 22:30
Hello. I'm still new to scripting. I'm having trouble figuring out how to get a video to play using a switch. Can anyone help me with this?

I've tried combining the video zone Lua with the switch Lua but it doesn't work. I can't get a video slot to show up in the behavior like a sound does on the switch. Any help would be greatly appreciated.

The author of this post has marked a post as an answer.

Go to answer
AmenMoses
GameGuru Master
8
Years of Service
User Offline
Joined: 20th Feb 2016
Location: Portsmouth, England
Posted: 3rd Jul 2022 13:29 Edited at: 3rd Jul 2022 13:31
This post has been marked by the post author as the answer.
Here you go.

(attach to an active entity, connect to a switch, select the video from the behaviours pane)
Been there, done that, got all the T-Shirts!

Attachments

Login to view attachments
PM
EyeFly
2
Years of Service
User Offline
Joined: 8th Nov 2021
Location: Oregon, United States
Posted: 3rd Jul 2022 17:37
Awesome! Thank you. I'll try it today. I'll let you know if I got it working.
EyeFly
EyeFly
2
Years of Service
User Offline
Joined: 8th Nov 2021
Location: Oregon, United States
Posted: 3rd Jul 2022 20:14
Works like a charm. Thanks again! It's much appreciated.
EyeFly
sacdaly
10
Years of Service
User Offline
Joined: 31st Oct 2013
Location:
Posted: 17th Aug 2022 10:28
Hello, i am trying to get a video to play from a laptop entity i have tried to use this script but i have no knowledge of scripting.
AmenMoses is this possible? can i get the laptop to trigger a video any help would be appreciated.

Many Thanks
s clarke
AmenMoses
GameGuru Master
8
Years of Service
User Offline
Joined: 20th Feb 2016
Location: Portsmouth, England
Posted: 17th Aug 2022 16:51 Edited at: 17th Aug 2022 16:53
@sacdaly

So the script I provided works when the entity is activated, i.e. by a switch attached to it via the blobby logic connection system.

To change this in the script find this bit:

if Ent.activated == 1 then

and change it to however you want to trigger it.

For example if you want to trigger as soon as the player is close to the entity and looking towards it then:

1) add this line to the top of the script:
local U = require "scriptbank\\utillib"

2) replace the above mentioned logic with:
if Ent.activated == 0 and U.PlayerLookingNear( e, 100, 150 ) then

where '100' is the distance to player and '150' is the angle within which the entity has to be from the players eyeline. Play with the values to suit your needs.
Been there, done that, got all the T-Shirts!
PM
sacdaly
10
Years of Service
User Offline
Joined: 31st Oct 2013
Location:
Posted: 17th Aug 2022 17:16
Thank you, i will try this tomorrow , youre a
s clarke

Login to post a reply

Server time is: 2024-05-06 05:12:56
Your offset time is: 2024-05-06 05:12:56