Page 1 of 1

change color of area?

Posted: Sun Sep 04, 2005 10:47 pm
by kkcahdcakcyt
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.

Dynamic lights

Posted: Mon Sep 05, 2005 4:02 am
by tltrude
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).

Posted: Mon Sep 05, 2005 10:36 pm
by kkcahdcakcyt
sweet thanks

dynamic lights

Posted: Fri Sep 09, 2005 3:09 am
by kkcahdcakcyt
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

Posted: Fri Sep 09, 2005 9:08 am
by bdbodger
I think he means make your flag a script_model or you can use the fx/dummy.tik that is a model that does not draw and is commonly used for dynamic lights .

Posted: Sat Sep 10, 2005 9:52 pm
by kkcahdcakcyt
***edited***

nvm figured it out :) thanks for you help guys

Posted: Sun Sep 11, 2005 2:25 am
by bdbodger
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

Posted: Sun Sep 11, 2005 2:46 am
by kkcahdcakcyt
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
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

Posted: Sun Sep 11, 2005 2:51 am
by GiffE1118
try defining something as the random int eg local.random = randomint(3)

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 
end
but this is how i would set up random coords

Code: 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 )
and to make use it do this

Code: Select all

$green.origin  = level.randomcoord[randomint(9)]

Posted: Sun Sep 11, 2005 11:08 am
by bdbodger
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:

Posted: Sun Sep 11, 2005 12:29 pm
by GiffE1118
try this it much cleaner

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

Posted: Sun Sep 11, 2005 2:56 pm
by kkcahdcakcyt
thanks much, you guys taught me more than you could imagine in those few replies :D

Posted: Sun Sep 11, 2005 4:07 pm
by bdbodger
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