change color of area?
Moderator: Moderators
-
kkcahdcakcyt
- Sergeant
- Posts: 71
- Joined: Wed Aug 03, 2005 11:16 pm
change color of area?
I was thinking of making a king of the hill gametype
any ideas on how the change the color of an area (make it green to show the area to capture, then blue or red when allies or axis enters)
wondering if it could be done like how mefy's lazers turn things a tint.
any ideas on how the change the color of an area (make it green to show the area to capture, then blue or red when allies or axis enters)
wondering if it could be done like how mefy's lazers turn things a tint.
Dynamic lights
Dynamic lights are like the light you see from muzzle flashes. It is done with script_models that have light properties set.
Key: light
Value: 300 <--default size light
Key: _color
Value: 1 0 0 <--red
The three numbers are for red, green, and blue light (RGB).
Key: light
Value: 300 <--default size light
Key: _color
Value: 1 0 0 <--red
The three numbers are for red, green, and blue light (RGB).
-
kkcahdcakcyt
- Sergeant
- Posts: 71
- Joined: Wed Aug 03, 2005 11:16 pm
dynamic lights
one more question
Can i spawn script_model lights through a script?
something like
spawn script_model model (idk)
then put origins and area here?
I'm a newb so I also am not sure where to place the key and values
Can i spawn script_model lights through a script?
something like
spawn script_model model (idk)
then put origins and area here?
I'm a newb so I also am not sure where to place the key and values
-
kkcahdcakcyt
- Sergeant
- Posts: 71
- Joined: Wed Aug 03, 2005 11:16 pm
spawn script_model "targetname" "green"
$green model "fx/dummy.tik"
$green.origin = (350 300 20)
$green light 0 1 0 // red green blue
$green lightradius 300
or
spawn script_model "targetname" "green"
$green model "fx/dummy.tik"
$green.origin = (350 300 20)
$green light 0 1 0 300 // red green blue radius
$green model "fx/dummy.tik"
$green.origin = (350 300 20)
$green light 0 1 0 // red green blue
$green lightradius 300
or
spawn script_model "targetname" "green"
$green model "fx/dummy.tik"
$green.origin = (350 300 20)
$green light 0 1 0 300 // red green blue radius
-
kkcahdcakcyt
- Sergeant
- Posts: 71
- Joined: Wed Aug 03, 2005 11:16 pm
thanks, lol i just figured it out by looking at the local.player light thingy
another question (i have tons lol)
I can't get my switch to work
I have a "thread hill" in my main method
another question (i have tons lol)
I can't get my switch to work
I have a "thread hill" in my main method
hill:
switch (randomint (5)+1)
case "1":
local.origin = ( 350 300 20 )
thread light
break
case "2":
local.origin = ( 100 100 10 )
thread light
break
case "3":
local.origin = ( 200 200 20 )
thread light
break
case "4":
local.origin = ( -300 -300 20 )
thread light
break
case "5":
local.origin = ( -200 -100 20 )
thread light
break
case "6":
local.origin = ( 300 100 20 )
thread light
break
end
light:
spawn script_model "targetname" "green"
$green model "fx/corona_green_bright.tik"
$green.origin = (local.origin)
$green light 0 1 0 900
end
try defining something as the random int eg local.random = randomint(3)
so...
but this is how i would set up random coords
and to make use it do this
so...
Code: Select all
hill:
local.random = (randomint (5)+1)
switch ( local.random )
case "1":
local.origin = ( 350 300 20 )
thread light
break
case "2":
local.origin = ( 100 100 10 )
thread light
break
case "3":
local.origin = ( 200 200 20 )
thread light
break
case "4":
local.origin = ( -300 -300 20 )
thread light
break
case "5":
local.origin = ( -200 -100 20 )
thread light
break
case "6":
local.origin = ( 300 100 20 )
thread light
break
end
light:
spawn script_model "targetname" "green"
$green model "fx/corona_green_bright.tik"
$green.origin = (local.origin)
$green light 0 1 0 900
endCode: Select all
level.randomcoord[0] = ( 2156.875 -1438.412 -55.875 )
level.randomcoord[1] = ( 2332.385 -1551.127 -55.875 )
level.randomcoord[2] = ( 2374.809 -2287.071 8.125 )
level.randomcoord[3] = ( 2101.902 -427.023 -63.875 )
level.randomcoord[4] = ( 3962.835 -820.758 16.125 )
level.randomcoord[5] = ( 3169.406 -1069.319 8.125 )
level.randomcoord[6] = ( 2253.985 -968.268 152.125 )
level.randomcoord[7] = ( 2379.787 -1574.194 144.125 )
level.randomcoord[8] = ( 2329.904 -2452.166 208.125 )
level.randomcoord[9] = ( 1705.661 -1839.621 144.125 )Code: Select all
$green.origin = level.randomcoord[randomint(9)]local.random = (randomint (5)+1)
switch ( local.random )
{ // you need one of these here
case "1":
local.origin = ( 350 300 20 )
thread light //You didn't pass the value of local.origin to the other thread also local is local to this thread
break
case "2":
local.origin = ( 100 100 10 )
thread light //You didn't pass the value of local.origin to the other thread also local is local to this thread
break
case "3":
local.origin = ( 200 200 20 )
thread light //You didn't pass the value of local.origin to the other thread also local is local to this thread
break
case "4":
local.origin = ( -300 -300 20 )
thread light //You didn't pass the value of local.origin to the other thread also local is local to this thread
break
case "5":
local.origin = ( -200 -100 20 )
thread light //You didn't pass the value of local.origin to the other thread also local is local to this thread
break
case "6":
local.origin = ( 300 100 20 )
thread light //You didn't pass the value of local.origin to the other thread also local is local to this thread
break
} // you need one of these here
end
How about this instead a bit shorter
hill:
switch (randomint (5)+1)
{
case 1:
local.origin = ( 350 300 20 );break
case 2:
local.origin = ( 100 100 10 );break
case 3:
local.origin = ( 200 200 20 );break
case 4:
local.origin = ( -300 -300 20 );break
case 5:
local.origin = ( -200 -100 20 );break
case 6:
local.origin = ( 300 100 20 );break
}
thread light local.origin // we pass the value to the next thread
end
light local.origin:
switch ( local.random )
{ // you need one of these here
case "1":
local.origin = ( 350 300 20 )
thread light //You didn't pass the value of local.origin to the other thread also local is local to this thread
break
case "2":
local.origin = ( 100 100 10 )
thread light //You didn't pass the value of local.origin to the other thread also local is local to this thread
break
case "3":
local.origin = ( 200 200 20 )
thread light //You didn't pass the value of local.origin to the other thread also local is local to this thread
break
case "4":
local.origin = ( -300 -300 20 )
thread light //You didn't pass the value of local.origin to the other thread also local is local to this thread
break
case "5":
local.origin = ( -200 -100 20 )
thread light //You didn't pass the value of local.origin to the other thread also local is local to this thread
break
case "6":
local.origin = ( 300 100 20 )
thread light //You didn't pass the value of local.origin to the other thread also local is local to this thread
break
} // you need one of these here
end
How about this instead a bit shorter
hill:
switch (randomint (5)+1)
{
case 1:
local.origin = ( 350 300 20 );break
case 2:
local.origin = ( 100 100 10 );break
case 3:
local.origin = ( 200 200 20 );break
case 4:
local.origin = ( -300 -300 20 );break
case 5:
local.origin = ( -200 -100 20 );break
case 6:
local.origin = ( 300 100 20 );break
}
thread light local.origin // we pass the value to the next thread
end
light local.origin:
try this it much cleaner
all local's are erased after the thread ends UNLESS u pass it on as bdbodger said
you could also pass it on by
level waittill spawn
thread light
end
light:
spawn script_model "targetname" "green"
$green model "fx/corona_green_bright.tik"
$green.origin = thread get_hill_location
$green light 0 1 0 900
end
get_hill_location:
switch (randomint (5)+1)
{
case 1:
local.origin = ( 350 300 20 );break
case 2:
local.origin = ( 100 100 10 );break
case 3:
local.origin = ( 200 200 20 );break
case 4:
local.origin = ( -300 -300 20 );break
case 5:
local.origin = ( -200 -100 20 );break
case 6:
local.origin = ( 300 100 20 );break
}
end local.origin
ending local.origin passes the origin back to the thread that exec it.
making $green.origin = local.origin
thats just another example of passing values
all local's are erased after the thread ends UNLESS u pass it on as bdbodger said
Code: Select all
level.randomcoord[0] = ( -300 -300 20 )
level.randomcoord[1] = ( -200 -100 20 )
level.randomcoord[2] = ( 200 200 20 )
level.randomcoord[3] = ( -300 -300 20 )
level.randomcoord[4] = ( -200 -100 20 )
level.randomcoord[5] = ( 300 100 20 )
level waittill spawn
thread light
end
light:
spawn script_model "targetname" "green"
$green model "fx/corona_green_bright.tik"
$green.origin = level.randomcoord[randomint(5)]
$green light 0 1 0 900
end
you could also pass it on by
level waittill spawn
thread light
end
light:
spawn script_model "targetname" "green"
$green model "fx/corona_green_bright.tik"
$green.origin = thread get_hill_location
$green light 0 1 0 900
end
get_hill_location:
switch (randomint (5)+1)
{
case 1:
local.origin = ( 350 300 20 );break
case 2:
local.origin = ( 100 100 10 );break
case 3:
local.origin = ( 200 200 20 );break
case 4:
local.origin = ( -300 -300 20 );break
case 5:
local.origin = ( -200 -100 20 );break
case 6:
local.origin = ( 300 100 20 );break
}
end local.origin
ending local.origin passes the origin back to the thread that exec it.
making $green.origin = local.origin
thats just another example of passing values
-
kkcahdcakcyt
- Sergeant
- Posts: 71
- Joined: Wed Aug 03, 2005 11:16 pm
Yes 2 examples 1. how to pass a variable to another thread and 2. how to send a value back to a thread by putting it after the word end also
$green.origin = waitthread get_hill_location
waitthread will pause your thread untill it gets the answer back you can use both those things to send information back and forth here is an example
local.variable = 5
local.newvalue = waitthread do_something local.variable // pass local.variable to the thread and wait for the result
end
do_something local.passed_value: // as you see only the value is passed not the variable name so we give it a name local.passed_value
local.passed_value++
end local.passed_value // pass the result back
this example will make local.newvalue = to 6
$green.origin = waitthread get_hill_location
waitthread will pause your thread untill it gets the answer back you can use both those things to send information back and forth here is an example
local.variable = 5
local.newvalue = waitthread do_something local.variable // pass local.variable to the thread and wait for the result
end
do_something local.passed_value: // as you see only the value is passed not the variable name so we give it a name local.passed_value
local.passed_value++
end local.passed_value // pass the result back
this example will make local.newvalue = to 6


