Skip to content

SetObjectVisualTransform() ?

ZephiriusZephirius Member Posts: 411
Can anyone give me an example script using the function - SetObjectVisualTransform()
I'm trying to enlarge an object by using it and am having trouble figuring it out.

Thanks -
Z

Comments

  • ProlericProleric Member Posts: 1,281
    You need to use OBJECT_VISUAL_TRANSFORM_SCALE.

    Otherwise the Lexicon example is pretty helpful:

    https://nwnlexicon.com/index.php?title=SetObjectVisualTransform
  • TarotRedhandTarotRedhand Member Posts: 1,481
    Remember it is called SetObjectVisualTransform() because it only affects the visuals of the object and not the collision box/walkmesh. Make your object big enough or move it too far and NPCs/PCs can walk straight through it.

    TR
  • TerrorbleTerrorble Member Posts: 169
    edited May 2022
    I put down a barrier and two levers. Give them tags based on what's in the script.
    void main()
    {
        object oBarrier = GetObjectByTag("TEST_BARRIER");
        float fSize = GetObjectVisualTransform(oBarrier,OBJECT_VISUAL_TRANSFORM_SCALE);
    
        if( GetTag(OBJECT_SELF) == "plus_lever" )
        {
            SetObjectVisualTransform(oBarrier,OBJECT_VISUAL_TRANSFORM_SCALE,fSize+0.2);
        }
        else
        {
            SetObjectVisualTransform(oBarrier,OBJECT_VISUAL_TRANSFORM_SCALE,fSize-0.1);
        }
    
        fSize = GetObjectVisualTransform(oBarrier,OBJECT_VISUAL_TRANSFORM_SCALE);
        FloatingTextStringOnCreature("Size: "+FloatToString(fSize),GetLastUsedBy());
    }
    

    I made this when I was initially playing around with the functions. I was a little bummed to find out what Tarot just pointed out since the object in my example was a magical barrier. But, I've found a few other fun uses for it.
  • ZephiriusZephirius Member Posts: 411
    Thanks for the example Tarot...
  • TarotRedhandTarotRedhand Member Posts: 1,481
    Not me - that was @Terrorble.

    TR
Sign In or Register to comment.