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
Help needed with SetEntityActive in custom story
Spelos Away
Banned

Posts: 231
Threads: 19
Joined: Sep 2014
#2
RE: Help needed with SetEntityActive in custom story

Alright, a few things. I'll order them by their relevance to your case:

WHY IT DOESN'T WORK
While you are creating a collision callback for the enemy, a path node is just a single point in the world. It is just a directional helper, a flag if you will, that the enemies use to calculate their path towards their destination. Collision can be calculated with things that actually take up space. Such as Script Areas.

Tell me more:
Spoiler below!

Collisions are calculated based on a position and size of an entity. With those, we can calculate the volume of this object as well as detect if two of them intersect. However, in the case of a single point that has no volume (like a PathNode or Point), you cannot determine this intersection. Moreover, things like entering the intersection, being in it and leaving would have to in a way trigger at the same time or multiple times if single point intersection would be allowed.


HOW TO MAKE IT WORK
Instead of referencing the last PathNode, create a script area there. The enemy will collide with that area.

WHAT TO THINK ABOUT
Enemies disappear on their own once far enough from a player & at the end of their patrol instructions.

(!) SCRIPT RELATED WARNINGS AND TIPS
  • Your function "monster" isn't really telling you much about what it does. Consider changing the name (for your own sake) to something descriptive like "StartHallMonsterEvent"
  • Based on general convention, Function names start with a Capital letter.
  • Consider adding the Collide callback when needed, creating the enemy collision callback in the "monster" function itself.
  • Your "CollideStop" function might be generalized. Meaning it could be called "EnemyDisableTrigger" and instead of
    PHP Code: (Select All)
    void EnemyDisableTrigger(string &in asParentstring &in asChildint alState)
    {
    SetEntityActive("grunt"false);

    can use the asParent variable to determine what to despawn. That would allow you to add the callback to any number of monsters you want, and each that would collide would get despawned.
    PHP Code: (Select All)
    // The parameters of this function can also be simplified (although not necessary)
    void EnemyDisableTrigger(string parentstring childint state)
    {
    SetEntityActive(parentfalse); // Actually, the monster might be a child of the collision... Not sure there.

(This post was last modified: 01-03-2017, 09:51 PM by Spelos.)
01-03-2017, 09:42 PM
Find


Messages In This Thread
RE: Help needed with SetEntityActive in custom story - by Spelos - 01-03-2017, 09:42 PM



Users browsing this thread: 1 Guest(s)