Random objects
Posted: Tue May 13, 2008 6:41 pm
Remember that random Yeesha page in the Neighborhoods? Or the elusive Bahro stone by the Ferry Terminal? Here is how to make random objects like those. This code references two global Cyan Python files (without redistributing them of course).
Step 1. The Alcscript
Replace <object> with the name of your object and replace <region> with the name of your region, without the <>.
Note the activatorlist under the pythonfilemods. That one was a pain to figure out.
You may wonder why we need a region for this. In a multiplayer environment the object could show up right under the nose of another player. A strategically placed region prevents that. As long as there is a player in the region the visibility state of the object will not change.
Step 2. The SDL variables
Again replace <object> with the name of your object, without the <>. You can set the chance variable to any number between 0 and 100.
That is all. There is no need to program any Python script since Cyan has already done that for us.
Edit: I could probably turn this into a quickscript that only requires a few lines of input.
Step 1. The Alcscript
- Code: Select all
<object>:
logic:
modifiers:
- tag: ProxiSensor_Enter
cursor: nochange
flags:
- multitrigger
activators:
- type: objectinvolume
remote: <region>
triggers:
- enter
conditions:
- type: volumesensor
satisfied: true
direction: enter
actions:
- type: pythonfile
ref: $RandomBool
- tag: ProxiSensor_Exit
cursor: nochange
flags:
- multitrigger
activators:
- type: objectinvolume
remote: <region>
triggers:
- exit
conditions:
- type: volumesensor
satisfied: true
direction: exit
actions:
- type: pythonfile
ref: $RandomBool
actions:
- type: pythonfile
tag: RandomBool
pythonfile:
file: xRandomBoolChange
parameters:
- type: string
value: <object>Vis
- type: string
value: <object>Enabled
- type: string
value: <object>Chance
- type: string
value: <object>Proximity
- type: activatorlist
refs: ["logicmod:$ProxiSensor_Enter","logicmod:$ProxiSensor_Exit"]
- type: bool
value: true
- type: sceneobject
ref: scnobj:<object>
- type: pythonfile
tag: BoolShowHide
pythonfile:
file: xAgeSDLBoolShowHide
parameters:
- type: string
value: <object>Vis
- type: bool
value: true
Replace <object> with the name of your object and replace <region> with the name of your region, without the <>.
Note the activatorlist under the pythonfilemods. That one was a pain to figure out.
You may wonder why we need a region for this. In a multiplayer environment the object could show up right under the nose of another player. A strategically placed region prevents that. As long as there is a player in the region the visibility state of the object will not change.
Step 2. The SDL variables
- Code: Select all
STATEDESC MyAge
{
VERSION 1
# Random objects
VAR BOOL <object>Vis[1] DEFAULT=1 DEFAULTOPTION=VAULT
VAR BOOL <object>Enabled[1] DEFAULT=1 DEFAULTOPTION=VAULT
VAR BYTE <object>Chance[1] DEFAULT=50 DEFAULTOPTION=VAULT
VAR BOOL <object>Proximity[1] DEFAULT=0 DEFAULTOPTION=VAULT
}
Again replace <object> with the name of your object, without the <>. You can set the chance variable to any number between 0 and 100.
That is all. There is no need to program any Python script since Cyan has already done that for us.
Edit: I could probably turn this into a quickscript that only requires a few lines of input.