+ Reply to Thread
Results 1 to 10 of 10

Thread: Help with entity discovery

  1. #1
    Wirererer Elmo the Emo Emperor is on a distinguished road Elmo the Emo Emperor's Avatar
    Join Date
    Feb 2008
    Location
    Lagville(Austrlia)
    Posts
    219

    Default Help with entity discovery

    Hey guys, i'm wondering if it's possible to find how many of type of prop there is.

    I know how findByModel(string) and findResult(N) works, just wondering if you can find how many props are found.

  2. #2
    Wire Amateur Acedia is on a distinguished road Acedia's Avatar
    Join Date
    Jul 2009
    Posts
    50

    Default Re: Help with entity discovery

    Find = findToArray()
    Count = Find:count()

  3. #3
    Wirererer Elmo the Emo Emperor is on a distinguished road Elmo the Emo Emperor's Avatar
    Join Date
    Feb 2008
    Location
    Lagville(Austrlia)
    Posts
    219

    Default Re: Help with entity discovery

    So is that basically setting everything found to an array and then counting how many objects are in that array?

  4. #4
    Wire Amateur Acedia is on a distinguished road Acedia's Avatar
    Join Date
    Jul 2009
    Posts
    50

    Default Re: Help with entity discovery

    Quote Originally Posted by Elmo the Emo Emperor View Post
    So is that basically setting everything found to an array and then counting how many objects are in that array?
    Yep.

    10chars

  5. #5
    Wirererer Elmo the Emo Emperor is on a distinguished road Elmo the Emo Emperor's Avatar
    Join Date
    Feb 2008
    Location
    Lagville(Austrlia)
    Posts
    219

    Default Re: Help with entity discovery

    Ok thanks, this is a lot simpler than the other option I thought I would have to use.
    Last edited by Elmo the Emo Emperor; 07-05-2009 at 02:35 AM.

  6. #6
    Wirererer Elmo the Emo Emperor is on a distinguished road Elmo the Emo Emperor's Avatar
    Join Date
    Feb 2008
    Location
    Lagville(Austrlia)
    Posts
    219

    Default Re: Help with entity discovery

    OK now that i test that it dosn't really work for me

    Here's what i've got running

    Code:
    @name Prop spawner
    @outputs Spawn
    interval(1000)
    Model = "models/weapons/w_models/w_stickybomb.mdl"
    findByModel(Model)
    Propcount = findToArray():count()
    if ( Propcount < 6 ) { Spawn = 1 }
    elseif ( Propcount >= 6 ) { Spawn = 0 }
    
    The spawn output is hooked up to a prop spawner.
    The problem is it only spawns 1 prop. I'm thinking I might need something to a toggle line.
    Can anyone help?
    Last edited by Elmo the Emo Emperor; 07-05-2009 at 02:47 AM.

  7. #7
    Wire Amateur Acedia is on a distinguished road Acedia's Avatar
    Join Date
    Jul 2009
    Posts
    50

    Default Re: Help with entity discovery

    Quote Originally Posted by Elmo the Emo Emperor View Post
    Code:
    @name Prop spawner
    @outputs Spawn
    interval(1000)
    Model = "models/weapons/w_models/w_stickybomb.mdl"
    findByModel(Model)
    Propcount = findToArray():count()
    if ( Propcount < 6 ) { Spawn = 1 }
    elseif ( Propcount >= 6 ) { Spawn = 0 }
    
    The spawn output is hooked up to a prop spawner.
    Can anyone help?
    Not sure but I think the prop spawner needs to be "pulsed" in order to spawn more than one prop. Also, it'd probably be better to leave the array in persist by itself and then call the count afterward, just in case you ever use it again.

    Code:
    @persist PropArray:array
    PropArray = findToArray()
    Spawn = PropArray:count() < 6 & clk()
    

  8. #8
    Wirererer Elmo the Emo Emperor is on a distinguished road Elmo the Emo Emperor's Avatar
    Join Date
    Feb 2008
    Location
    Lagville(Austrlia)
    Posts
    219

    Default Re: Help with entity discovery

    is the clk really necassary? The only thing triggering it is the interval.

  9. #9
    Wire Amateur Acedia is on a distinguished road Acedia's Avatar
    Join Date
    Jul 2009
    Posts
    50

    Default Re: Help with entity discovery

    Quote Originally Posted by Elmo the Emo Emperor View Post
    is the clk really necassary? The only thing triggering it is the interval.
    I think the prop spawner needs a continual pulse, so this will only pulse if the expression clks and the prop count is less than 6. This might fix the problem with your prop spawner only spawning 1 prop.

  10. #10
    Wirererer Elmo the Emo Emperor is on a distinguished road Elmo the Emo Emperor's Avatar
    Join Date
    Feb 2008
    Location
    Lagville(Austrlia)
    Posts
    219

    Default Re: Help with entity discovery

    Ok thanks, i get what your saying but becaus the clk would constantly be 1 if woudn't pulse as the spawner required
    But now that i know what the problem is I think I can fix this myself. Thanks mate

    Edit: Got it working just added in a very slow run on tick command just to oscillate it (and not to lag the server too much)
    Thanks
    Last edited by Elmo the Emo Emperor; 07-05-2009 at 03:36 AM. Reason: Finished

+ Reply to Thread

Similar Threads

  1. using entity discovery + findPlayerByName
    By hammer whore in forum Expression Help
    Replies: 6
    Last Post: 10-31-2009, 03:15 PM
  2. Help with Entity Discovery
    By JureXL in forum Help & Support
    Replies: 4
    Last Post: 07-01-2009, 11:43 AM
  3. Need help with entity discovery
    By thirty9th in forum Expression Help
    Replies: 8
    Last Post: 06-22-2009, 03:10 PM
  4. Learning Entity Discovery.
    By vortexnl in forum Expression Help
    Replies: 10
    Last Post: 05-03-2009, 03:16 PM
  5. Entity Discovery Bugs
    By goluch in forum Expression Help
    Replies: 9
    Last Post: 04-19-2009, 01:06 PM

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