miércoles, 30 de octubre de 2013

Temporizadores

y mold999 » Wed Oct 02, 2013 12:04 am
Okay, I'll try to explain:

  • Open the console by pressing the "~" button.
  • Type into the console: scene.my.densityChange = 2
  • Open the script menu of the object where you want to change the density.
  • Remove the "2.0" from the density value inside the script menu, and type: {scene.my.density}
  • Change the controllerAcc of the object to 0.
  • In the onHitByLaser value, type: 

    (e)=>{
    scene.my.densityChange != 2 ? {
    sim.time - controllerAcc >= 1 ? {
    scene.my.density = 2
    } : {}
    } : {
    controllerAcc = sim.time
    }
    }

And there you go. Whenever you want to change the density of that object, change the value of scene.my.densityChange. After 1 second, the density will return to 2.

The red "1" inside the code is the number of seconds it takes to change the density back to 2.
Phundementalism?

Ain't nobody got
 thyme fo dat.
User avatar
mold999
Posts: 225
Joined: Sun Jan 02, 2011 1:35 am
Location: [176436, 3763234]

If you don't want to use scene.my variables, try this:

On the box you want to change the density change these two pieces of code..

CODE: SELECT ALL
onHitByLaser := (e)=>{
        density = 1;
        e.this.controllerAcc = sim.time
    }


And also

CODE: SELECT ALL
update := (e)=>{
        sim.time - controllerAcc >= 2 ? {
            density = 2
        } : {}
    }
        

No hay comentarios:

Publicar un comentario