Skip to content

Getting some help with a line of code - height sliders

Wall3tWall3t Member Posts: 90
edited September 2018 in Builders - Scripting
so someone awesome gave this line of code to me that changes the height of the npcs but Im rather inept at figuring this out. I tried changing the object_self to object_pc but i get an error.

I was looking to add this to a conversation dialogue. would anyone know how i could do that?

SetObjectVisualTransform(OBJECT_SELF,OBJECT_VISUAL_TRANSFORM_SCALE,1.0+(IntToFloat(Random(11))/100.0)*IntToFloat(Random(3)-1));
Post edited by Wall3t on

Comments

  • AncarionAncarion Member Posts: 155
    edited September 2018
    That line randomly sets the npc's size +/- 10%, which is probably not what you'd want for your purposes. Instead, you'd need a conversation with 3 possible response lines, each with its own script attached to it. One line would be something like "increase my size", another would be "decrease my size", and a last one would be to exit the conversation with no changes. The Action Taken script for line 1 would then increase the PC's size, and the Action Taken for line 2 would decrease the PC's size.

    A simple example script for the line 1 Action Taken might be:

    void main()
    {
    object oPC=GetPCSpeaker();
    float fCurrentScale=GetObjectVisualTransform(oPC,OBJECT_VISUAL_TRANSFORM_SCALE);
    SetObjectVisualTransform(oPC,OBJECT_VISUAL_TRANSFORM_SCALE,fCurrentScale+0.1);
    }

    This will increase the PC's size by 10% every time line 1 ("increase my size") is chosen in the conversation. Just change "fCurrentScale+0.1" to "fCurrentScale-0.1" to decrease the PC's size in the line 2 script.
    Post edited by Ancarion on
  • Wall3tWall3t Member Posts: 90
    okay thats actually all i need to know. i can figure the rest out from here! ive been modding for nearly 7 years now, and making dialogue in that time, but scripting is still never my strong suit. Although as long as i see the code I can understand how it works, if that makes any sense.

    Thanks as well for the help!
Sign In or Register to comment.