BigTruck's Fan Page

BOD Python Scripting

18 - Torches

Torches (and all other flaming objects) have a light built into the model and a particle system linked.

They are created as with all other objects, but they have two extra parameters.

FiresIntensity
Lights


Set the FiresIntensity to [0.0] for the maximum flame. As you increase this value, the flame will get less until none is visible.
(about [46] in think)

Lights has a number of values.
Lights = [(10.0,0.03125,(255,196,128))]
First is the brightness. 0 is no light. 10 is about average. You can increase fora brighter light. (The max in the game is about 60).
Second value is the Precission. Not exactly sure how this works.
Last set of three is the colour (r,g,b). You can alter the colour of the light, but the flame will alway remain orange.

A nice feature in the game is the ability to light hand torches and to light wall torches with hand torches. Only three types can be used like this:

"Antorcha" (hand torch)
"Antorchaenpared" (wall torch)
"Palangana" (fire bowl)

To make a hand torch that can be lit, create it 'dead', that is Lights= [(0.0,0.03125,(255,196,128))]
FiresIntensity=[46]


then add this:
Torchs.SetUseable("NameOfTorch",9,8,-1)
First value is the brightness of the light when the totch is lit.
Second the fire intensity when torch is lit.

The last sets the time it will burn. -1 is everlasting. 180 will make it go out after 3minutes. You can only use them once.

The same method applies for wall torches, but the Player must have a lit torch in hand to use them.

btw. The "Antorcha" is officially a weapon. It's hit points are low in it's unlit state. BUT when you light them they aquire FIRE damage. If you create them ready lit you must still apply the SetUseable
code to enable the FIRE damage.

There is only one carryable torch, but lots of static ones. If you want to light other types you must ust this little trick:

in DefFuncs.py
Torchs.tipos_antorcha=("Antorcha","Antorchaenpared","Palangana","LamparaNegra")
# This adds the obj "LamparaNegra" to the useable torches.
and
Reference.EntitiesSelectionData["LamparaNegra_367"]=(8,2500,MenuText.GetMenuText("Sacred Torch"))
Do the last part for each individual torch. The text at the end will show as the onscreen 'hint'

This code in this tut needs two extra imports. I won't say what as you should be able to spot them by now. Certain flaming objects are just flames: They are "BoladeFuego" and the like. You can create lights in the LED which are compiled into the .bw file but you can also create lights seperately in script under the Kind:

"Entity Spot"

They have various parameters like:
Color= 255,113,10
Intensity=22
Precission=0.8 #(?)
CastShadows=0
Set CastShadows param to 1 for shadows, 0 for none. If you want to kill the cast shadows on a torch object use:
lo=AuxFuncs.GetSpot(lite1) # lite1 being the var of obj
lo.CastShadows=0
Lastly, You may have noticed in the game that hand torches tend to go out when you go outside. There is a sound reason for this. Waving a light source about in a big area can affect framerates dramatically and you don't really need a torch outside anyway. Assign a function 'Apagala' (name doesn't matter. It's Spanish for 'turn it off' ) to any sectors near the exit(s) from an interior place.
def Apagala(sector,entity):
    a=Bladex.GetEntity(entity)
    if a.Kind == "Antorcha":
        Torchs.ExtingueAntorcha(entity)
        print"My Torch has gone out!"