Licenza da 75 € Accedi
DE EN FR ES IT CZ

How to change the size,position, transparency of an object with scripting

Questa discussione ha qualche anno. Alcuni dettagli potrebbero riferirsi a una versione precedente di Visionaire Studio. Tutorial aggiornati

  1. · 13 years ago
    Hi guys,

    1-) how I can scale the oblect size and also the transparency of an object with code? I tried this by execute script comment but didnt work :\

    local box2 = Scenes.SceneObjects.box
    box2.ObjectScale = 3.0
    box2.ObjectVisibility = 0

    2-) How can I change the position and of an object with script. I tried this code but it doesnt work

    local box2 = getObject("Scenes[box]")
    box2:setValue(ObjectPosition, {x=400,y=200})
    box2:setValue(ObjectVisibility, 0)


    Cheers smile
  2. Stai lavorando a un gioco?

    La versione gratuita consente fino a 25 scene per progetto. Per più scene e per vendere il tuo gioco ti serve una licenza.

    Vedi le licenze Provalo gratis
  3. · 13 years ago
    Scenes.SceneObjects will not work. It has to be...
    Objects.object_name.Scale = 3.0 -- or
    Objects["object_name"].Scale = 3.0 -- or
    getObject("Scenes[scene_name].SceneObjects[object_name]"):setValue(VObjectScale, 3.0) -- or
    getObject("Game.GameCurrentScene.SceneObjects[object_name]"):setValue(VObjectScale, 3.0)
    

    ...mind that using shorthand for accessing objects requires that each object has a unique name. & as always: names are case sensitive.

    Object positon is the position the current character will walk to when executing actions on said object. It is not scriptable. You can use the ObjectOffset but I recommend creating the objects image as an animation instead & moving the animation with...
    ActiveAnimations["animation_name"].AnimationCurrentPosition = {x = 400, y = 200}
    

    ...because animations can be set directly to coordinates whereas objects use offset which is confusing. To easily use offset the object should add the image to the object & leave the object in the initial position it was created in which would be 0, 0 & then use that to base your offset off otherwise it gets really complicated because offset always starts at 0 regardless of object position.
  4. · 13 years ago
    A very big thank you Lee!!! smile
  5. · 9 years ago
    I know this is Old post but I was needing something like this and this works perfectly. Now only thing that I am interested is there a way to avoid "object_name" and replace it with saved object name? I have scene with tons of objects and would make my day easier if I don't have to type all their names each time I call this script... Thanks in advance smile
  6. · 9 years ago
    I know this is Old post but I was needing something like this and this works perfectly. Now only thing that I am interested is there a way to avoid "object_name" and replace it with saved object name? I have scene with tons of objects and would make my day easier if I don't have to type all their names each time I call this script... Thanks in advance smile
    then just use a variable inside the brackets and define it somewhere before:

    object = "table"
    Objects[object].Scale = 3.0 

  7. · 9 years ago
    That was quick. Thank you. Works perfectly smile
  8. · 9 years ago
    how can i change the opacity of animations?
  9. · 9 years ago
    would be only possible when you change the object opacity where the animation is bound to.

    i remember that there is an action part for this. 

    also possible in lua:

    Objects["name"].Visibility = 76

    0-100 are accepted. 
  10. · 9 years ago
    I think it only works if the animation is linked as the default animation of a scene object so that it automatically plays at the start of the scene / whenever the object is shown. I don't believe it's possible to change the opacity of manually started animations.

    Having said that, you could always create an animation as a character. Disable scaling in the properties for the character & insert the character into the scene as you can change the opacity of characters. Same goes with interfaces.
  11. · 9 years ago
    thank you - i just found out the same thing. great support here! thank you.

Questa discussione è chiusa perché nessuno risponde da più di un anno. Puoi fare la tua domanda in una nuova discussione.

Nuova discussione

Eliminare davvero questo messaggio?