spotlights on they own
Moderator: Moderators
- small_sumo
- Lieutenant General
- Posts: 953
- Joined: Mon Jul 01, 2002 4:17 pm
- Contact:
spotlights on they own
Below is my attenpt to make a modded spotlight scr, I have set it up just like it says but I have removed the gun and the ai. I was hopeing the spotlights would go on they own. I have had a small amount of success the spotlight has the beam and the corona (corona in wrong spot shucks) but they dont follow the path.
If someoen is keen to have a look and get it working for me I would be very happy, or at least give me some hints to try.
Thanks guys.
// Spotlight system created by Mackey McCandlish.
//
// Before level waittill prespawn "exec global/spotlight.scr".
//
// Used in m1l2a, m1l2b, m4l3, m6l2a, and probably some other place too.
//
// Create a script_model with model "miscobj/searchlightbase.tik"
//
// Give it a targetname "spotlight".
//
// Create an AI and a turretweapon_german_mg42. Target the spotlight to the guy to the gun.
//
// Create a trigger_multiple around the spotlight with targetname "spotdamage". Assign it the damage flag.
//
// Create a bunch of script_origins (At least 5) with targetname "spotsearch". These are the places the spotlight will flick
// to when it is in "Alert" mode.
//
// Give the spotlight, spotdamage, and spotsearches the same #set value. Also give them a #group value. The way it works is,
// and spotlights that are supposed to share proximity have the same #set value, but every set of spotlight/spotdamage/spot
// searches have their own unique #group to associate them together. So a bunch of spotlights working together would all have
// #set 1, but each set of spotlight/spotdamage/spotsearches would have a different #group.
//
// Along the ground, create a loop of info_splinepaths. The targetname of one of the splinepaths must be "spotpath#1_#2"
// where #1 is the #set value of the spotlight that is supposed to shine on this path, and #2 is the #group value of that
// spotlight.
//
// Whenever the spotlight completes its loop, level.spottime["spot#1_#2"] is equal to the current level.time. This let's you
// do neat stuff like the SAS agent dodging the spotlight.
//
// You can give vehicles coronas when their lights are on by doing:
// exec global/spotlight.scr::corona $truck "light left"
// exec global/spotlight.scr::corona $truck "light right"
//
// Where $truck is the name of the vehicle. "$truck.corona = 0" turns off the coronas (and you would normally do
// "$truck anim idlenolights" at the same place to turn off the model lights).
main:
level waittill prespawn
if ($spotlight == NULL)
level.spotlights = 0
else
level.spotlights = $spotlight.size
if (level.spotlights > 0)
{
level.spotlight = exec global/makearray.scr $spotlight
for (local.i=1;local.i<level.spotlights+1;local.i++)
{
level.spotlight[local.i] thread spotwatch
if (level.spotlight[local.i].set == NIL)
{
println ("Warning, spotlight at " + level.spotlight[local.i].origin + " has no #set, setting to 1")
level.spotlight[local.i].set = 1
}
}
}
end
spotpath:
local.path = $("spotpath" + self.set + "_" + self.group)
while (self.checkdeath == 0)
{
level.spottime[("spot" + self.set + "_" + self.group)] = level.time
self.org.origin = local.path.origin
self.org flypath local.path 250 750 200
self.org waitmove
}
end
seepath:
local.ent = spawn script_model
local.ent model animal/cockroach.tik
local.ent scale 100
local.ent notsolid
local.ent glue self
end
spotwatch:
level waittill spawn
if (self.target)
self scale 1
self.searchtime = level.time
self.lightdist = 0
local.light = spawn script_model
local.light model "fx/dummy.tik"
self.spotlight = local.light
if (getcvar(debug) == "1")
self.spotlight thread seepath
self.light = local.light
local.light light (1.0 1.0 1.0)
local.light lightRadius 300
local.light lightOn
local.light notsolid
self model "miscobj/searchlightbase.tik"
self.angles = (0 0 0)
local.bulb = spawn script_model
local.bulb model "miscobj/searchlight.tik"
local.bulb scale 1
local.bulb.origin = self.origin + (0 0 32)
self.bulb = local.bulb
local.bulb bind self
local.bulb notsolid
local.flare = spawn script_model
local.flare model "fx/searchlight.tik"
local.flare.origin = self.origin + (64 0 64)
self.flare = local.flare
local.flare bind self
local.flare notsolid
local.org = spawn script_origin
local.org.origin = self.origin
self.org = local.org
self.currentaim = self.org
self notsolid
// local.org anim start /////////////////////////////////////////////////////////////////////////////////////
local.org light (1.0 1.0 1.0)
local.org lightRadius 300
local.org lightOn
local.org notsolid
self thread spotpath
local.thread1 = parm.previousthread
self.mode = 0
local.skip = level.time
local.curframe = 0
local.threadtimer = level.time + 0.15
self thread light_corona
end
light_corona:
while (self.checkdeath == 0)
{
local.org = self.currentaim.origin
local.vect1 = (local.org - self.origin)
local.vect1 = vector_toangles (local.vect1)
local.angles = self.angles
local.angles[1] = local.vect1[1]
// self.angles = local.angles
local.angles = self.angles
local.angles[0] = local.vect1[0] + 180
local.angles[1] = 0
// self.bulb.angles = local.angles
local.vect = self.origin - self.currentaim.origin
local.vect = vector_normalize (local.vect)
local.dist = 16 // was 32
local.vect[0] = local.vect[0] * local.dist
local.vect[1] = local.vect[1] * local.dist
local.vect[2] = local.vect[2] * local.dist
self.flare.origin = self.bulb.origin - local.vect
self.flare scale 5
local.vect = $player.origin - self.origin
local.vect = vector_normalize (local.vect)
local.angles = angles_toforward ($player.angles)
local.vect[0] = local.vect[0] * local.angles[0]
local.vect[1] = local.vect[1] * local.angles[1]
local.vect[2] = local.vect[2] * local.angles[2]
local.org1 = $player.origin + (0 0 64)
local.ang1 = $player.angles
local.org2 = self.bulb.origin
local.ang2 = local.vect1
//println ("ang1 " + local.ang1 + " and ang2 " + local.ang2 + " and combined " + (local.ang1 + local.ang2))
// local.returnvalue = the value that you should use for an alpha
// local.v1 = angles_toforward local.ang1
local.v1 = vector_normalize (local.org1 - local.org2)
local.v2 = angles_toforward local.ang2
local.f1 = local.v1[0] * local.v2[0] + local.v1[1] * local.v2[1] + local.v1[2] * local.v2[2]
if(local.f1 > 0)
local.returnvalue = local.f1 * local.f1
else
local.returnvalue = 0
// corona
self.flare scale (local.returnvalue * 25)
waitframe
}
end
flame:
exec global/model.scr self.origin models/fx/fx_spotlighthit
end
If someoen is keen to have a look and get it working for me I would be very happy, or at least give me some hints to try.
Thanks guys.
// Spotlight system created by Mackey McCandlish.
//
// Before level waittill prespawn "exec global/spotlight.scr".
//
// Used in m1l2a, m1l2b, m4l3, m6l2a, and probably some other place too.
//
// Create a script_model with model "miscobj/searchlightbase.tik"
//
// Give it a targetname "spotlight".
//
// Create an AI and a turretweapon_german_mg42. Target the spotlight to the guy to the gun.
//
// Create a trigger_multiple around the spotlight with targetname "spotdamage". Assign it the damage flag.
//
// Create a bunch of script_origins (At least 5) with targetname "spotsearch". These are the places the spotlight will flick
// to when it is in "Alert" mode.
//
// Give the spotlight, spotdamage, and spotsearches the same #set value. Also give them a #group value. The way it works is,
// and spotlights that are supposed to share proximity have the same #set value, but every set of spotlight/spotdamage/spot
// searches have their own unique #group to associate them together. So a bunch of spotlights working together would all have
// #set 1, but each set of spotlight/spotdamage/spotsearches would have a different #group.
//
// Along the ground, create a loop of info_splinepaths. The targetname of one of the splinepaths must be "spotpath#1_#2"
// where #1 is the #set value of the spotlight that is supposed to shine on this path, and #2 is the #group value of that
// spotlight.
//
// Whenever the spotlight completes its loop, level.spottime["spot#1_#2"] is equal to the current level.time. This let's you
// do neat stuff like the SAS agent dodging the spotlight.
//
// You can give vehicles coronas when their lights are on by doing:
// exec global/spotlight.scr::corona $truck "light left"
// exec global/spotlight.scr::corona $truck "light right"
//
// Where $truck is the name of the vehicle. "$truck.corona = 0" turns off the coronas (and you would normally do
// "$truck anim idlenolights" at the same place to turn off the model lights).
main:
level waittill prespawn
if ($spotlight == NULL)
level.spotlights = 0
else
level.spotlights = $spotlight.size
if (level.spotlights > 0)
{
level.spotlight = exec global/makearray.scr $spotlight
for (local.i=1;local.i<level.spotlights+1;local.i++)
{
level.spotlight[local.i] thread spotwatch
if (level.spotlight[local.i].set == NIL)
{
println ("Warning, spotlight at " + level.spotlight[local.i].origin + " has no #set, setting to 1")
level.spotlight[local.i].set = 1
}
}
}
end
spotpath:
local.path = $("spotpath" + self.set + "_" + self.group)
while (self.checkdeath == 0)
{
level.spottime[("spot" + self.set + "_" + self.group)] = level.time
self.org.origin = local.path.origin
self.org flypath local.path 250 750 200
self.org waitmove
}
end
seepath:
local.ent = spawn script_model
local.ent model animal/cockroach.tik
local.ent scale 100
local.ent notsolid
local.ent glue self
end
spotwatch:
level waittill spawn
if (self.target)
self scale 1
self.searchtime = level.time
self.lightdist = 0
local.light = spawn script_model
local.light model "fx/dummy.tik"
self.spotlight = local.light
if (getcvar(debug) == "1")
self.spotlight thread seepath
self.light = local.light
local.light light (1.0 1.0 1.0)
local.light lightRadius 300
local.light lightOn
local.light notsolid
self model "miscobj/searchlightbase.tik"
self.angles = (0 0 0)
local.bulb = spawn script_model
local.bulb model "miscobj/searchlight.tik"
local.bulb scale 1
local.bulb.origin = self.origin + (0 0 32)
self.bulb = local.bulb
local.bulb bind self
local.bulb notsolid
local.flare = spawn script_model
local.flare model "fx/searchlight.tik"
local.flare.origin = self.origin + (64 0 64)
self.flare = local.flare
local.flare bind self
local.flare notsolid
local.org = spawn script_origin
local.org.origin = self.origin
self.org = local.org
self.currentaim = self.org
self notsolid
// local.org anim start /////////////////////////////////////////////////////////////////////////////////////
local.org light (1.0 1.0 1.0)
local.org lightRadius 300
local.org lightOn
local.org notsolid
self thread spotpath
local.thread1 = parm.previousthread
self.mode = 0
local.skip = level.time
local.curframe = 0
local.threadtimer = level.time + 0.15
self thread light_corona
end
light_corona:
while (self.checkdeath == 0)
{
local.org = self.currentaim.origin
local.vect1 = (local.org - self.origin)
local.vect1 = vector_toangles (local.vect1)
local.angles = self.angles
local.angles[1] = local.vect1[1]
// self.angles = local.angles
local.angles = self.angles
local.angles[0] = local.vect1[0] + 180
local.angles[1] = 0
// self.bulb.angles = local.angles
local.vect = self.origin - self.currentaim.origin
local.vect = vector_normalize (local.vect)
local.dist = 16 // was 32
local.vect[0] = local.vect[0] * local.dist
local.vect[1] = local.vect[1] * local.dist
local.vect[2] = local.vect[2] * local.dist
self.flare.origin = self.bulb.origin - local.vect
self.flare scale 5
local.vect = $player.origin - self.origin
local.vect = vector_normalize (local.vect)
local.angles = angles_toforward ($player.angles)
local.vect[0] = local.vect[0] * local.angles[0]
local.vect[1] = local.vect[1] * local.angles[1]
local.vect[2] = local.vect[2] * local.angles[2]
local.org1 = $player.origin + (0 0 64)
local.ang1 = $player.angles
local.org2 = self.bulb.origin
local.ang2 = local.vect1
//println ("ang1 " + local.ang1 + " and ang2 " + local.ang2 + " and combined " + (local.ang1 + local.ang2))
// local.returnvalue = the value that you should use for an alpha
// local.v1 = angles_toforward local.ang1
local.v1 = vector_normalize (local.org1 - local.org2)
local.v2 = angles_toforward local.ang2
local.f1 = local.v1[0] * local.v2[0] + local.v1[1] * local.v2[1] + local.v1[2] * local.v2[2]
if(local.f1 > 0)
local.returnvalue = local.f1 * local.f1
else
local.returnvalue = 0
// corona
self.flare scale (local.returnvalue * 25)
waitframe
}
end
flame:
exec global/model.scr self.origin models/fx/fx_spotlighthit
end
- small_sumo
- Lieutenant General
- Posts: 953
- Joined: Mon Jul 01, 2002 4:17 pm
- Contact:
I have made some improvements but still odnt have them moving around.
// Spotlight system created by Mackey McCandlish.
//
// Before level waittill prespawn "exec global/spotlight.scr".
//
// Used in m1l2a, m1l2b, m4l3, m6l2a, and probably some other place too.
//
// Create a script_model with model "miscobj/searchlightbase.tik"
//
// Give it a targetname "spotlight".
//
// Create an AI and a turretweapon_german_mg42. Target the spotlight to the guy to the gun.
//
// Create a trigger_multiple around the spotlight with targetname "spotdamage". Assign it the damage flag.
//
// Create a bunch of script_origins (At least 5) with targetname "spotsearch". These are the places the spotlight will flick
// to when it is in "Alert" mode.
//
// Give the spotlight, spotdamage, and spotsearches the same #set value. Also give them a #group value. The way it works is,
// and spotlights that are supposed to share proximity have the same #set value, but every set of spotlight/spotdamage/spot
// searches have their own unique #group to associate them together. So a bunch of spotlights working together would all have
// #set 1, but each set of spotlight/spotdamage/spotsearches would have a different #group.
//
// Along the ground, create a loop of info_splinepaths. The targetname of one of the splinepaths must be "spotpath#1_#2"
// where #1 is the #set value of the spotlight that is supposed to shine on this path, and #2 is the #group value of that
// spotlight.
//
// Whenever the spotlight completes its loop, level.spottime["spot#1_#2"] is equal to the current level.time. This let's you
// do neat stuff like the SAS agent dodging the spotlight.
//
// You can give vehicles coronas when their lights are on by doing:
// exec global/spotlight.scr::corona $truck "light left"
// exec global/spotlight.scr::corona $truck "light right"
//
// Where $truck is the name of the vehicle. "$truck.corona = 0" turns off the coronas (and you would normally do
// "$truck anim idlenolights" at the same place to turn off the model lights).
main:
level waittill prespawn
if ($spotlight == NULL)
level.spotlights = 0
else
level.spotlights = $spotlight.size
if (level.spotlights > 0)
{
level.spotlight = exec global/makearray.scr $spotlight
for (local.i=1;local.i<level.spotlights+1;local.i++)
{
level.spotlight[local.i] thread spotwatch
if (level.spotlight[local.i].set == NIL)
{
println ("Warning, spotlight at " + level.spotlight[local.i].origin + " has no #set, setting to 1")
level.spotlight[local.i].set = 1
}
if (level.spotlight[local.i].group == NIL)
println ("Error, spotlight at " + level.spotlight[local.i].origin + " has no #group")
else
println ("Spawned spotlight " + local.i)
}
}
end
spottracker:
end
spotpath:
local.path = $("spotpath" + self.set + "_" + self.group)
while (self.checkdeath == 0)
{
level.spottime[("spot" + self.set + "_" + self.group)] = level.time
self.org.origin = local.path.origin
self.org flypath local.path 250 750 200
self.org waitmove
}
end
seepath:
local.ent = spawn script_model
local.ent model animal/cockroach.tik
local.ent scale 100
local.ent notsolid
local.ent glue self
end
spotwatch:
level waittill spawn
if (self.target)
self scale 1
self.searchtime = level.time
self.lightdist = 0
local.light = spawn script_model
local.light model "fx/dummy.tik"
self.spotlight = local.light
if (getcvar(debug) == "1")
self.spotlight thread seepath
self.light = local.light
local.light light (1.0 1.0 1.0)
local.light lightRadius 300
local.light lightOn
local.light notsolid
self model "miscobj/searchlightbase.tik"
self.angles = (0 0 0)
local.bulb = spawn script_model
local.bulb model "miscobj/searchlight.tik"
local.bulb scale 1
local.bulb.origin = self.origin + (0 0 32)
self.bulb = local.bulb
local.bulb bind self
local.bulb notsolid
local.flare = spawn script_model
local.flare model "fx/searchlight.tik"
local.flare.origin = self.origin + (64 0 64)
self.flare = local.flare
local.flare bind self
local.flare notsolid
local.org = spawn script_origin
local.org.origin = self.origin
self.org = local.org
self.currentaim = self.org
self notsolid
//local.org anim start /////////////////////////////////////////////////////////////////////////////////////
local.org light (1.0 1.0 1.0)
local.org lightRadius 300
local.org lightOn
local.org notsolid
self thread spotpath
local.thread1 = parm.previousthread
self.mode = 0
local.skip = level.time
local.curframe = 0
local.threadtimer = level.time + 0.15
self thread light_corona
end
light_corona:
while (self.checkdeath == 0)
{
local.org = self.currentaim.origin
local.vect1 = (local.org - self.origin)
local.vect1 = vector_toangles (local.vect1)
local.angles = self.angles
local.angles[1] = local.vect1[1]
// self.angles = local.angles
local.angles = self.angles
local.angles[0] = local.vect1[0] + 180
local.angles[1] = 0
// self.bulb.angles = local.angles
local.vect = self.origin - self.currentaim.origin
local.vect = vector_normalize (local.vect)
local.dist = 16 // was 32
local.vect[0] = local.vect[0] * local.dist
local.vect[1] = local.vect[1] * local.dist
local.vect[2] = local.vect[2] * local.dist
self.flare.origin = self.bulb.origin - local.vect
self.flare scale 5
local.vect = $player.origin - self.origin
local.vect = vector_normalize (local.vect)
local.angles = angles_toforward ($player.angles)
local.vect[0] = local.vect[0] * local.angles[0]
local.vect[1] = local.vect[1] * local.angles[1]
local.vect[2] = local.vect[2] * local.angles[2]
local.org1 = $player.origin + (0 0 64)
local.ang1 = $player.angles
local.org2 = self.bulb.origin
local.ang2 = local.vect1
//println ("ang1 " + local.ang1 + " and ang2 " + local.ang2 + " and combined " + (local.ang1 + local.ang2))
// local.returnvalue = the value that you should use for an alpha
// local.v1 = angles_toforward local.ang1
local.v1 = vector_normalize (local.org1 - local.org2)
local.v2 = angles_toforward local.ang2
local.f1 = local.v1[0] * local.v2[0] + local.v1[1] * local.v2[1] + local.v1[2] * local.v2[2]
if(local.f1 > 0)
local.returnvalue = local.f1 * local.f1
else
local.returnvalue = 0
// corona
self.flare scale (local.returnvalue * 25)
waitframe
}
end
flame:
exec global/model.scr self.origin models/fx/fx_spotlighthit
end
// Spotlight system created by Mackey McCandlish.
//
// Before level waittill prespawn "exec global/spotlight.scr".
//
// Used in m1l2a, m1l2b, m4l3, m6l2a, and probably some other place too.
//
// Create a script_model with model "miscobj/searchlightbase.tik"
//
// Give it a targetname "spotlight".
//
// Create an AI and a turretweapon_german_mg42. Target the spotlight to the guy to the gun.
//
// Create a trigger_multiple around the spotlight with targetname "spotdamage". Assign it the damage flag.
//
// Create a bunch of script_origins (At least 5) with targetname "spotsearch". These are the places the spotlight will flick
// to when it is in "Alert" mode.
//
// Give the spotlight, spotdamage, and spotsearches the same #set value. Also give them a #group value. The way it works is,
// and spotlights that are supposed to share proximity have the same #set value, but every set of spotlight/spotdamage/spot
// searches have their own unique #group to associate them together. So a bunch of spotlights working together would all have
// #set 1, but each set of spotlight/spotdamage/spotsearches would have a different #group.
//
// Along the ground, create a loop of info_splinepaths. The targetname of one of the splinepaths must be "spotpath#1_#2"
// where #1 is the #set value of the spotlight that is supposed to shine on this path, and #2 is the #group value of that
// spotlight.
//
// Whenever the spotlight completes its loop, level.spottime["spot#1_#2"] is equal to the current level.time. This let's you
// do neat stuff like the SAS agent dodging the spotlight.
//
// You can give vehicles coronas when their lights are on by doing:
// exec global/spotlight.scr::corona $truck "light left"
// exec global/spotlight.scr::corona $truck "light right"
//
// Where $truck is the name of the vehicle. "$truck.corona = 0" turns off the coronas (and you would normally do
// "$truck anim idlenolights" at the same place to turn off the model lights).
main:
level waittill prespawn
if ($spotlight == NULL)
level.spotlights = 0
else
level.spotlights = $spotlight.size
if (level.spotlights > 0)
{
level.spotlight = exec global/makearray.scr $spotlight
for (local.i=1;local.i<level.spotlights+1;local.i++)
{
level.spotlight[local.i] thread spotwatch
if (level.spotlight[local.i].set == NIL)
{
println ("Warning, spotlight at " + level.spotlight[local.i].origin + " has no #set, setting to 1")
level.spotlight[local.i].set = 1
}
if (level.spotlight[local.i].group == NIL)
println ("Error, spotlight at " + level.spotlight[local.i].origin + " has no #group")
else
println ("Spawned spotlight " + local.i)
}
}
end
spottracker:
end
spotpath:
local.path = $("spotpath" + self.set + "_" + self.group)
while (self.checkdeath == 0)
{
level.spottime[("spot" + self.set + "_" + self.group)] = level.time
self.org.origin = local.path.origin
self.org flypath local.path 250 750 200
self.org waitmove
}
end
seepath:
local.ent = spawn script_model
local.ent model animal/cockroach.tik
local.ent scale 100
local.ent notsolid
local.ent glue self
end
spotwatch:
level waittill spawn
if (self.target)
self scale 1
self.searchtime = level.time
self.lightdist = 0
local.light = spawn script_model
local.light model "fx/dummy.tik"
self.spotlight = local.light
if (getcvar(debug) == "1")
self.spotlight thread seepath
self.light = local.light
local.light light (1.0 1.0 1.0)
local.light lightRadius 300
local.light lightOn
local.light notsolid
self model "miscobj/searchlightbase.tik"
self.angles = (0 0 0)
local.bulb = spawn script_model
local.bulb model "miscobj/searchlight.tik"
local.bulb scale 1
local.bulb.origin = self.origin + (0 0 32)
self.bulb = local.bulb
local.bulb bind self
local.bulb notsolid
local.flare = spawn script_model
local.flare model "fx/searchlight.tik"
local.flare.origin = self.origin + (64 0 64)
self.flare = local.flare
local.flare bind self
local.flare notsolid
local.org = spawn script_origin
local.org.origin = self.origin
self.org = local.org
self.currentaim = self.org
self notsolid
//local.org anim start /////////////////////////////////////////////////////////////////////////////////////
local.org light (1.0 1.0 1.0)
local.org lightRadius 300
local.org lightOn
local.org notsolid
self thread spotpath
local.thread1 = parm.previousthread
self.mode = 0
local.skip = level.time
local.curframe = 0
local.threadtimer = level.time + 0.15
self thread light_corona
end
light_corona:
while (self.checkdeath == 0)
{
local.org = self.currentaim.origin
local.vect1 = (local.org - self.origin)
local.vect1 = vector_toangles (local.vect1)
local.angles = self.angles
local.angles[1] = local.vect1[1]
// self.angles = local.angles
local.angles = self.angles
local.angles[0] = local.vect1[0] + 180
local.angles[1] = 0
// self.bulb.angles = local.angles
local.vect = self.origin - self.currentaim.origin
local.vect = vector_normalize (local.vect)
local.dist = 16 // was 32
local.vect[0] = local.vect[0] * local.dist
local.vect[1] = local.vect[1] * local.dist
local.vect[2] = local.vect[2] * local.dist
self.flare.origin = self.bulb.origin - local.vect
self.flare scale 5
local.vect = $player.origin - self.origin
local.vect = vector_normalize (local.vect)
local.angles = angles_toforward ($player.angles)
local.vect[0] = local.vect[0] * local.angles[0]
local.vect[1] = local.vect[1] * local.angles[1]
local.vect[2] = local.vect[2] * local.angles[2]
local.org1 = $player.origin + (0 0 64)
local.ang1 = $player.angles
local.org2 = self.bulb.origin
local.ang2 = local.vect1
//println ("ang1 " + local.ang1 + " and ang2 " + local.ang2 + " and combined " + (local.ang1 + local.ang2))
// local.returnvalue = the value that you should use for an alpha
// local.v1 = angles_toforward local.ang1
local.v1 = vector_normalize (local.org1 - local.org2)
local.v2 = angles_toforward local.ang2
local.f1 = local.v1[0] * local.v2[0] + local.v1[1] * local.v2[1] + local.v1[2] * local.v2[2]
if(local.f1 > 0)
local.returnvalue = local.f1 * local.f1
else
local.returnvalue = 0
// corona
self.flare scale (local.returnvalue * 25)
waitframe
}
end
flame:
exec global/model.scr self.origin models/fx/fx_spotlighthit
end
In my map "The rescue" I used a script for spotlights without ai . Just the lights moveing and shineing on the ground no damage no spotsearches . It is simple to use and make , just make the path targetname $spotpath for the first node and the script model base $targetname spotlight and use a #set and #group for each set of light/paths thats it .
I will send it to you if you want it .
I will send it to you if you want it .
- small_sumo
- Lieutenant General
- Posts: 953
- Joined: Mon Jul 01, 2002 4:17 pm
- Contact:
Wow its perfect, I am so impressed. I had your map in my directory ready to go, and your magic script was under my nose all this time.
Did your map have any server trouble with the jeep. I am very impressed with it to!
A little question I am supprised you overwrote the jeep.tik instead of renaming it?
Thanks so much, hood will be finnished tonight thanks to you.

Did your map have any server trouble with the jeep. I am very impressed with it to!
A little question I am supprised you overwrote the jeep.tik instead of renaming it?
Thanks so much, hood will be finnished tonight thanks to you.
- small_sumo
- Lieutenant General
- Posts: 953
- Joined: Mon Jul 01, 2002 4:17 pm
- Contact:
spotlights
i need some info ,,,<for me the noob,,,lol,,,to do the following,,,in m6l2a if i use bdbodgers spotlight script,,the spotlights all work great,,,now what i been trying to do is carry this over to some other m maps ,,now i understand that theres some things in the bsp that makes that work correctly ,what i need to know prob in some detail ,,,is it possible to spawn the spotlights and the mg42 guy which makes it work in m6l2a,,,all thru scripting in other m maps,,,can this can be done thru scripting only,because from my understanding in m6l2a the guys attached in some way to the light??,,if so i could then just exec global/rescue_spotlight.scr and the spotlights would work correctly,,,meaning move around,,etc,,if i have enough info on how to script it into a stock map,,,now as far as just spawning a actual spotlight into any map i can do that ,,,i just wanna know how to get them moving the same way they did in m6l2a ,,but only thru scripting,,,so basically if the info from the bsp could be tranfered into script form i could get working spotlights in any map that move around like they supposed 2,,,any info i would appreciate:)) i read the spotlight guide but it doesnt explain if all the above can be done thru scripting only for a stock map:(
Gold<<mohha freak
Gold<<mohha freak
ya see in my small thinking lol,,,i thought maybe ya could do something similiar or like the following and these just a example,,dont even know if those correct hehehe
spawn script_object "targetname" "spotpath" "classname" "info_splinepath"
$local.light.origin = ( 3337 -4063 1658)
$local.light.angles = ( 0 150 0)
$local.light.model = "miscobj/searchlightbase.tik"
local.light = spawn script_model
local.light model "miscobj/searchlightbase.tik"
local.light.origin = ( 200 -210 239 )
local.light.angles = ( 0 150 0 )
local.light solid
local.light = spawn script_model
local.light model "miscobj/searchlight.tik"
local.light.origin = ( 200 -210 269 )
local.light.angles = ( 20 -730 0 )
local.light notsolid
but i would have no idea how to script the above to make it connect up with these following examples that i copied from the bdbodgers map the rescue
"classname" "info_splinepath"
"targetname" "spotpath3_3"
"origin" "-1349 608 -62"
"target" "t24"
"classname" "info_splinepath"
"origin" "-774 3943 -75"
"target" "t1"
"targetname" "spotpath1_1"
}
// Entity #82
{
"classname" "script_model"
"model" "miscobj/searchlightbase.tik"
"testanim" "idle"
"angle" "90"
"origin" "-258.85 2857.62 721.00"
"targetname" "spotlight"
"#set" "1"
"#group" "1"
}
maybe that info will help ya guys understand more about what im tryin to do?? hopefully hehehehe
Gold<<mohha freak
spawn script_object "targetname" "spotpath" "classname" "info_splinepath"
$local.light.origin = ( 3337 -4063 1658)
$local.light.angles = ( 0 150 0)
$local.light.model = "miscobj/searchlightbase.tik"
local.light = spawn script_model
local.light model "miscobj/searchlightbase.tik"
local.light.origin = ( 200 -210 239 )
local.light.angles = ( 0 150 0 )
local.light solid
local.light = spawn script_model
local.light model "miscobj/searchlight.tik"
local.light.origin = ( 200 -210 269 )
local.light.angles = ( 20 -730 0 )
local.light notsolid
but i would have no idea how to script the above to make it connect up with these following examples that i copied from the bdbodgers map the rescue
"classname" "info_splinepath"
"targetname" "spotpath3_3"
"origin" "-1349 608 -62"
"target" "t24"
"classname" "info_splinepath"
"origin" "-774 3943 -75"
"target" "t1"
"targetname" "spotpath1_1"
}
// Entity #82
{
"classname" "script_model"
"model" "miscobj/searchlightbase.tik"
"testanim" "idle"
"angle" "90"
"origin" "-258.85 2857.62 721.00"
"targetname" "spotlight"
"#set" "1"
"#group" "1"
}
maybe that info will help ya guys understand more about what im tryin to do?? hopefully hehehehe
Gold<<mohha freak
Well you should read the top part of the global/spotlight script . For one thing it says to make a script model with model "miscobj/searchlightbase.tik" , no where does it say to make a model with the model "miscobj/searchlight.tik"
that is done in the script . The info spline paths form a circle where the first targets the second and the second targets the third etc etc until the last node targets the first node . Create an AI and a turretweapon_german_mg42. Target the spotlight to the guy to the gun.
etc etc etc etc after you have done every thing it says to do exec the spotlight.scr .
that is done in the script . The info spline paths form a circle where the first targets the second and the second targets the third etc etc until the last node targets the first node . Create an AI and a turretweapon_german_mg42. Target the spotlight to the guy to the gun.
etc etc etc etc after you have done every thing it says to do exec the spotlight.scr .
thanx bdbodger,,,and yes i will follow ya suggestion and reread the spotlight script once more,,i can probally figure it out over some time and trail and error thou im new to scripting,,,just may take me a little longer than others to do so:) for instance,,i believe i can do the splinepaths,,and even spawn the spotlights,as i can prob do the mg42 as well at this point ,maybe we will see lo,i will have to find more info on the ai thou,,,thats all new to me at this point,,but i look around here to see what i can find.
Gold<<mohha freak
Gold<<mohha freak
spawning ai is the same as spawning a mg only thing is the ai won't move if he map has no pathnodes in it or if your animations are not enable by a custom new_generic_human.tik . You can use test_mymap.bsp for the name but that only works in single player because the dm or obj is directory name is part of the map name so it will start with dm not test . test will enable the animation because of one of the include statements in new_generic_human.tik
hehehe i spawned a ai,,,was fun figuring out how to do it,,even shot him once lol,,he didnt fight back much,didnt really want him to anyways ,also ive managed to spawn the mg42 and the searchlightbase.tik,,,now heres were im getting confused,,,next the spotlight script says to Target the spotlight to the guy to the gun,,,now how can i target the spotlight to the guy ,,,i have no spotlight in my script,,,its a stock map,,and theres no spotlight in the bsp file as well?? all i have is the searhlightbase.tik,,,,is it referring to that ??
heres how i spawned the ai,,,dont know if its completly scriptually correct but it worked ,,i may be slow at working on this but im doing so as time permits me to learn more about scripting
spawnguy:
local.dude = spawn human/dday_29th_private.tik "targetname" "mysoldier" "classname" "ai_actor"
local.dude.health = 100
local.dude.origin = ( 200 175 240)
local.dude.angle = -129
local.dude.sight = 50000
local.dude.accuracy = 70
local.dude.aggresiveness = 95
local.dude.position = crouch
end
heres how i spawned the ai,,,dont know if its completly scriptually correct but it worked ,,i may be slow at working on this but im doing so as time permits me to learn more about scripting
spawnguy:
local.dude = spawn human/dday_29th_private.tik "targetname" "mysoldier" "classname" "ai_actor"
local.dude.health = 100
local.dude.origin = ( 200 175 240)
local.dude.angle = -129
local.dude.sight = 50000
local.dude.accuracy = 70
local.dude.aggresiveness = 95
local.dude.position = crouch
end
woooohooo,,,i actually got the light to appear and come on hehehehe,,,of course it gave me a error along with some lag because i havent done this yet....Along the ground, create a loop of info_splinepaths. The targetname of one of the splinepaths must be "spotpath#1_#2" where #1 is the #set value of the spotlight that is supposed to shine on this path, and #2 is the #group value of that spotlight. now i go see if i can figure out how to do this lol,,,thanx bdbodger:)
Gold<<mohha freak
Gold<<mohha freak
