+ Reply to Thread
Results 1 to 9 of 9

Thread: lastSpawnedProp()

  1. #1
    Wire Amateur RabidCrab is on a distinguished road RabidCrab's Avatar
    Join Date
    Jan 2008
    Location
    Oregon
    Posts
    88

    Default lastSpawnedProp()

    I've had quite a few occasions where I want to know what the last prop spawned was. I use find() functions to mimic this functionality, but it's not very effective, and it's pretty expensive.

    Anyone else think this would be a good addition, or am I way off?
    I'm named after the crustacean, not the STD.




    All my crap is built on Drunkie's server

  2. #2
    Wire Sofaking singilli is on a distinguished road singilli's Avatar
    Join Date
    Jun 2007
    Location
    Garðabær, Iceland
    Posts
    466

    Default Re: lastSpawnedProp()

    I have never had to use this

  3. #3
    Drone Madman
    Lyinginbedmon will become famous soon enough Lyinginbedmon will become famous soon enough Lyinginbedmon's Avatar
    Join Date
    Mar 2009
    Location
    England
    Posts
    2,036

    Default Re: lastSpawnedProp()

    Prop spawners do have an entity output for the last prop, I recently used it in an applyForce railgun effort.

  4. #4
    Wire Amateur RabidCrab is on a distinguished road RabidCrab's Avatar
    Join Date
    Jan 2008
    Location
    Oregon
    Posts
    88

    Default Re: lastSpawnedProp()

    I'm looking for either a function to pull the last spawned prop spawned by a specified player, or any player in general; or a trigger that executes an E2 when a prop is spawned onto the map.

    I think the prop spawner only specifies what it spawned last, and not what was spawned last on the server.
    I'm named after the crustacean, not the STD.




    All my crap is built on Drunkie's server

  5. #5
    Bug Buster

    TomyLobo has a spectacular aura about TomyLobo has a spectacular aura about TomyLobo's Avatar
    Join Date
    Feb 2009
    Posts
    2,772

    Default Re: lastSpawnedProp()

    I don't think this is useful. can you give an example for a contraption you would build with this?
    "It's easy to win forgiveness for being wrong; being right is what gets you into real trouble." - Bjarne Stroustrup

    Lífið læðist lúmskt áfram

  6. #6
    Wirererer OmicroN will become famous soon enough OmicroN's Avatar
    Join Date
    Apr 2008
    Location
    Frozen Hell (aka Michigan)
    Posts
    113

    Default Re: lastSpawnedProp()

    Here is a method you can use to find your last spawned prop.
    As a bonus for you, C will output the amount of props you currently have spawned.
    Keep in mind that this ignores anything not under the class of "prop_physics".
    Code:
    @persist Lp:entity
    if(first()){
        findIncludePlayerProps(owner())
        findByClass("prop_physics")
        Lp = findResult(1)}
    Lp:setColor(255,0,0)
    

  7. #7
    Wirezard


    Matte is a jewel in the rough Matte is a jewel in the rough Matte is a jewel in the rough Matte is a jewel in the rough Matte's Avatar
    Join Date
    Jan 2009
    Location
    Norway
    Posts
    2,096

    Default Re: lastSpawnedProp()

    Are you sure the findResult() function returns entites in which order they were spawned?
    "If anybody says he can think about quantum physics without getting giddy, that only shows he has not understood the first thing about them."
    -- Niels Bohr


  8. #8
    Bug Buster

    TomyLobo has a spectacular aura about TomyLobo has a spectacular aura about TomyLobo's Avatar
    Join Date
    Feb 2009
    Posts
    2,772

    Default Re: lastSpawnedProp()

    we don't want wiremod (and especially E2) to interact with the player constructing things.
    so, in addition to the apparent implementation problems, this won't ever be in the official wiresvn.
    "It's easy to win forgiveness for being wrong; being right is what gets you into real trouble." - Bjarne Stroustrup

    Lífið læðist lúmskt áfram

  9. #9
    Wirererer OmicroN will become famous soon enough OmicroN's Avatar
    Join Date
    Apr 2008
    Location
    Frozen Hell (aka Michigan)
    Posts
    113

    Default Re: lastSpawnedProp()

    Quote Originally Posted by Matte View Post
    Are you sure the findResult() function returns entites in which order they were spawned?
    Unless something has changed recently, it has been that way for me.
    The code is not telling it to find the nearest, furthest, or to find it in any other order. So logical assumption would be to find either the first or the last spawned item. In my practice I have found that it has tracked the latest object, if it is reversed just change the code to findResult(1) and then you're good.

+ Reply to Thread

Bookmarks

Posting Permissions

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