The following warnings occurred:
Warning [2] count(): Parameter must be an array or an object that implements Countable - Line: 906 - File: showthread.php PHP 7.2.24-0ubuntu0.18.04.17 (Linux)
File Line Function
/showthread.php 906 errorHandler->error



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 Callback func doesn't get called after enemy leaves area
FragdaddyXXL Offline
Member

Posts: 136
Threads: 20
Joined: Apr 2012
Reputation: 7
#1
Callback func doesn't get called after enemy leaves area

PHP Code: (Select All)
void OnStart()
{
    
//servant_brute_NoSound_1
    
string brute "servant_brute_NoSound_1";
    for (
int x 1<= 17x++) //Initialize all wall-phase collision detections
    
{
        
AddEntityCollideCallback(brute"block_box_"+x"WallPhase"false1); //When the brute collides with a block_box, deactivate the block box.
    
}
    
    
ShowEnemyPlayerPosition(brute);
}

void WallPhase(string &in asParentstring &in asChildint alState//when enemy interacts with block_box, it deactivates it
{    
    
string x StringSub(asChild112);
    
SetEntityActive(asChildfalse); //Deactivate box
    
AddEntityCollideCallback("servant_brute_NoSound_1""ScriptArea_"+x"WallSeal"true, -1); //Waits for enemy to leave area


void WallSeal(string &in asParentstring &in asChildint alState//Called when enemy leaves area
{
    
string x StringSub(asChild112); //get substring to obtain the number that tells us which box to reactivate.
    
SetEntityActive("block_box_"+xfalse); //Reactivate box
    
FadeEnemyToSmoke(asParentfalse); //TEST TO SEE IF THIS METHOD IS CALLED. RIGHT NOW, IT IS NOT.


I'm currently trying to come up with a system to have an enemy be able to phase through walls, much like the one in SCP-CB. Right now, I surround my wall pieces in thin block_box'es and change the wall's collide value to false. Since I cannot change that value freely with scripting alone, I turn to using blockboxes as the actual object that you collide with when you walk into a wall.

Sidenote: while typing this, I just realized that I could just have 2 walls in the same exact spot, 1 that collides, and one that doesn't. When the enemy collides with the collide-able wall, it deactivates that wall, but leave the non-collide-able wall activated. Although, I'm not sure If I can activate/deactivate walls. And it's too late now to change from blockboxes, but whatevs.

Anyway, I also surround the wall with thin ScriptAreas, so that when the enemy is finished walking through the wall, it can reactivate the blockbox so that the player cannot walk through it.

What I've noticed is that the function that is supposed to be called after the enemy leaves the area is not being called. I've had problems with this in the past, and maybe I just need some straight answers. Why is the function not being called when the enemy exits the area.

[Image: Areafeffefef.png]

SetEntityActive("block_box_"+x, false); //Reactivate box
Here's one problem, forgot to change false to true when I copy-pasted.

Dark Seclusion Here
(This post was last modified: 05-24-2012, 12:57 AM by FragdaddyXXL.)
05-24-2012, 12:42 AM
Find


Messages In This Thread
Callback func doesn't get called after enemy leaves area - by FragdaddyXXL - 05-24-2012, 12:42 AM



Users browsing this thread: 1 Guest(s)