Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Categories

Neverwinter Nights: Enhanced Edition has been released! Visit nwn.beamdog.com to make an order. NWN:EE FAQ is available.
Soundtracks for BG:EE, SoD, BG2:EE, IWD:EE, PST:EE are now available in the Beamdog store.
Attention, new and old users! Please read the new rules of conduct for the forums, and we hope you enjoy your stay!

Fun with SetObjectVisualTransform function

ShadowMShadowM Member Posts: 403
edited April 2018 in General Discussions NWN:EE

Post edited by ShadowM on
DerpCityJFKsquattingmonkSylvus_MoonbowTheBarbarianT0R0thirdmouseDrakonNeverwinterWights
«1

Comments

  • FreshLemonBunFreshLemonBun Member Posts: 685
    Sounds good, some servers already had this in some way but it will be good to have it more widespread and used in single player modules too.

    DerpCity
  • JFKJFK Member Posts: 166
    I've just come here to post how much fun I've had playing around with this! Fun to scale my PC down to mouse size, giant size. Fun moving bookcases around. With scripting, one could do things like swimming and flying, because the model height can be adjusted while still 'walking' on the terrain. In fact, one could have walkable bridges that can be walked under too. Not perfect, but perfectly fun and a great step, I think.

    Overland maps.

    Lotsa ideas.

    Thanks, Beamdog!

    -JFK

    DerpCityShadowM
  • ShadowMShadowM Member Posts: 403
    So this works on PC, I was wondering if it did or they were saving that for a later time. Cool now I can put in my sizing spells. :smile:

    DerpCityJFK
  • raz651raz651 Member Posts: 175
    So is this something you have to do with scripting only? I want to enlarge a placeable object. Can't I just adjust the size in the toolset when I place it?

  • DerpCityDerpCity Member, Moderator Posts: 272
    @raz651 Yes, this is something you must use a script to use at the moment. I believe they said they'd have to incorperate it directly into the toolset eventually, but at the moment it is thankfully very easy to do. It should be as simple as putting SetObjectVisualTransform(OBJECT_SELF, 10, 1.5) in the on spawn script of a placeable to make an object 50% larger. (If you don't want to make hundreds of scripts, one per placeable, you could also give your placeables variables that the script finds and uses as the scale, meaning you'll only need one script.)

  • raz651raz651 Member Posts: 175
    There doesn't seem to be an onspawn script for placeables.

  • DerpCityDerpCity Member, Moderator Posts: 272
    edited April 2018
    @raz651 Oh. That's true. Well, that's what I get for not working with placeables ever.

    An actual solution would to make an on-enter script for your area (or a bigger one on module load so you don't get loaded down with tons of scripts) that makes certain placeables different sizes. Something like below, adding another line with a different tag each time.
    void main() { SetObjectVisualTransform(GetObjectByTag("placeable"), 10, 1.5); }
    There's probably a more efficient manner this can be done using a loop function and variables, but my last experience with loops gave me a headache (granted, what I was trying to do was a lot more complicated than this). After a little thinking it would also probably be better to add the above to the bottom of a module's OnModuleLoad script instead of the Area's OnEnter script so you don't have to make one script per area and it doesn't constantly fire every time you enter the area.

  • raz651raz651 Member Posts: 175
    @DerpCity That worked. Thanks. 5.5 times big. What is the largest number you can use?


    DerpCityNeverwinterWights
  • raz651raz651 Member Posts: 175
    Here is 10.5 times as big.


    DerpCityTheBarbarianNeverwinterWights
  • DerpCityDerpCity Member, Moderator Posts: 272
    edited April 2018
    @raz651 I don't think they said if there was a limit, so I couldn't tell you. Setting the multiplier to something incredibly absurd, like 100x, would probably give you a good idea of how much room you have to work with though, but I'm not sure if there's anything small enough to ever need to be that much bigger.

    Post edited by DerpCity on
  • ShadowMShadowM Member Posts: 403
    For placable you can just use heartbeat with a variable/integer marker to only run once. That looks up local float on the placable for your sizing. LOL loving the pictures.

    DerpCity
  • ShadowMShadowM Member Posts: 403
    edited April 2018



    This is so cool. :dizzy:

    Bosses that grow bigger as they near their enrage timer! Alice-in-Wonderland-shrinking players! Kinda-sorta-faked vertical-position-adjusting flying!! Pseudo-randomized random encounter forest areas with rotating, rescaling, and repositioning trees? Statue-ifying creatures is going to get amazing with this, too, especially if they can figure out how to make the statues stay stable. Blink dogs? Magic weapons that grow bigger until you can't carry them anymore? Magic weapons that grow smaller until they vanish when you equip them? Floor and wall spike traps where the spike models are hidden in the floor/walls and moved out via scripting rather than animating the model? Hidden compartments covered by non-static non-usable placeables that get moved aside? Falling-towards-the-ground sequences? Birds that are actually flying up in the air at varying height levels!!

    It great, Dam though, now I have to write a whole new bunch of custom core scripting functions to handle all this :wink:

    Seem height does not affect the combat engine, so cannot move the creature high enough that the pc have to use range weapons for flying creatures :( ,but should be able to integrate it with the old system I was going to use to make it work.

    TheBarbarian
  • raz651raz651 Member Posts: 175
    This is set at 40.0 and the position z axis set at -10 (as low as it will go in toolset). It seems the bigger the item gets it causes some lag issues also. Not to mention that you can not see the entire placeable because of camera angles.


    DerpCityTheBarbarian
  • ShadowMShadowM Member Posts: 403
    Yes there plenty of graphical stuff, but not trying to be a downer but there still logistical problems with relation to walkmeshes/combat engine for example giant chest with pc having major clipping (if we could get custom trigger non-walk that would be great. Then we can just set down a trigger to the new size and be done.) Anyhow here an example of a custom function using the new system. Transitional scaling with amount and speed control.

    Video LINK

    JFKDerpCityTheBarbarianthirdmouse
  • JFKJFK Member Posts: 166
    edited April 2018
    I hope we can get the pwk to also transform though, eventually. But heck yes, this is huge. Hey, I need to try something. Be back later!

    So, the model is rotated, but the movement isn't. Thus, rotating a creature 90 degrees will make it move sideways while playing the walk forward animation. I'm not complaining, because this is still a great step (ugh, no pun intended) in the right direction.

    Gonna play some more. ;)

    -JFK

    Post edited by JFK on
    DerpCityTheBarbarian
  • JFKJFK Member Posts: 166
    Nice demo @ShadowM. I hadn't seen your last post before I posted. I'm going to play with moving a ship placeable across the sea now. Have fun!

    ShadowMDerpCity
  • ShadowMShadowM Member Posts: 403
    I just like to say the whole team who worked on this just rock. Best feature added to date and will make future modules/pw have some really unique feel. As for future implementation/support related to this, A SetCreatureSize function would help and can we get size modifiers to show on character sheets AC. I would love to see some way of doing OBJECT_VISUAL_TRANSFORM_TRANSLATE_Z that does move the rootdummy up/down and does affect combat engine and maybe have some kind of extrapolation of down attack to target (so it play the down attack animation and move all the way to the target) for support for pseudo-flying attack( I know it far fetched). As for the AABB as a seperate feature, we need some more control over it, maybe a non-walkable /walkable trigger, maybe a walkable placable that overrides the walkmesh under it. Some functions like RecalculateTileWalkmesh / RecalculateAreaWalkmesh called after the trigger/placable is deleted/created. Placables that can be tagged as tileset walkmesh types (example placable water that when the pc walk through it, the same splash effect happens that happens when a pc walk through a tile of water (stream tile example).

    DerpCityJFKTheBarbarian
  • ShadowMShadowM Member Posts: 403
    edited April 2018
    The only issues I have spotted are related to vfx / visual applied to pc before/after scaling that are not syncing. I have a visual familar on shoulder system that while the pc apply the visual(familar on shoulder) the visual matches the size even after scaling, but if the visual is removed and reapplied then it reverts to standard size. Hmm might be able to work around it with scripting.

    DerpCity
  • raz651raz651 Member Posts: 175
    edited April 2018

    This is what was show in the 8169 delvolopment shows new script commands.

    int OBJECT_VISUAL_TRANSFORM_SCALE = 10;
    int OBJECT_VISUAL_TRANSFORM_ROTATE_X = 21;
    int OBJECT_VISUAL_TRANSFORM_ROTATE_Y = 22;
    int OBJECT_VISUAL_TRANSFORM_ROTATE_Z = 23;
    int OBJECT_VISUAL_TRANSFORM_TRANSLATE_X = 31;
    int OBJECT_VISUAL_TRANSFORM_TRANSLATE_Y = 32;
    int OBJECT_VISUAL_TRANSFORM_TRANSLATE_Z = 33;
    int OBJECT_VISUAL_TRANSFORM_ANIMATION_SPEED = 40;

    // Gets a visual transform on the given object.
    // - oObject can be any valid Creature, Placeable, Item or Door.
    // - nTransform is one of OBJECT_VISUAL_TRANSFORM_*
    // Returns the current (or default) value.
    float GetObjectVisualTransform(object oObject, int nTransform);

    // Sets a visual transform on the given object.
    // - oObject can be any valid Creature, Placeable, Item or Door.
    // - nTransform is one of OBJECT_VISUAL_TRANSFORM_*
    // - fValue depends on the transformation to apply.
    // Returns the old/previous value.
    float SetObjectVisualTransform(object oObject, int nTransform, float fValue);

    I know what SCALE, ROTATE AND ANIMATION_SPEED do. What does the TRANSLATE part do?

    DerpCity
  • TheBarbarianTheBarbarian Member Posts: 58
    Translate changes the position. Up, down, left, right, back, forward, that sort of thing. That's what got the player onto the ceiling in the earlier picture - rotating them alone would've had them walking with their feet in the air and their head on the ground. :-)

    JFKDerpCity
  • FreshLemonBunFreshLemonBun Member Posts: 685
    Please consider VISUAL_TRANSFORM_SCALE_X, VISUAL_TRANSFORM_SCALE_Y, VISUAL_TRANSFORM_SCALE_Z in addition to the other constants.

    TheBarbarian
  • raz651raz651 Member Posts: 175
    Ok, i finally got something. It is a start until I learn the range of numbers that can be used. Using int OBJECT_VISUAL_TRANSFORM_ROTATE_Y = 22;


    JFKTheBarbarianNeverwinterWights
  • DerpCityDerpCity Member, Moderator Posts: 272
    As I suggested in the Art thread, I'd like a separate scale for the walking and running animation speeds so that I can adjust the walking animation speed to compensate for the increased size without making them animate overall incredibly slowly or quickly.

    ShadowMTheBarbariandTd
  • ProlericProleric Member Posts: 433
    @niv For placeables, how hard would it be to scale the walkmesh in exact proportion, in a future release?

  • TKBoldTKBold Member Posts: 13
    This is so cool, I can't wait to see this sort of stuff integrated into the toolset.

«1
Sign In or Register to comment.