Page 1 of 1

Autolight - Automatically create lights

Posted: December 1st, 2012, 10:05 am
by kddekadenz
This script will create on every defined mapmodel a specific light source. It saves time and is easy to use.

Code: Select all

//AUTOLIGHT
///////////

//automatically create lights
//by kddekadenz

//based on an idea by Megagun: http://www.quadropolis.us/node/1078


//installation
//============

//copy autolight.cfg into your pas main directory
//put into the cfg of your map or data/default_map_settings.cfg the following code:
//exec "autolight.cfg"


//usage
//=====

//switch to edit mode and open the console by pressing T
//write /autolight and press ENTER
//arrange lights


//customizing
//===========

//you may want to add your own models
//to do this you need to add to '1. select old lights' a line of code with the following format:

//entfind light <radius> <red> <green> <blue>


//then add to '2. create light sources' a code with the following format:

//entfind mapmodel * <index of mapmodel>
//entcopy
//entset light <radius> <red> <green> <blue>
//entpaste
//cancelsel
//entcancel
//passthroughsel 0




//TODO
//====
//shorten code by having arrays for the light sources
//have specific heights where the lights are placed



//code
//====

autolight = [
//deselect everything
cancelsel

//1. select old lights
entfind light 180 180 180 170   //streetlamp
entfind light 30 180 30 30   //ground lamp
entfind light 40 100 100 50   //candle
entfind light 80 100 100 50   //hanging candles
entfind light 90 150 100 50   //firebowl

delent //delete old lights
entcancel //deselect all entities


//2. create light sources

entfind mapmodel * 8 //streetlamp
entcopy
entset light 180 255 180 30
entpaste
cancelsel
entcancel
passthroughsel 0

entfind mapmodel * 19 //ground lamp
entcopy
entset light 30 180 30 30
entpaste
cancelsel
entcancel
passthroughsel 0

entfind mapmodel * 24 //candle
entcopy
entset light 40 100 100 50
entpaste
cancelsel
entcancel
passthroughsel 0

entfind mapmodel * 27 //hanging candles
entcopy
entset light 80 100 100 50
entpaste
cancelsel
entcancel
passthroughsel 0

entfind mapmodel * 29 //firebowl
entcopy
entset light 90 150 100 50
entpaste
cancelsel
entcancel
passthroughsel 0

echo "Autolight completed!"]