Hi! Welcome to the forum for Platinum Arts Sandbox Free 3D Game Maker. I currently have the forums locked as I am attempting to properly update them.

In the meantime please join the new Discord Server!

If you have any questions please e-mail me through the Platinum Arts website.

Autolight - Automatically create lights

Section for submitting new content to Sandbox, such as maps, code, etc.
Kids are also more than welcome to submit their work with parental permission!
Locked
User avatar
kddekadenz
Member
Member
Posts: 423
Joined: July 17th, 2011, 11:02 am
Name: kdd
Contact:

Autolight - Automatically create lights

Post 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!"]


Kelgar is an advanced RPG beeing developed in Sandbox
Locked