Skip to content

Love to build but I suck at scripting.

TKBoldTKBold Member Posts: 15
edited May 2018 in Builders - Scripting
I've no idea how to use Beamdog's newly integrated SetObjectVisualTransform function, which sucks because that's a really cool thing, and there's two critters in my module which could stand for a size upgrade. One dude's intended to be brawny guy about the size of a half-orc (we'll say size increase to 1.2 or so, maybe 1.3), the other is supposed to something of a larger-than-life deity-type figure (we'll be generous and say... 3.0 to 5.0) I'm not sure how to work the scripts in order to make these characters their appropriate sizes.

Anyone able to help out?

Comments

  • ShadowMShadowM Member Posts: 573
    Put this on the creatures OnSpawn script near the top, past the
    void main
    {
    float fScale =GetLocalFloat(OBJECT_SELF,"Scale"); if(fScale != 0.0)SetObjectVisualTransform(OBJECT_SELF,OBJECT_VISUAL_TRANSFORM_SCALE,fScale);


    click on the advanced tab (in creature property window) and click the variables box near the bottom left
    put in "Scale" in far left box, set middle dropbox to float and put your scale in the far right box. Example 2 (you can use also 0.1 / 1.5 etc.. types too. Click add and test in game.
  • FreshLemonBunFreshLemonBun Member Posts: 909
    If you're new to the scripting you should start with basic things and use text output functions like SendMessageToPC to tell you what is going on with the variables when you get stuck. It's surprisingly easy if you do this and test frequently, you can learn very quickly even if you don't know programming.

    Like in ShadowM's example you see inside the function OBJECT_SELF is used, this is the object that the scale will apply to, but OBJECT_SELF is the object that ran the script. You can also set it to a different object, for example a spell that shrinks enemies, in which case you will apply it to the spell target instead. Since the script is for the onspawn event the caller "OBJECT_SELF" should be the creature that spawned.

    The next thing in the function after the comma is OBJECT_VISUAL_TRANSFORM_SCALE which tells the function what kind of transform to do. You can find all the transforms in the script editor by checking the panel on the right hand side under the tab "constants" and then typing OBJECT_VISUAL_TRANSFORM in the filter and it will show all constants that start with that, so you'll see them all.

    The last part is fScale which is a decimal point number, you can directly put in the number or change it with a variable. For scale it will be the factor of the scale, and for rotation it will be the amount to rotate.
  • TKBoldTKBold Member Posts: 15
    edited May 2018
    ...Hmmm... well, I snagged up the script and added it thusly,

    void main() { float fScale =GetLocalFloat(OBJECT_SELF,"Scale"); if(fScale != 0.0)SetObjectVisualTransform(OBJECT_SELF,OBJECT_VISUAL_TRANSFORM_SCALE,fScale); }

    but when I tell it to save and compile I get this:

    5/8/2018 10:02:38 AM: Error. 'biggerthanyou' did not compile.
    biggerthanyou.nss(4): ERROR: UNDEFINED IDENTIFIER (SetObjectVisualTransform)

    Unless I'm mistaken, wasn't this added to the game? It says it was, in the patch notes. Or is there a development build that I'm not aware of?

    EDIT: Well, I feel sheepish, apparently, yes, that is the case. Either way, I'ma keep dis.
    Post edited by TKBold on
  • raz651raz651 Member Posts: 175
    The above script command will only work with the development version right now for testing before the live release. You can opt into the steam delvelopment or download the delvelopment version from the Beamdog client from the drop down menu.
  • TKBoldTKBold Member Posts: 15
    Muuuuch better! Thanks for the help!
Sign In or Register to comment.