TTLG|Thief|Bioshock|System Shock|Deus Ex|Mobile
Results 1 to 18 of 18

Thread: flying potion

  1. #1

    flying potion

    is there anyway to create a potion which essentially does the same thing as shift-Q for only a very limited time?

  2. #2
    Member
    Registered: Mar 2001
    Location: Ireland
    Sure, adjust the player's Physics->Model->Attributes.
    Set Gravity % to 0.00 (or a negative value to float upwards) and Friction to 1.00 (the latter is necessary or you won't be able to control your movement).

  3. #3
    Member
    Registered: May 2002
    Location: Toronto
    Holy crap!!!

    I never knew!

  4. #4
    Member
    Registered: Mar 2001
    Location: Ireland
    I only know that out because Telliamed told me, and he only figured that out by poking into how the grav shafts in SS2 work, IIRC.

  5. #5
    Desperately Dodgy Moderator
    Registered: Nov 2001
    Location: Bohn Museum
    I can't wait to see what you do with that in S7, Sliptip. But first, finish FP already.


    This would have kept me from having to teleport the player (and lots of objects) back and forth between two copies of a room in Dance With The Dead.

  6. #6
    Member
    Registered: May 2002
    Location: Toronto
    Quote Originally Posted by Yandros View Post
    I can't wait to see what you do with that in S7, Sliptip. But first, finish FP already.
    I promise I won't get distracted sir *hangs head in shame*

  7. #7
    Desperately Dodgy Moderator
    Registered: Nov 2001
    Location: Bohn Museum
    I hope you're joking. I was.

  8. #8
    Sure, adjust the player's Physics->Model->Attributes.
    Set Gravity % to 0.00 (or a negative value to float upwards)
    Can someone elaborate on this a bit? I created a MetaProperty called LowGrav. In the metaprop I set gravity to 20 under Physics->Model->Attributes.

    I set up a conversation in which I press a button to make a servant add the meta prop to the object "Player" but it doesn't work. I also tried to add LowGrav to "Garrett" and "-2099" which is the archetype number for Garrett but nothing seems to work.

  9. #9
    Member
    Registered: Jan 2001
    Location: Constantly losing tug o'war
    A metaproperty won't work in this example because in game, the 'player' object will have its own set of physics properties which will override the metaprop.

    You'll have to use sources and receptrons. The easiest way is probably to install NVScript and use NVRelayTrap to send a stim directly to the player object. The set property receptron copies entire properties from one object to another, so you'll need to copy the Attributes prop from the Garrett archetype onto some other object, with the two changes required for flying, then use the conv to trigger the S&R events to copy from that object to 'Player', and to turn off the flying, copy the Attributes property from the Garrett archetype to 'Player'.

  10. #10
    ZylonBane
    Registered: Sep 2000
    Location: ZylonBane
    Or you could just write a script to do that without all the Rube Goldberg shenanigans.

  11. #11
    I started reading up on NVRelayTrap and my eyes glazed over. Maybe I can do more research later.

    But something interesting happened: I used an S&R setup to give Garrett a receptron for a new stim (GravStim), such that when he gets stimmed with GravStim, he stims the source back. Then I made a button that stims Garrett with GravStim when it's frobbed.

    I then created a "Garrett object" in the game (the brown box with a clown face on it) and adjusted its gravity to 20.

    The button, when frobbed, clones the properties of the Garrett model over to the player. So yes indeed, I'm suddenly able to jump high and float down slowly. The only hitch is that this process teleports me to the location of the Garrett model when the cloning happens. So...the effort continues.

  12. #12
    Member
    Registered: Apr 2011
    ZylonBane is correct but unhelpful.

    here is a squirrel script for a simple trap that gives the player low gravity when turned on, and normal gravity when turned off.

    Code:
    class PlayerLowGravTrap extends SqRootScript {
        /* When sent TurnOn, this sets the player's gravity to 20%. When sent
         * TurnOff, it sets the player's gravity back to 100%.
         */
        function OnTurnOn() {
            local player = Object.Named("Player");
            if (player) {
                Physics.SetGravity(player, 0.2);
            }
        }
    
        function OnTurnOff() {
            local player = Object.Named("Player");
            if (player) {
                Physics.SetGravity(player, 1.0);
            }
        }
    }
    if you havent used squirrel scripts before, you need to:
    • in dromed, script_load squirrel
    • create a sq_scripts subfolder in your fm folder
    • create a text file in sq_scripts/ called something like fmscripts.nut (the name can be anything you want, but it must end in .nut)
    • copy paste the code above in to that file

    for this particular script, create a plain TrapTrig and give it S>Scripts: PlayerLowGravTrap. to test it out, create an on/off lever and CD link it to the trap.

  13. #13
    Member
    Registered: Apr 2011
    Quote Originally Posted by RippedPhreak View Post
    The button, when frobbed, clones the properties of the Garrett model over to the player. So yes indeed, I'm suddenly able to jump high and float down slowly. The only hitch is that this process teleports me to the location of the Garrett model when the cloning happens. So...the effort continues.
    the problem is that physics properties bundle a whole lot of details all together. this makes them not very suitable for copying with S&R from one object to another. you can probably make it work, but it will be fiddly and fragile.

    but using scripts allows individual fields in properties to be modified without affecting any other fields in the same property. there is a general purpose way to do this with any property (Property.Set), but since for gravity there is a specific function available to scripts (Physics.SetGravity), i am using that above.

  14. #14
    That's simple and slick, thanks very much!

  15. #15
    ZylonBane
    Registered: Sep 2000
    Location: ZylonBane
    Quote Originally Posted by vfig View Post
    Code:
    function OnTurnOn() {
        local player = Object.Named("Player");
        if (player) {
            Physics.SetGravity(player, 0.2);
        }
    }
    You don't have to do all that. Any script service that takes an object reference can accept it as either an ID number or as a name string (case-insensitive). And, most of the services fail silently if passed a null object reference (sensibly, considering how often objects suddenly disappear in a game engine). Though if the player doesn't exist, you've got bigger problems. Anyway, the above can just be:

    Code:
    function OnTurnOn() {
        Physics.SetGravity("player", 0.2);
    }

  16. #16
    DromEd Archmage
    Registered: Nov 2010
    Location: Between a bed and a machine
    Quote Originally Posted by ZylonBane View Post
    You don't have to do all that. Any script service that takes an object reference can accept it as either an ID number or as a name string (case-insensitive). And, most of the services fail silently if passed a null object reference (sensibly, considering how often objects suddenly disappear in a game engine). Though if the player doesn't exist, you've got bigger problems. Anyway, the above can just be:

    Code:
    function OnTurnOn() {
        Physics.SetGravity("player", 0.2);
    }

    Code:
    function OnTurnOn() {
        Physics.SetGravity(ObjID("player"), 0.2);
    }


    Just typing the string name should be not a reflex as it doesn't work with all services requiring an ObjID

  17. #17
    Member
    Registered: Apr 2011
    Quote Originally Posted by FireMage View Post
    ObjID("player")
    … how did i miss ObjID() all this time?

  18. #18
    ZylonBane
    Registered: Sep 2000
    Location: ZylonBane
    Quote Originally Posted by FireMage View Post
    Just typing the string name should be not a reflex as it doesn't work with all services requiring an ObjID
    Cargo cult programming shouldn't be a reflex either. If it works without ObjID(), there's no reason to use it.

    The Squirrel documentation is quite clear on which services accept what. Those that take "object" accept a name or an ID. Those that take "ObjID" only accept an ID.


    Quote Originally Posted by vfig View Post
    how did i miss ObjID() all this time?
    It's not a script service, it's a native function, documented in API-reference.txt.
    Code:
    // returns an ObjID based on an object name
    ObjID ObjID(string sObjName);
    // returns a link flavor based on a link flavor/type name
    RelationID linkkind(string sLinkFlavorName);
    // returns the destination of a link (for quick access without using an sLink object)
    ObjID LinkDest(LinkID id);
    Last edited by ZylonBane; 8th Sep 2021 at 22:55.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •