
Originally Posted by
Playzr
I'm having some trouble with entity discovery. When i first spawn my exp2 gate it works and finds the props i want, but if I want to do a 2nd search it doesnt work, and when i dupe it, i have to update the exp2 gate so that it searches. I want to know how I can properly reset my search and start a new one.
This is the searching part of the code that i was using
Code:
findByModel("models/hunter/plates/plate025.mdl")
findIncludePlayerProps(owner())
findSortByDistance(entity():pos())
Keys= findToArray() Use a toggled button for this:
Code:
@inputs Button
@persist Keys:array
if(!Button&~Button) {
findByModel("models/hunter/plates/plate025.mdl")
findIncludePlayerProps(owner())
findSortByDistance(entity():pos())
Keys= findToArray()
}
if(Button&~Button) {
#You can do an completely new search for this one.
Keys= findToArray()
} This is just an example for only 2 searches. If you need more help with this, post more of your E2 because I'm not exactly sure what you're trying to do.
EDIT:
I just made one that will search for 5 different models. Keep in mind that the strings you set in Model:array are being used with findByModel(). Make sure to use a no-toggled button for this one.
Code:
@inputs Button
@persist Keys:array Model:array N
Model:setString(1,"models/hunter/plates/plate025.mdl")
Model:setString(2,"<model 2>")
Model:setString(3,"<model 3>")
Model:setString(4,"<model 4>")
Model:setString(5,"<model 5>")
if(Button&~Button) {
N = N%5+1
findByModel(Model:string(N))
findIncludePlayerProps(owner())
findSortByDistance(entity():pos())
Keys= findToArray()
} This is just another example of how you can do this.
Bookmarks