IrocJeff Posted February 5, 2015 Posted February 5, 2015 (edited) I'm looking to make some sort of "mouth" for my brain so when it talks people can kinda get that its the brain talking. You've seen this in older sci fi things like Robbie the Robot or Robot B9 from Lost in Space when they talk some light flashes behind some glass. I wanted to do something similar if it was possible w/ scripting. Here's a clip showing the Robot speak and the red light flashing. There are a few examples of it for 30 seconds. http://youtu.be/jfh-YY465HA?t=1m34s Just cut and paste this into youtube. For some reason the link doesn't work properly. Edited February 5, 2015 by IrocJeff
Lazarus Posted February 5, 2015 Posted February 5, 2015 you could run an animap on it (on and off textures combined in an animation) that you trigger via activate / deactivate. The downside is that it becomes a loop after so many times so you will spot a pattern. But thats just a rough idea.
IrocJeff Posted February 5, 2015 Author Posted February 5, 2015 you could run an animap on it (on and off textures combined in an animation) that you trigger via activate / deactivate. The downside is that it becomes a loop after so many times so you will spot a pattern. But thats just a rough idea. Well, that is an idea. I'm not really 100% needing this I think it'd just make the final scene a bit better. How about this scenario. I have already set up light entities in test maps to work off of a trigger, so they turn off and on when activated/deactivated. Could I script that action in Behaved where each off/on cycle of the light last for various times. Say 100ms then 50ms then 75ms then 30ms then whatever. This should created an effect of random flashing.
Ramikad Posted February 5, 2015 Posted February 5, 2015 How about this scenario. I have already set up light entities in test maps to work off of a trigger, so they turn off and on when activated/deactivated. Could I script that action in Behaved where each off/on cycle of the light last for various times. Say 100ms then 50ms then 75ms then 30ms then whatever. This should created an effect of random flashing. It should be possible, because you trigger the turning on and off of any light by using the light itself. You can WAIT those times, then USE it, then USE it again after another WAIT to set the timing.
Vulcan Posted February 5, 2015 Posted February 5, 2015 You could create a script with various tasks, and then add a "do" random 0-5 I assume.Just name the tasks 0-5, all with other wait commands
IrocJeff Posted February 5, 2015 Author Posted February 5, 2015 I'm alright with NPC behavior but I haven't scripted much anything else so bear with me. I created a light entity and called itscript_targetnameflash My script has Affect "flash" Task (default) ??????? Now, I know to name the task but what the heck do I use for the task to make the light trigger on? This is the part that confuses me. This could be totally wrong how I set it up so feel free to chime here.
Ramikad Posted February 5, 2015 Posted February 5, 2015 Simply USE flash, I think. That's how lights are turned on and off, or on and a different lightstyle. Try and see if it works. Then the various WAIT instructions to set the timing.
IrocJeff Posted February 6, 2015 Author Posted February 6, 2015 Here is my script and using USE doesn't seem to work. My light is just on. Flash is the target_scriptname of the light entityI have it set up to test with a scriptrunner and a trigger once. affect ( "flash", 56 ) { task ( "task1" ) { use ( "flash" ); } task ( "task2" ) { use ( "flash" ); } task ( "task3" ) { use ( "flash" ); } task ( "task4" ) { use ( "flash" ); } task ( "task5" ) { use ( "flash" ); } task ( "task6" ) { use ( "flash" ); } task ( "task7" ) { use ( "flash" ); } do ( "task1" ); wait ( "task1" ); wait ( 700.000 ); do ( "task2" ); wait ( "task2" ); wait ( 500.000 ); do ( "task3" ); wait ( "task3" ); wait ( 700.000 ); do ( "task4" ); wait ( "task4" ); wait ( 500.000 ); do ( "task5" ); wait ( "task5" ); wait ( 700.000 ); do ( "task6" ); wait ( "task6" ); wait ( 500.000 ); do ( "task7" ); wait ( "task7" ); }
ensiform Posted February 6, 2015 Posted February 6, 2015 If the light doesn't actually have a "targetname", it will not be a light that sticks around, it'll be stripped from the bsp. script_targetname doesn't count.
Lazarus Posted February 6, 2015 Posted February 6, 2015 No need to write so many lines for using the same entity, just define one task and call it and use it in a loop.. affect ( "flash", 56 ) { task ( "task1" ) { use ( "flash" ); } loop ( -1 ) { do ( "task1" ); wait ( 700.000 ); do ( "task1" ); wait ( 500.000 ); } }This will keep flashing it on and off as well and won't stop. For your script up there you just repeat it like 9 times. so instead of -1 you can use 9. I suggest you target a trigger_multiple actually (i did the same with my target speaker) and make that link to your light, then you know for sure it works. btw, whats the 56 in your definition of light? affect ( "flash", /*@AFFECT_TYPE*/ FLUSH ) should be the normal type. it flushes the current behaviour and then starts off
IrocJeff Posted February 6, 2015 Author Posted February 6, 2015 If the light doesn't actually have a "targetname", it will not be a light that sticks around, it'll be stripped from the bsp. script_targetname doesn't count. Do I just give the light a targetname and then reference that name in the affect command?
IrocJeff Posted February 6, 2015 Author Posted February 6, 2015 No need to write so many lines for using the same entity, just define one task and call it and use it in a loop.. affect ( "flash", 56 ) { task ( "task1" ) { use ( "flash" ); } loop ( -1 ) { do ( "task1" ); wait ( 700.000 ); do ( "task1" ); wait ( 500.000 ); } }This will keep flashing it on and off as well and won't stop. For your script up there you just repeat it like 9 times. so instead of -1 you can use 9. I suggest you target a trigger_multiple actually (i did the same with my target speaker) and make that link to your light, then you know for sure it works. btw, whats the 56 in your definition of light? affect ( "flash", /*@AFFECT_TYPE*/ FLUSH ) should be the normal type. it flushes the current behaviour and then starts off No need to write so many lines for using the same entity, just define one task and call it and use it in a loop.. affect ( "flash", 56 ) { task ( "task1" ) { use ( "flash" ); } loop ( -1 ) { do ( "task1" ); wait ( 700.000 ); do ( "task1" ); wait ( 500.000 ); } }This will keep flashing it on and off as well and won't stop. For your script up there you just repeat it like 9 times. so instead of -1 you can use 9. I suggest you target a trigger_multiple actually (i did the same with my target speaker) and make that link to your light, then you know for sure it works. btw, whats the 56 in your definition of light? affect ( "flash", /*@AFFECT_TYPE*/ FLUSH ) should be the normal type. it flushes the current behaviour and then starts off I'm not great with scripting outside of NPC behavior so I'm not good at writing condensed scripts. hehe. That 56 is shown when you open up your script in Debehave. I guess that 56 means flush.
IrocJeff Posted February 6, 2015 Author Posted February 6, 2015 At any rate, none of this is working for me as of yet.
Lazarus Posted February 6, 2015 Posted February 6, 2015 Try this: I made a trigger_multiple that is connected with the light entities. I set them to 800 to see if they were working propperly. I called the trigger multiple lightswitch as targetname, and made it tiny and placed it somewhere against my ceiling so it couldn't be activated by me walking in it. I made a new trigger on the ground (trigger_once) and connected it to a target_scriptrunner. Made it call my script called light1 //Generated by BehavEd rem ( "switch lights on and off in loop" ); task ( "toggle_off" ) { use ( "lightswitch" ); wait ( 500.000 ); } task ( "toggle_on" ) { use ( "lightswitch" ); wait ( 2000.000 ); } loop ( -1 ) { dowait ( "toggle_on" ); dowait ( "toggle_off" ); print ( "!this is a test message!" ); } worked like a charm. It was looped so it went on and off constantly with the message in the middle of my screen. So in my case, i didnt affect anything, since there was nothing to affect. The lights were connected to the trigger i simply called from out of a task. Now i forgot to mention my lights were done the oposite right now. Went on for half a second, then off for 2 seconds because i forgot that my light entities started already on. Just as a headsup. edit As stated below by @@ensiform, its better to make a relay instead of a trigger_multiple. Just give it the targetname of the trigger_multiple I said up there (lightswitch) and it works fine.. tested and confirmed. And way cleaner
ensiform Posted February 6, 2015 Posted February 6, 2015 Do I just give the light a targetname and then reference that name in the affect command?I'm not very sure what to do really. I assume, you would need to use a relay as the target pointing to it and then script the relay.
IrocJeff Posted February 7, 2015 Author Posted February 7, 2015 Try this: I made a trigger_multiple that is connected with the light entities. I set them to 800 to see if they were working propperly. I called the trigger multiple lightswitch as targetname, and made it tiny and placed it somewhere against my ceiling so it couldn't be activated by me walking in it. I made a new trigger on the ground (trigger_once) and connected it to a target_scriptrunner. Made it call my script called light1 //Generated by BehavEd rem ( "switch lights on and off in loop" ); task ( "toggle_off" ) { use ( "lightswitch" ); wait ( 500.000 ); } task ( "toggle_on" ) { use ( "lightswitch" ); wait ( 2000.000 ); } loop ( -1 ) { dowait ( "toggle_on" ); dowait ( "toggle_off" ); print ( "!this is a test message!" ); } worked like a charm. It was looped so it went on and off constantly with the message in the middle of my screen. So in my case, i didnt affect anything, since there was nothing to affect. The lights were connected to the trigger i simply called from out of a task. Now i forgot to mention my lights were done the oposite right now. Went on for half a second, then off for 2 seconds because i forgot that my light entities started already on. Just as a headsup. edit As stated below by @@ensiform, its better to make a relay instead of a trigger_multiple. Just give it the targetname of the trigger_multiple I said up there (lightswitch) and it works fine.. tested and confirmed. And way cleaner That worked out really well. Thanks for the help. I never knew, nor thought, you could activate a trigger or relay from a script to activate something. I have to play with the timing to make it more to my liking. Now, I should be able to call this script within my original script, correct? and not have to set it up with a trigger, right?
Lazarus Posted February 7, 2015 Posted February 7, 2015 That worked out really well. Thanks for the help. I never knew, nor thought, you could activate a relay from a script to activate something. I knew about the trigger, since i use it on my own npcs (remember in my map the alarm sequence, its a use option within a script to fire up whole stormy spawn sequence and alarm sounds) I didnt knew either you could skip out the the trigger brush and just replace it with a relay with a targetname to fire. I thought relays were more to keep your map clean of lines. I guess i was wrong. Learning something new everyday here. (so yea, i swapped out already the trigger brush and replaced it with a relay in my map) Now, I should be able to call this script within my original script, correct? and not have to set it up with a trigger, right? You cant unfortunatly call inmieadtly to a script in a script. You can however call to a scriptrunner to run by using the use command to targetname in a scriprunner. I did some checking in the KOR1 map that is as reference placed. I used Devaheb to decompile the starting scripts (the landing on korriban and how scripts are set concerning light or dark side, due to what happened on taspir) Bassically what happens is this if ( $get( FLOAT, "SET_OBJECTIVE_LIGHTSIDE")$, $=$, $2$ ) { use ( "DSencounter" ); use ( "DSmusic" ); //(BHVDREM) run ( "kor1/encounter1_D" ); } else ( ) { use ( "LSencounter" ); use ( "LSmusic" ); //(BHVDREM) run ( "kor1/encounter1_L" ); } it checks in an if and else statement if the lightside is set to 2... if so, run dark, else light side. The use reference to target_scriptrunners in the map (they are placed next to the ship model if you open the map, so you can see for yourself) So to answer your question. Just drop an extra scriptrunner in your map with the script in it and in your current script just use the "use" key.
IrocJeff Posted February 7, 2015 Author Posted February 7, 2015 I knew about the trigger, since i use it on my own npcs (remember in my map the alarm sequence, its a use option within a script to fire up whole stormy spawn sequence and alarm sounds) I didnt knew either you could skip out the the trigger brush and just replace it with a relay with a targetname to fire. I thought relays were more to keep your map clean of lines. I guess i was wrong. Learning something new everyday here. (so yea, i swapped out already the trigger brush and replaced it with a relay in my map) You cant unfortunatly call inmieadtly to a script in a script. You can however call to a scriptrunner to run by using the use command to targetname in a scriprunner. I did some checking in the KOR1 map that is as reference placed. I used Devaheb to decompile the starting scripts (the landing on korriban and how scripts are set concerning light or dark side, due to what happened on taspir) Bassically what happens is this if ( $get( FLOAT, "SET_OBJECTIVE_LIGHTSIDE")$, $=$, $2$ ) { use ( "DSencounter" ); use ( "DSmusic" ); //(BHVDREM) run ( "kor1/encounter1_D" ); } else ( ) { use ( "LSencounter" ); use ( "LSmusic" ); //(BHVDREM) run ( "kor1/encounter1_L" ); } it checks in an if and else statement if the lightside is set to 2... if so, run dark, else light side. The use reference to target_scriptrunners in the map (they are placed next to the ship model if you open the map, so you can see for yourself) So to answer your question. Just drop an extra scriptrunner in your map with the script in it and in your current script just use the "use" key. You confused me a bit with if/else statements and the use key. To run a script within a script isn't that what the "run" command is for? So, if I were to put the flashing light script within my task that's all I should need. The script will run both the sound file and the flashing lights for each task, right? affect ( "braindroid", /*@AFFECT_TYPE*/ FLUSH ) { task ( "line1" ) { sound ( /*@CHANNELS*/ CHAN_VOICE, "sound/brain/line1.wav" ); run ( whatever path to flashing light script) } Now, if this flashing light script is set for an infinite loop, am I going to run into problems with it being set up that way within each task?
IrocJeff Posted February 7, 2015 Author Posted February 7, 2015 My way worked properly, barring the infinite loop. When you use it it won't switch to the next task. The light just keeps going off and on. But, if you put a set number of loops in the tasks will switch. So, now I just have to change the loop counts to match up w/ each wav files length and I should be good. Thanks for all the help Lazarus likes this
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now