Results 1 to 4 of 4

Thread: How to attach a trigger function to a spawned object?

  1. #1

    How to attach a trigger function to a spawned object?

    After spawning a new object, how can I attach to it a trigger function such as onDrop()? I tried putting

    onDrop = function(info) print('Dropped!') end

    into the spawn parameters but it didn't work.

    Thanks

  2. #2
    You don't need to. You can use a Global onDrop and then read the Guid. This is how I add walking animations to all my characters. I create a single Global onPickup and onDrop and then when a new character is added, it automatically applies.

  3. #3

    Thanks. Now that you mention it, I did that in another part of my simulation, so that's a good workaround if it's not possible to dynamically assign functions.

  4. #4
    I see now that there is a function,
    setLuaScript( script) Input a string as an entity's Lua script. Generally only used after spawning a new Object.
    That might work.

Similar Threads

  1. Any way to attach a scripting zone to an object?
    By BaconCatBug in forum Scripting
    Replies: 4
    Last Post: 06-29-2017, 06:29 PM
  2. Replies: 10
    Last Post: 06-28-2017, 12:15 PM
  3. Anti-Troll Suggestion: Spawned Object Ownership/Areas
    By Cesar in forum General Discussion
    Replies: 4
    Last Post: 04-12-2017, 07:31 PM
  4. Attach Text Tool Object to Custom Model
    By Nim.Rodelle in forum Scripting
    Replies: 6
    Last Post: 10-07-2016, 09:31 PM
  5. Object Function Using Global Function
    By LordAshes in forum Scripting
    Replies: 6
    Last Post: 07-11-2016, 05:18 AM

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
  •