Is it possible to have a different fog density, depending on a region?
Something similar to what Cyan did in Minkata, although I would prefer an abrupt transition.
Lontahv wrote:I'm pretty sure Minkata's fog/dust was done with particle systems. I haven't looked but I'd assume there's some kind of exclusion region in the kivas.
tachzusamm wrote:Now I have to find out how to attach the functions to a region.
Looking at the AlcScript reference, I have no idea how to link Python code to a region.
Does somebody know if regions can trigger a callback, like "regionEntered" or "regionLeft"?
RegionName:
logic:
modifiers:
- name: NameOfYourLogicModifier_Enter
cursor: up
flags:
- multitrigger
conditions:
- type: volumesensor
satisfied: true
direction: enter
trignum: -1
activators:
- type: objectinvolume
remote: RegionName
- name: NameOfYourLogicModifier_Exit
cursor: up
flags:
- multitrigger
conditions:
- type: volumesensor
satisfied: true
direction: exit
trignum: -1
activators:
- type: objectinvolume
remote: RegionName
def MySetFogDensity_onEnter(self, ...):
fogStart = -20
fogEnd = 100
fogDens = 0.5
PtFogSetDefLinear(fogStart, fogEnd, fogDens)
RegionName:
logic:
modifiers:
- name: NameOfYourLogicModifier_Enter
cursor: up
flags:
- multitrigger
conditions:
- type: volumesensor
satisfied: true
direction: enter
trignum: -1
activators:
- type: objectinvolume
remote: RegionName
actions:
- type: pythonfile
ref: :NameOfPythonFileMod
- name: NameOfYourLogicModifier_Exit
cursor: up
flags:
- multitrigger
conditions:
- type: volumesensor
satisfied: true
direction: exit
trignum: -1
activators:
- type: objectinvolume
remote: RegionName
actions:
- type: pythonfile
ref: :NameOfPythonFileMod
actions:
- type: pythonfile
name: NameOfPythonFileMod
pythonfile:
file: YourPythonFile
parameters:
- type: activator
ref: logicmod:NameOfYourLogicModifier_Enter
- type: activator
ref: logicmod:NameOfYourLogicModifier_Exit
from Plasma import *
from PlasmaTypes import *
actEnter = ptAttribActivator(1, 'Enter region activator')
actExit = ptAttribActivator(2, 'Exit region activator')
class YourPythonFile(ptModifier,):
def __init__(self):
ptModifier.__init__(self)
self.version = 1
print ('__init__%s v.%s' % (self.__class__.__name__,
self.version))
def OnNotify(self, state, id, events):
if (not PtWasLocallyNotified(self.key)):
return
if ((id == actEnter.id) and state):
self.MySetFogDensity_onEnter()
elif ((id == actExit.id) and state):
self.MySetFogDensity_onExit()
# your code here
# glue section here
Region_FogChange:
logic:
modifiers:
- name: actEnter
cursor: up
flags:
- multitrigger
conditions:
- type: volumesensor
satisfied: true
direction: enter
trignum: -1
activators:
- type: objectinvolume
remote: Region_FogChange
actions:
- type: pythonfile
ref: :NameOfPythonFileMod
- name: actExit
cursor: up
flags:
- multitrigger
conditions:
- type: volumesensor
satisfied: true
direction: exit
trignum: -1
activators:
- type: objectinvolume
remote: Region_FogChange
actions:
- type: pythonfile
ref: :NameOfPythonFileMod
actions:
- type: pythonfile
name: NameOfPythonFileMod
pythonfile:
file: TestAge_FogChange.py
parameters:
- type: activator
ref: logicmod:actEnter
- type: activator
ref: logicmod:actExit
from Plasma import *
from PlasmaTypes import *
actEnter = ptAttribActivator(1, 'Enter region activator')
actExit = ptAttribActivator(2, 'Exit region activator')
class TestAge_FogChange(ptModifier,):
def __init__(self):
ptModifier.__init__(self)
self.version = 1
print ('__init__%s v.%s' % (self.__class__.__name__,
self.version))
def OnNotify(self, state, id, events):
if (not PtWasLocallyNotified(self.key)):
return
if ((id == actEnter.id) and state):
self.MySetFogDensity_onEnter()
elif ((id == actExit.id) and state):
self.MySetFogDensity_onExit()
def MySetFogDensity_onEnter(self):
PtFogSetDefLinear(-20, 100, 0.5)
def MySetFogDensity_onExit(self):
PtFogSetDefLinear(1, 1000, 0.1)
# glue section
tachzusamm wrote:Thank you for your advice.
So if I get it right, I have to replace "NameOfYourLogicModifier_Enter" with "actEnter" (same with Exit),
tachzusamm wrote:and "YourPythonFile" just with the name of the Python file.
tachzusamm wrote:Well... call me stupid, but I still don't get it. What about ":NameOfPythonFileMod"?
Because I don't know what a pythonfilemod is, I have no idea what it's name could be...
tachzusamm wrote:Is it just a name I can freely choose (or just keep it named "NameOfPythonFileMod") and all references to this name are those directly inside the AlcScript?
Users browsing this forum: No registered users and 1 guest