Page 1 of 1

Scripted light

Posted: Wed Feb 02, 2005 2:39 am
by HDL_CinC_Dragon
ok i got a light that is a script_model and it has the
model: fx/dummy.tik
classname: script_model
targetname: light

and then theres a trigger multiple in the map that when the player walks into it the light goes through RGB cycling every .5 seconds in some mad epileptic thing lol. but the multiple has
targetname: lighter

and heres the .scr

Code: Select all

Main:

setcvar "g_obj_alliedtext1" "Epilepsy"
setcvar "g_obj_alliedtext2" "Warning"
setcvar "g_obj_alliedtext3" "RGB"
setcvar "g_obj_axistext1" "Epilepsy"
setcvar "g_obj_axistext2" "Warning"
setcvar "g_obj_axistext3" "RGB"

setcvar "g_scoreboardpic" "none"

	level waittill prespawn
		thread light_ops
		$light light 400

	level waittill spawn

light_ops:
while(1)
	{
		$lighter waittill trigger
		$lighter nottriggerable
		$light _color 1.000000 0.000000 0.000000
		wait .5
		$light _color 0.000000 1.000000 0.000000
		wait .5
		$light _color 0.000000 0.000000 1.000000
		wait .5
		waitframe
	}
end
Tell me what I did wrong. This is my first attempt at light scripting.

the map is title light_test.map the script is titled light_test.scr. I put \\ in front off all the actuall scripting stuff except the "main:" and the "setcvar" things to see if the light script was messin it up but the whole thing didnt work... curious...
I use "Mohaa Script Editor" to write my scripts now... i like it =). but do u think that has anything to do with it?

Posted: Wed Feb 02, 2005 2:47 am
by lizardkid
make sure you're not trying to give the trigger AND the light values and such..
the light is wrote:targetname: light
the trigger is wrote:targetname: light

Posted: Wed Feb 02, 2005 2:47 am
by HDL_CinC_Dragon
oops the triggers targetname is "lighter" not "light" sry ill fix that in the thing up there.

Posted: Wed Feb 02, 2005 2:55 am
by Green Beret
try this

Code: Select all

level waittill prespawn
      thread light_ops

   level waittill spawn
end

light_ops:

      $lighter waittill trigger
      $lighter triggerable
      $light light 1 0 0 250//red 1 0 0 //color// 250 radius
      wait .5
      $light light 0 1 0 250//green
      wait .5
      $light light 0 0 1 250//blue
      wait .5
      $lighter nottriggerable
      goto light_ops
end
this code works if the targetnames are correct to the ones above.im not good at the while(1) { }stuff...lol

Posted: Wed Feb 02, 2005 5:26 am
by lizardkid
forget goto...

just do this instead

Code: Select all

while(1)
{
// code
}
it's much more controllable with a variable, but people seem to like 1 better.

light

Posted: Wed Feb 02, 2005 10:12 am
by tltrude
It is probably not a good idea to targetname the light as "light"--"light_01" or "light_bulb" might be better.

Green Beret's script should work well, except I think he has the triggerable and nottriggerable lines reversed. Actually, those two lines are not needed at all because the trigger will not be checked again until the thread is reset by the goto line.

Posted: Thu Feb 03, 2005 12:30 am
by HDL_CinC_Dragon
yeah the triggerable and nottriggerable lines are backwards and i use the while(1) stuff and things like that and ill change the targetname of light to light_01.
I wasnt that great at whe While(1) stuff either but i think im gettin the hang of it =)

Posted: Fri Feb 04, 2005 2:22 am
by HDL_CinC_Dragon
ok heres my .scr so far:

Code: Select all

main:

setcvar "g_obj_alliedtext1" "Epilepsy"
setcvar "g_obj_alliedtext2" "Warning"
setcvar "g_obj_alliedtext3" "RGB"
setcvar "g_obj_axistext1" "Epilepsy"
setcvar "g_obj_axistext2" "Warning"
setcvar "g_obj_axistext3" "RGB"

setcvar "g_scoreboardpic" "none"

	level waittill prespawn
		thread light_ops

	level waittill spawn

light_ops:
while(1)
	{
		$lighter waittill trigger
		$lighter nottriggerable
		$light_01 _color 1.000000 0.000000 0.000000 250
		wait .5
		$light_01 _color 0.000000 1.000000 0.000000 250
		wait .5
		$light_01 _color 0.000000 0.000000 1.000000 250
		wait .5
		$lighter triggerable
		waitframe
	}
end
this time, instead of a trigger_multiple and i have a trigger_use with this:
Image (click to enlarge).

but yeah when i press the button nothing happens...

Posted: Fri Feb 04, 2005 3:15 am
by bdbodger
You are useing the wrong values for this type of a dynamic light source . Try this instead

light_ops:
while(1)
{
$lighter waittill trigger
$lighter nottriggerable
$light_01 light 1 0 0 250
$light_01 lighton
wait .5
$light_01 light 0 1 0 250
wait .5
$light_01 light 0 0 1 250
wait .5
$lighter triggerable
waitframe
}
end

If you want the light to start on put

$light_01 light 1 0 0 250
$light_01 lighton

above the while(1) as well . You can just do $light_01 lightoff when you want it to shut off

Posted: Fri Feb 04, 2005 3:20 am
by Green Beret
im not the most expierienced here,but i think u need to add end after
level waittill spawn
i usually get better results doin it like that.but it sounds like BD is the one to listen to on this one.

Posted: Fri Feb 04, 2005 6:04 am
by lizardkid
end is to close threads, main is a thread, ONLY use end when that thread is done. if you have nothing but thread calls after level waittill spawn. definitely use end there. otherwise, you only have one thread *shrug*
so end it anyway, you need an end to enclose every thread.

Posted: Fri Feb 04, 2005 6:06 am
by wacko
Green Beret wrote:im not the most expierienced here,but i think u need to add end after
level waittill spawn
i usually get better results doin it like that.but it sounds like BD is the one to listen to on this one.
yes, definately! so, it should be

Code: Select all

main: 

setcvar "g_obj_alliedtext1" "Epilepsy" 
setcvar "g_obj_alliedtext2" "Warning" 
setcvar "g_obj_alliedtext3" "RGB" 
setcvar "g_obj_axistext1" "Epilepsy" 
setcvar "g_obj_axistext2" "Warning" 
setcvar "g_obj_axistext3" "RGB" 

setcvar "g_scoreboardpic" "none" 

   level waittill prespawn 
      thread light_ops 

   level waittill spawn
end 

light_ops: 
while(1) 
{ 
$lighter waittill trigger 
$lighter nottriggerable 
$light_01 light 1 0 0 250 
$light_01 lighton 
wait .5 
$light_01 light 0 1 0 250 
wait .5 
$light_01 light 0 0 1 250 
wait .5 
$lighter triggerable 
waitframe 
} 
end 

Posted: Fri Feb 04, 2005 8:11 pm
by HDL_CinC_Dragon
I would just like to say: "I LOVE YOU ALL!" it works now =) I added the "lighton" and changed the "_color" to "light" and all that goodness =) it does everything i want it to! Thnx guys! until next time.

Code: Select all

main:

setcvar "g_obj_alliedtext1" "Epilepsy"
setcvar "g_obj_alliedtext2" "Warning"
setcvar "g_obj_alliedtext3" "RGB"
setcvar "g_obj_axistext1" "Epilepsy"
setcvar "g_obj_axistext2" "Warning"
setcvar "g_obj_axistext3" "RGB"

setcvar "g_scoreboardpic" "none"

	level waittill prespawn
		thread light_ops
		$light_01 lightoff

	level waittill spawn
end

light_ops:
while(1)
	{
		$lighter waittill trigger
		$lighter nottriggerable
		$light_01 light 1.000000 0.000000 0.000000 250
		$light_01 lighton
		wait .5
		$light_01 light 0.000000 1.000000 0.000000 250
		wait .5
		$light_01 light 0.000000 0.000000 1.000000 250
		wait .5
		$light_01 lightoff
		$lighter triggerable
		waitframe
	}
end

Posted: Sat Feb 05, 2005 5:01 am
by Green Beret
Congrats,i love it how people like helpin till its working! 8-)

Posted: Sat Feb 05, 2005 5:13 pm
by HDL_CinC_Dragon
lol me too :D :D