The vRand System This tutorial explains how to create a vRand system to randomly perform only one of up to five actions. The vRand system relies primarily on the ability to attach particles to an object's vhot points, so before you start, you need to create up to five different custom object models. Each of these must have a vhot #1 in a different position. For example, increase the Z placement of the vhot by one unit per model. Although you can build your own models, this tutorial assumes that you use the vRand Model Pack (5k). The first thing to do is to create a blue
room around 10x10x10 in size.
Set the Tweq->ModelsState's AnimS property to On and the Shape->Model Name property to vRand-1. Next, create an EmitterTrap (-2555) and
name it 'vRandEmitter'.
Leave the rest of the options at their default settings. DromEd should automatically give the object the SFX->Particle Launch Info property too, but you do not need to modify these settings. Finally, give the vRandEmitter this link:
If you haven't already guessed, the only reason we've given the vRandEmitter the SFX->Particles property is to allow it to be attached to the vRand's vhot with a ParticleAttachment link. As the vhot's position is randomly selected from one of five possibilities every 2500ms, we have in fact just created an EmitterTrap that is randomly placed every two and a half seconds. The only thing that remains to be done to complete the vRand system is
to make five objects to act as the vRand's output. Place your gravestone at the same location as the vRand, but with the following offset:
Change the size of your gravestone to 1 square unit (1x1x1), and modify
the Physics->Model-> Dimensions property
accordingly. Each of these 'output plates' should be given PokeStim receptrons for the effect(s) they should trigger when they are selected by the vRand. Now that we have what should be a fully working vRand System, we still need to connect it to an effect. For this tutorial, we'll create the simple effect of randomly opening one of five doors when the player presses a button. First of all, we need to create the five doors. Give each of the five 'output plates' a PokeStim receptron (Intensity 0 to No Max) to frob one of the doors, making sure to assign a different door to each 'output plate'. Finally, create a button and link it with a ControlDevice
link to the vRandEmitter. Because the vRand's modelcycling Rate is set for 2500ms, the button will only select a new door every two and a half seconds. You could easily decrease the Rate, but setting it to an unnecessarily low value could cause the game to slow down, so don't set the value lower than the minimum amount of time that can elapse between calls to the vRand. Bear in mind that the maximum amount of time between model cycles that DromEd will allow is around 32768ms. A model-cycling object with the Random flag will never choose Model 5 (the sixth model), so until I find a solution to this problem, you can only give each vRand five outputs. |