TTLG|Thief|Bioshock|System Shock|Deus Ex|Mobile
Page 2 of 2 FirstFirst 12
Results 26 to 46 of 46

Thread: DScript -A Squirrel script v0.28b

  1. #26
    Member
    Registered: Aug 2007
    Location: LosAngeles: Between Amusements
    It is going to take a while for me to wrap my mind around your new parameter setting conventions!

  2. #27
    Member
    Registered: Nov 2004
    Location: Germany
    Thank you so much for all this Daraan! I really like the DWatchMe (guards relight every extinguished torches on their patrol path) I think i will add this to the HD mods as an optional extra

  3. #28
    Member
    Registered: Jan 2012
    Location: Gèrmany
    It is going to take a while for me to wrap my mind around your new parameter setting conventions!
    In general I tried to keep the readability high, as seen in the screenshot what belongs together should stay together. Same reason all actions use parameters without a prefix.
    "TOn" became "Relay" and TDest/Target became "Target".
    Well the initial idea came from a small sentence: On="bla";Relay="blub";To=object. Expect Relay the rest disappeared You would have been happier with TOn, or?



    --------------Download v0.23-------------------
    (nut file only on the first post)
    Parameter additions/fix
    •In case of all Frob messages (FrobToolBegin, FrobWorldBegin..) [source] will point to the frobber if it's a real frob else to the sending object of that message.

    Script Changes
    DHub:
    (Just to make clear these are messages not parameters)
    -StopInfRepeats got replaced by StopRepeat!!! - it will still only stop infinite repeats but:
    -Single repeats can now stopped via: [Message+number]StopRepeat, this works for non infinite repeats as well.
    -Single counts can be reset the same way with [Message+number]ResetCount
    --Sending a single reset count message for an action which does not have Count specified is not advised.
    -Potential ugly infinite Loop fixed.

    •In general tried to improve performance and readability - but for at least DrunkPlayerTrap I destroyed it.
    --The performance cut to make the DHub working which affected all scripts is mostly non existent anymore.


    It's kinda a hard decision to make: Use more RAM to decrease run time calculations or leave it be. Basically both are minimal but the question is still there.
    In case of the DHub every time it receives a valid message it creates a local 20 entry "Design Note" table for that message and actions are performed as the parameters are set. => less persistent memory but more repeated calculations.
    Other wise I could calculate these DNs at Sim and save them in a class variable and grab them when needed. => More memory but less calculations.
    I think I would prefer the second variant, at the moment it's still the first.



    Script Addition
    DHudCompass
    Upon receiving FrobInvEnd will clone the current selected object and attach it slightly below the players camera and keep its facing always to north.
    By default there is no TurnOff as it is TurnedOff via toggling.

    Engine Features -> Frob Info > Inv Action: Script must be set.

    I suggest scaling down the object to 10-50%.
    --------------Download v0.23c-------------------
    DHudCompass is now always above the lightgem.
    Last edited by Daraan; 16th Apr 2017 at 11:33.

  4. #29
    Member
    Registered: Jul 2006
    Location: Troyes, France
    @Daraan

    Shouldn't be a good idea to publish your script on GitHub in order to share it with everyone?
    Last edited by EnYB0La; 17th Apr 2017 at 12:08.

  5. #30
    Member
    Registered: Jan 2012
    Location: Gèrmany
    Quote Originally Posted by EnYB0La View Post
    Shouldn't be a good idea to publish your script on GitHub in order to share it with everyone?
    Dunno would that be helpful to you guys?



    ----------------------------------------------
    And 0.24 rolls in (Download)

    Targeting Operator additions
    @ and * work now with archetype ids like @-441

    '+-' Removes previously added objects via +. For example Target=+@Human+-@bystander

    The + operator goes from left to right, so some examples
    +-@bystander+@Human would do nothing as Human would be added at the end.
    +@Human+-@bystander+@Pagan would be Human excluding servant and aristo (the two other bystander types)
    of course Metaproperties can be used as well +@guard+-@M-FrontGateGuard+-@M-TopFloorGuard

    Script Addition
    •DImUndercover + DNotSuspAI
    •DGoMissing

    --------------------------------------------

    The Undercover script serves 2 purposes
    A) Bring a bit more logic to guards: Servant walk over marble nothing happens, player touching it slightly whole place goes crazy.
    B) The actual purpose being Undercover until an AI gets alerted, Damaged...

    Especially the Undercover part can be combined with some other Suspicious scripts to round it up.
    For example GoMissing (gen.osm) to notify guards when something was stolen.
    Even better with HighlySuspicious (tnhscript) as it adds lots of control via a suspicious threshold.


    DGoMissing
    Nearly identical to GoMissing but simulates a caught in the act and the AI instant alerts to level 3. (With my HighlySuspicious settings they would not alert at all)
    The normal missingloot type is restored after 2 seconds.
    Engine Features -> FrobInfo: World must be Move,Script
    DImUndercover
    By default upon receiving FrobInvEnd (for a general purpose you can use BeginScript or Sim with Count=1) will affected the AIs specified via DImUndercoverTarget - by default @Human -
    Use DImUndercoverSelfLit to increase OR decrease the visibility of the player - the default is 5. This can basically used as an On/Off indicator for the (human)player. Else this script gives no feedback on its own if it's on or not.
    DImUndercoverMode defines which of the following bitwise set modes should be used by default the mode is 9 (8 and 1).

    Code:
    Mode-|------effect--------		| Still alerted when
    ===Weaker detection Modes===
    1:	Ignore Footsteps		Alerted by other sounds and sight - Use DImUndercoverDeaf=1 to make them completely deaf. Use Deaf=3 if you think the default 2 is to weak.
    2: 	Reduced vision		 	By default will ignore the player until hes 6.5 units in range and than instant aggro. Another value can be set with DImUndercoverSight. DImUndercoverSight=1 or 0 Will make them completely blind. Would have loved to make this better. (basically disables lots of the vision cones)
    3:	Both above(1+2)			(recommended mode)
    4: 	Don't investigate 	 	Only when seeing the player will attack him. Alertness cap will still rise.
    5: 	4+1 	 	 	 	(Does not really makes sense)
    6: 	4+2 	 	 	 	(Attacks the player when he comes close. Sounds will rise his alertness and give a bit better vision)
    7: 	4+1+2				(also recommended)
    8: 	See below.
    
    For your personal design.
    16 	Adds: "M-DUndercover16"
    32 	Adds: "M-DUndercover32"
    ====The Undercover mode 8===========
    Used as default with ignore footsteps.

    •Settings for use with HighlySuspicious (Link)) (T2 only)
    The player will be made suspicious with the type player.
    DImUnderCoverUseDif=1 will append the the current difficulty so player0,1,3 is used.
    In the demo (SuspParm.str) I included two presets. - For the second one, if the AI meets the player and knows about 5,4,3 other incidents it will alert.
    DImUndercoverForgetMe=1 will delete the AISouspiciousLink to the player when he goes out of range, so he will be checked multiple times by the same AI.

    •When activated changes the Team of DImUndercoverTarget to Team Good and tries to automatically set the DNotSuspAI script which handles the turning off. This only works if the script 4 slot of the concrete AI is not in use, else a M-DUndercover8 has to be created with the script inside.

    End of the effect


    Note: Mode 1,2,4 won't end automatically only when DImUndercoverAutoOff=1 is set. DNotSuspAI will be added to them then as well. (they still are hostile)

    • By user:
    -if the effect was started with FrobInvEnd, a second Frob will end it.
    -The script object is dropped.
    -The DImUndercover object receives TurnOff; a single DNotSuspAI receives EndIgnore

    •Automatically
    -Messages: On Alertness >= 2 - another alert level can be set with DImUndercoverEnd; the default is 2, you can also use $QVar here.
    -AISignal with "alarm" "alert" "EndIgnore" "gong_ring";
    -Damage (any source!)
    -T2 only: drawn sword or blackjack object, arrow windup (To make this work the second script DT2UndercoverWeapons.nut is used which replaces the standard, sword, blackjack and arrow script.)
    -Side effect: An alerted AI will inform others if seen.

    When turned off these Properties get removed (regardless of the set mode):
    AI-Attributes--Hearing+Vision(mode 1/blind); AI-Core--Vision Description(2); AI-Ability Settings--Investigation(4)


    ====Custom Modes===========
    Alternatively if you want much more control or my setting interfere with yours you can use DImUndercoverUseMetas=1; this will add (depending on mode) the Metas M-DUndercover1,2,4,8,16,32 to the AIs and M-DUndercoverPlayer(if it exists) to the player.
    Their design is up to you.


  6. #31
    Member
    Registered: Jul 2006
    Location: Troyes, France
    Quote Originally Posted by Daraan View Post
    Dunno would that be helpful to you guys?
    Sure! I'd love to contribute Maybe we could make a generic library ( something like jQuery in JavaScript).
    DromEd Level Editor Developer Textures Kit: [Latest release] [README] [TTLG thread]

  7. #32
    Member
    Registered: Jan 2012
    Location: Gèrmany
    Let's start with the coolest new script:

    DRay
    Working with a template particle effect defined by DRaySFX, this script creates and scales particle effects between objects specified by DRayFrom and DRayTo. With the + or similar operators you can create multiple and different SFX between multiple objects at once.
    For all effects only the X values and Particle Launch Infos are used!
    Sending further TurnOn messages will not create additional SFX but update the already present ones.

    Primarily two types are supported:
    DRayScaling:
    = 0 (Default): For even particle effects. This will scale up their spawn box and the particles used. A small effect with look exactly like a big one.
    = 1: For "shooting" Particle effects which start at the From location. Increases particle lifetime. (Min=Max)

    TIPS:
    • A good template is the ParticleBeam(-3445)
    • You can use this script in the editor with an appropriate DRayOn message. For example "test" (use script_test objId) or Sim (objects will be created after leaving game mode) and then delete the script object.
    • By using Particles Start Launched you can create very different and more solid effects but they will be less accurate in hitting the To object.
    • You can either use an infinite repeating TurnOn from an outside Trap or DRayRepeat=-1 to constantly update your special effects in case the objects are changing positions.
    • If you don't want to turn off the special effect the second method is better else I recommend the first. (Else you would need +TurnOff+TurnOff+TurnOn sequence to deactivate the script completely.

    • When using launched very fast particles (like the laser in the video) the effect degenerates after a few seconds, so sending a "+TurnOff+TurnOn" with DRayOffCapacitor=50 will update the effect 50 times and then create a new one. The capacitor doesn't have to be that high but without to much performance is used to calculate the launched particles!!! (and it's a more smoother as well)
    • My Demo effects are rather simple, be creative with the particle settings, share your stuff if you for example created a spiral or or or...
    All paricles are created with DRay and the damage detection with DHitScan

    DHitScanTrap
    (Has all the DRelayTrap sending features: [On/Off]Target or [On/Off]TDest)
    When activated will scan if there is an object or a wall between two objects. Imagine it as an invisible scanning laser beam. The start and end object are specified by DHitScanTrapFrom and DHitScanTrapTo, the script object is used as default if none is specified.
    If the From object is the player the camera position is used, if the To object is the player as well then the ray will follow the center of the players view - for example to check if hes exactly facing something.

    The Object that was hit will receive the message specified by DHitScanTrapHitMsg (default is "DHitScan"). By default when any object is hit a TurnOn will be sent to CD linked objects. Of course these can be changed via DHitScanTrapTOn and DHitScanTrapTDest
    Alternatively if just a special set of objects should trigger a TurnOn then these can be specified via DHitScanTrapTarget.

    NOTE: Unlike other scripts DHitScanTrapFrom and To only take single objects at the moment. I can add multiple object support as well but
    NOTE2: The scanning is described as an rather expensive progress. So don't use it like 100 times per second over long distances. Best to only activate it when you need it. (That's why this is no real Trigger)
    And as promised a while ago.
    DWeapon DArmAttachment

    Attaches another object to the players arm.

    So you can create your own custom weapons, it can be given to any weapon-ready object together with Inventory-> Limb Object: emptyhan or BJACHAND (Both Models included, made by Jason Otto and Soul Tear).
    OR you can also add it to normal weapons to attach a Shield or Light or whatever creative stuff you come up with

    Parameters:
    DArmAttachmentUseObject:
    = 0 (Default): Will create a dummy object and give it the Shape->Model: DArmAttachmentModel
    = 1 Will create a copy of a real object/archetype specified in DArmAttachmentModel. If you want to attach special effects for example.
    = 2 (experimental and not really working): Same as 1 but the object will be really physical -> Real collision sounds based on the object.
    = 3 (experimental little working): Same as 2 but works even better. Disadvantage: Errors in DromEd, Model will pass through walls/objects.

    DArmAttachmentModel: model name(0) or object archetype (1) depending on (DArmAttachmentUseObject)
    DArmAttachmentRot and DArmAttachmentPos: The model will most likely need some adjustments in position and Rotation. Both parameters take 3 arguments separated by , like this: "90,0,0" or "0.1,-0.6,-0.43". They stand for HPB Roation respectively xyz translation. But most like don't behave like you expect it. Best method how to figure out the numbers is to use it in combination with set game_mode_backup 0 (NEVER SAVE AFTER!) and modify the DetailAttachment Link. It's trial and error.

    NOTE: You will also need to do some Hierarchy changes to adjust the sound and motions. Also I would say this script is not 100% finished please give feedback.
    TIP: Remember you can use multiple different melee weapons by using the cycle command.




    And also as said in the other post:

    DDumpModels
    Included in the DDumpModel.nut read the instructions for more detailed information. Or in this post here

    Basically it will create the models from your obj folder and place them in the editor.
    The parameters used are exactly as written here:

    First= the model name of the first model you want to use; if it's a number it will start with for example the 100th model in your list.
    MaxModels = will stop after for example 2000 have been created.
    Screenshots=1 will automatically create screenshots in game mode while creating the models.
    DRelayTrap
    Small update for the familiar feeling, now also accepts [On/Off]TDest.

    ####################################

    Quote Originally Posted by EnYB0La
    Shouldn't be a good idea to publish your script on GitHub in order to share it with everyone?
    Sure! I'd love to contribute Maybe we could make a generic library ( something like jQuery in JavaScript).
    I made an account back then but didn't share it.
    Here we go DScript on HitHub

    Download

  8. #33
    Member
    Registered: Aug 2007
    Location: LosAngeles: Between Amusements
    Damn, you've put a lot of great stuff in there. Now I'm really going to have to find time to play with it and see just what it will do!

  9. #34
    Desperately dodgy geezer
    Registered: Nov 2001
    Location: The Wailing Keep
    Great work, Daraan! I sure could have used the beam script for the current DCE mission, but since I have it all working now manually I guess I'll leave it alone. But this is great stuff!

  10. #35
    Member
    Registered: Jun 2009
    Location: The Spiraling Sea
    Thank you for your good work on this, Daraan.

  11. #36
    Member
    Registered: Aug 2007
    Location: LosAngeles: Between Amusements
    Here is a "simple" dscript request: DModelByCount

    Public scripts has ModelByCount which "Changes the shape of the object based on the stack count. This makes a combining object look different when more pieces are picked up. But it does not change the shape when it is dropped or used. So it should only be used for objects that cannot be dropped or frobbed in inventory."

    a dscript DModelByCount would change the shape not only when more are picked up, but also when dropped or used / consumed. My thought is that it could use the models tweq to indicate up to 6 models to use. If only 2 models are defined then the 1st => count = 1, and the second => count = 2 or more. If 3 models are defined then the 1st => count = 1, the second => count = 2, and the third => count = 3 or more. All the way up to : Model 0 => count = 1, Model 1 => count = 2, ..., Model 6 => count = 6 or greater.

    What do you think? Possible? Practical? Interesting?

    I have emulated this effect for my Easter eggs using property sets and dynamically changing the a shape (by render type, alternative model) with a replaceable texture's texture when a Combine message is received (increment count) or Create message is received (decrement count) using NVTrigContained and NVRelayTrap and a qVar to track the count.

    NVTrigContainedTDest="EggsNVTrapSetQVar"; NVRelayTrapOn="Combine"; NVRelayTrapOff="Create"; NVRelayTrapTDest="EggsNVTrapSetQVar";

    So it is possible to do without the script. But it is a pain in the whatever to set up.
    Last edited by LarryG; 13th Aug 2017 at 04:40.

  12. #37
    Member
    Registered: Jan 2012
    Location: Gèrmany
    I think I remember your idea from another thread. Did you explain what it exactly is as it really sounds.. interesting

    Bit of a problem that first came up my mind is how to track how many objects are in use as you have to globally track them. Thankfully there are are QVars.
    Or use one object to track them(well but how to track a pickup efficiently?)

    I'm organizing my mind here and have to write my thought down

    So when an object is activated (combined or QVar Change) it looks up for a specific QVar and changes the model.
    So it would be something like a ModelByQVar.

    So then How to increase the QVar. I'm wondering if I should make a second script instead of combining them into one, as it would be more universal.
    So(the 4th) ModelByQVar and StacksToQVar would be the scripts you want

  13. #38
    Member
    Registered: Aug 2007
    Location: LosAngeles: Between Amusements
    I think there already is a stack counting taking place. The number shows up on the display. It increments when you add an item of the same type, and decrements when you consume or drop an item of that type. I only used a qvar because I don't have access to that internal count. Shouldn't squirrel allow you access without needing a new qvar?

  14. #39
    Member
    Registered: Aug 2007
    Location: LosAngeles: Between Amusements
    Yes it seems that the normal stack count is used in inventory. And that should be directly manipulable. See for example NVStackOrDropTrap and NVStackTrap which seem to access it. NVConsumeMessages and NVContainedMessages may point at how to know to swap models.

    Another useful, and related, script would be one that limits the number of an children of an archetype that you can pick up. You would place this on an archetype and specify the limit value in the design note.
    Last edited by LarryG; 13th Aug 2017 at 12:49.

  15. #40
    Member
    Registered: Jan 2012
    Location: Gèrmany
    I forgot about the most obvious one, I was to fixated on how to keep track on many objects.

  16. #41
    Member
    Registered: Aug 2007
    Location: LosAngeles: Between Amusements
    Here is another enhancement request for a standard script, this time for StdButton. I would like a dStdButton which recognizes the Engine Features > Locked flag. My thought is that the button should only function when unlocked. When locked, it could be frobinert or make a locked sound when frobbed.

    I recently was reminded that making a button frobinert doesn't prevent it from being pushed by physical contact, it just stops one from frobbing it. An arrow or a bump will still push the button. I've worked around this problem in my mission by putting a RAT between the button and the device it is to turnon, with the othe link to the RAT being from the process that "unlocks" the button. I also had to get the button to send a TurnOff after having been pushed while "locked" to keep the RAT from firing immediately when the button is unlocked. Clumsy, but it works. Having StdButton recognize the Lock flag would be better.

  17. #42
    Member
    Registered: Jan 2001
    Location: Formby, NW England
    You could use NVRelayTrap, activated by FrobWorldEnd and sending its message down a ScriptParams link (or any other flavour except CD).

  18. #43
    Member
    Registered: Aug 2007
    Location: LosAngeles: Between Amusements
    But then you would also have to add in NVJointControl to activate the joint on FrobWorldEnd and NVimpleSchemaPlayerTrap to activate the button sound on FrobWorldEnd. And maybe a whole 'nother set of stuff if you want a "locked" sound when frobbed and locked ...

    If you mean, leave StdButton on the object for the sound and joints, but don't hook the button up to anything via CD. I guess that would work too, but I would find it confusing, coming back to it 6 months later trying to figure out what was going on.

    I solved my need for this, as I said above, using a RAT and and NVRelayTrap with a delay for the TurnOff. It works, and is self explanatory, but it is clunky. A general use StdButton that recognizes the Lock flag would be a whole lot cleaner. That's all.

  19. #44
    Member
    Registered: Jan 2001
    Location: Formby, NW England
    Quote Originally Posted by LarryG View Post
    If you mean, leave StdButton on the object for the sound and joints, but don't hook the button up to anything via CD. I guess that would work too, but I would find it confusing, coming back to it 6 months later trying to figure out what was going on.
    That was indeed my suggestion. Potential confusion in the future can be alleviated with the Editor Comments property. I also think your RAT solution is equally good.
    Last edited by R Soul; 18th Aug 2017 at 19:51.

  20. #45
    Member
    Registered: Aug 2007
    Location: LosAngeles: Between Amusements
    Here's another script request that has been bubbling in my brain for a few years: weighing scripts. One script to multiply the mass and gravity of things placed on a platform object and placing the resulting weight into a qvar. Similar to TrigPPlate script, but filling in a qvar also, and only optionally activating a joint. (There's a PressurePlateActive message which might be of use.) Then a simple qvar subtraction operation between two qvars (from different platform objects) could be used to set the joint tweqs of the scale object associated with the platforms.

    Or something like that. I'm sure there are any number of ways to deal with this problem. Again, just a useful script idea to think about.

  21. #46
    Member
    Registered: Jan 2012
    Location: Gèrmany
    Quote Originally Posted by LarryG View Post
    Here's another script request that has been bubbling in my brain for a few years: weighing scripts. One script to multiply the mass and gravity of things placed on a platform object and placing the resulting weight into a qvar. Similar to TrigPPlate script, but filling in a qvar also, and only optionally activating a joint. (There's a PressurePlateActive message which might be of use.) Then a simple qvar subtraction operation between two qvars (from different platform objects) could be used to set the joint tweqs of the scale object associated with the platforms.
    I haven't seen anything that tracks the current mass on a PressurePlate so you would have to do that manually by tracking Phys Messages and then especially when stacking items it gets ugly.
    I think the only 'simple' workarround is in calculating the mass in a Room on top of the PressurePlate/Scale.

    -------------------



    Quote Originally Posted by LarryG View Post
    Here is another enhancement request for a standard script, this time for StdButton. I would like a dStdButton which recognizes the Engine Features > Locked flag. My thought is that the button should only function when unlocked. When locked, it could be frobinert or make a locked sound when frobbed.
    Should not be that hard. Interesting that they implemented locked levers but not Buttons.

    And it's done -> 0.28a

    DStdButton (DRelayTrap)
    DStdButton has all the StdButton features- even TrapControlFlags work. Once will lock the Object - as well as the DRelayTrap features, so basically this can save some script markers which only wait for a Button TurnOn

    Additional:
    If the button is locked the joint will not activate and the Schema specified by DStdButtonLockSound will be played, by default "noluck" the wrong lockpick sound.
    DAddScript
    Can be used as Root -> D[Add/Remove]ScriptFunc


    Adds the Script specified by DAddScriptScript to the objects specified by DAddScriptTarget, by default &ControlDevice.
    Additionally it sets the DesignNote via DAddScriptDN.. If Script parameter is not set only the DesignNote is added/changed.

    On TurnOff will clear the Script 4 slot.

    NOTE:
    • It will try to add the Script in Slot 4. It will check if its empty or in case if it's not if the Archetype has it, else you will get an error and should use a Metaproperty.
    • It is possible to only change the DesignNote with this script and so change the behavior of other scripts BUT this only works for non-squirrel scripts!
    • Using Capacitor or Count for will not work for newly added DScripts. As these are created and kept clean in the Editor.
    Changes
    •DHitScanTrap
    Renamed Parameter!!!. There is the option that only special objects should trigger a TurnOn these not have to be specified by DHitScanTrapTriggers
    before DHitScanTrapTarget.

    •DGoMissing
    More reliable
    --> Kinda strange sometimes when you change a Property which is not present for example "Locked" it gets added automatically but for others you first have to add it and then change it.
    Until now was undocumented:
    Squirrel Additions
    I know marked Scripts which can be used as a Root via extends ....
    Their special functions and parameters can also be used if your script in named otherwise.

    Most useful is the DRelayTrap with these two message sending functions:

    DSendMessage(Target, Message)
    Will send a single Message to a single Target and check if the Message should be a Stim. If so it will stimulate the Target.
    DRelayMessages("On" or "Off", DesignNote)
    Will relay the Messages in [ScriptName]T[On/Off] to the objects in [ScriptName][On/Off]TDest via DSendMessage.

Page 2 of 2 FirstFirst 12

Tags for this Thread

Posting Permissions

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