need help with triggering -1 reply

  • 1
  • 2

Please wait...

Guest

I didn't make it!

0 XP

 
#1 10 years ago

I've tried searching for this, but I couldn't find the answer, although I know its probably around somewhere.

Anyway...what I'm basically trying to do is have multiple lights, each being triggered separately by the same button. So pretty much, when the screen reads 1 only light 1 is on, when the screen reads 2 only light 2 is on...when the screen reads 3 only light 3 is on, and so forth...

How do I accomplish this?




~*Seto*~

Trapped in the interchet

50 XP

19th October 2007

0 Uploads

334 Posts

0 Threads

#2 10 years ago

Well it would be simple with scripting, but without... maybe there is some clever way to utilize target_activate/deactivates?




SathiroN

< I met Jesus once.

50 XP

13th January 2004

0 Uploads

158 Posts

0 Threads

#3 10 years ago

When the screen reads? I don't know if this is the answer to your question but try using target_delay('s) and set them to longer and longer periods of time. Also Target_relays are cool!.




Nozyspy

31,830 XP

30th August 2004

12 Uploads

2,853 Posts

0 Threads

#4 10 years ago

Hmmmm i dont know how to do this myself i am afraid, although i have the feeling you would need a script for this, especially if you want the screen on a control panel or something to change numbers and light entities as you press it each time (i think thats what you mean?).




Guest

I didn't make it!

0 XP

 
#5 10 years ago

Thought I made that edit to explain it better.

Anyway, let me break it down so that everyone can understand what I'm trying to say. Since I'm not sure how to go about doing it, I'll just explain what I want the end result to be.

I want to be able to create a terminal that:

1) will cycle through three or more brushes (each brush basically textured with a white number on a black background). Each brush is then connected to say a light or a force field that is turned off to begin with. I know that with two func_usables, I would just set one to be on, and the other to be off and connect them both to a trigger_multiple. Have the trigger use the use button...and away I go. But how do I do the same thing with three or more func_usables; so that only 1 func_usable is displayed at a time, and you would use the use button to cycle through all three?

2) All that being said...I want each func_usable to connect to a different trigger (hold on, not done yet) but NOT activate them yet. Once I have the func_usable well, displaying...I want a second trigger_multiple to activate the trigger connected to that func_usable...but not activate the other two triggers connected to the other two func_usables.

Do you see what it is I'm trying to do? Now, please don't tell me it can't be done because I KNOW it can...as I've seen it done on various JKA maps. I would very much prefer that who ever it is that is able to help me to please make their response in a step by step type tutorial sorta thing. If I have to use scripts to do all of this, then I will...but please break that down for me as well.

Thanks in advance.




~*Seto*~

Trapped in the interchet

50 XP

19th October 2007

0 Uploads

334 Posts

0 Threads

#6 10 years ago

Lemme verify that I understand you...

You want 1 button to cycle through 3 states. Each state consists of a number on a screen and another trigger that activates elsewhere. Only 1 state will ever be active at a time. Is this correct?

Also, depending on how your number on screen setup is, you might find shader remapping a better alternative to func_usable. Look at this tutorial and see if this method would work better for you or not (Map-Craft - Tutorial Profile: Shader Remapping). (It won't really matter in the end which you do, just pick what is easier).

Once you respond to verify these issues, I will gladly explain how you can script your scenario.




Crazy Assassin

Overlord of Various Things

50 XP

25th August 2008

0 Uploads

428 Posts

0 Threads

#7 10 years ago

One word: Script.

Hmmm... To call NAB622, or to try this one myself... Meh, I need the practice.

You'll only need 1 brush for this. Make it a func_static with the switch_shader flag. For the shader, make it an animMap that switches between all three states you want. Give it they key script_targetname, and set it to button_123.

Now onto the scripts, which will come as soon as I write them.




Crazy Assassin

Overlord of Various Things

50 XP

25th August 2008

0 Uploads

428 Posts

0 Threads

#8 10 years ago

Ok, done.

In front of your screen-of-numbers, make a trigger. This trigger should target a scriptrunner, which uses this script:

Spoiler: Show

//Generated by BehavEd

rem ( "Check the button's state, then do the action!" );

if ( get( FLOAT, "button123"), =, 1 ) { use ( "button123_state1" ); }

if ( get( FLOAT, "button123"), =, 2 ) { use ( "button123_state2" ); }

if ( get( FLOAT, "button123"), =, 3 ) { use ( "button123_state3" ); }

the button123_state1/2/3 are the targetnames of whatever it is you want triggered.

Next, we need a script that will actually change the state of the button:

Spoiler: Show

//Generated by BehavEd

rem ( "Make the button change states!" ); declare ( /*@DECLARE_TYPE*/ FLOAT, "button123" ); set ( "button123", "0" );

loop ( -1 ) { wait ( 3000.000 ); set ( "button123", "1" ); use ( "button_123" ); wait ( 3000.000 ); set ( "button123", "2" ); use ( "button_123" ); wait ( 3000.000 ); set ( "button123", "3" ); use ( "button_123" ); }

This should be used when the map starts. I think you can make it run from the worldspawn, but I can't remember how. Alternatively, you can use a trigger_always. Also, for your func_static, make it's targetname button_123, not script_targetname. (You only need targetname if you're just using the 'use' function.)

That SHOULD be it. If I missed anything, just let me know. :D




NAB622

EAT ME!

50 XP

8th October 2005

0 Uploads

6,921 Posts

0 Threads

#9 10 years ago

Wow, not only did Seto beat me this time, so did Crazy!

There are several ways to accomplish your goal. Seto is looking at it one way, and Crazy is looking at it a different way. Don't get confused!

If you need a quick-start scripting tutorial, I started writing one a while back. Take a look at it if you like.

Basic Scripting - NAB622's Website

I'm sure there's another one floating around somewhere, but I'm unaware of it.




~*Seto*~

Trapped in the interchet

50 XP

19th October 2007

0 Uploads

334 Posts

0 Threads

#10 10 years ago
Crazy Assassin;4758570I think you can make it run from the worldspawn, but I can't remember how.

That would be by using the "spawnscript" key, which actually works on any entity including worldspawn. However one thing about using it on the worldspawn is that it specifically will temporarily create a new scriptrunner entity as the last ent of the map in order to run the script, meaning that the global script you want running will not run until all other ents have already done their initializations. This usually isn't a problem, but for certain sensitive script events it could be, which is why I personally prefer to run instant scripts via a dummy entity placed just after the worldspawn (an info_notnull with spawnscript, for example) to ensure that the script does indeed start running before anything else. But this is all slightly off topic, so I digress :p.

Anyways, looking at your looping script, isn't it a bit random? It seems like you are essentially having the script determine the state of the ents instead of waiting for user input. Of course, I've never used the shader flag on a func_static before, so maybe this has something to do with that... So correct me if I'm wrong, but it looks like when the user action runs the first script, the actual value of the variable could be anything based on the looping of the global script, meaning you wouldn't always get a user-controlled cycle from 1 to 2 to 3 to 1.




  • 1
  • 2