Facebook Twitter YouTube Frictional Games | Forum | Privacy Policy | Dev Blog | Dev Wiki | Support | Gametee


Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Script Help Entity collide that uses every entity in the level?
HappyMatt12345 Offline
Junior Member

Posts: 16
Threads: 6
Joined: Oct 2018
Reputation: 0
#1
Exclamation  Entity collide that uses every entity in the level?

You see, I'm working on a custom story called "Order of the Skull" and I am trying to make a script that will do something if one of any movable entity in the level that will fit in the location of the area is placed in that area, and the player presses a button, I know I could do 30 different AddEntityCollideCallback's but that just seems impractical, and I feel there must be a more efficient way. Any ideas and/or suggestions are much appreciated Smile
10-21-2018, 07:04 PM
Find
Mudbill Offline
Muderator

Posts: 3,881
Threads: 59
Joined: Apr 2013
Reputation: 179
#2
RE: Entity collide that uses every entity in the level?

Unfortunately, wildcards (*) are not allowed in the entity name. There are a couple of ways to achieve this, but they mostly rely on a certain pattern with your allowed entities. Perhaps something you can do is add a "PlayerInteractCallback" in the Entity tab of each object, which all call the same function which will add the collide callback between it and your area. That would minimize a lot of your code, but requires you to add that interact callback to each one via the Level Editor.

(This post was last modified: 10-22-2018, 04:57 PM by Mudbill.)
10-22-2018, 04:56 PM
Find
HappyMatt12345 Offline
Junior Member

Posts: 16
Threads: 6
Joined: Oct 2018
Reputation: 0
#3
RE: Entity collide that uses every entity in the level?

(10-22-2018, 04:56 PM)Mudbill Wrote: Unfortunately, wildcards (*) are not allowed in the entity name. There are a couple of ways to achieve this, but they mostly rely on a certain pattern with your allowed entities. Perhaps something you can do is add a "PlayerInteractCallback" in the Entity tab of each object, which all call the same function which will add the collide callback between it and your area. That would minimize a lot of your code, but requires you to add that interact callback to each one via the Level Editor.

Well if thats the way it works, not much anyone can do about that. I guess it will work, but its gonna take a while...
10-23-2018, 12:52 AM
Find
Mudbill Offline
Muderator

Posts: 3,881
Threads: 59
Joined: Apr 2013
Reputation: 179
#4
RE: Entity collide that uses every entity in the level?

If they're named similarly, you can use a for-loop in script to achieve it. If not, the same is possible if you're able to produce a list of all the entity names.

10-23-2018, 09:25 PM
Find




Users browsing this thread: 2 Guest(s)