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
weird bugg
xtron Offline
Senior Member

Posts: 402
Threads: 37
Joined: May 2011
Reputation: 2
#1
weird bugg

I made a script so when you pass a ceratin area a new entity appears behind you and when you reach another area a new entity appears and the other one disapears but when I enter the map and unlock the door to that room the first entity is already activated :O. I unchecked the "active" box and made a script for the activate/deactivate part.

anyone knows why?

this is how I setup the areas and entities.
[Image: lolbugg.png]

and here's the script
void OnStart()
{
AddEntityCollideCallback("Player" , "activate_wall1" , "func_activate_wall1" , true , 1);
AddEntityCollideCallback("Player" , "activate_wall2" , "func_activate_wall2" , true , 1);
AddEntityCollideCallback("Player" , "activate_wall3" , "func_activate_wall3" , true , 1);
AddEntityCollideCallback("Player" , "activate_wall4" , "func_activate_wall4" , true , 1);
AddEntityCollideCallback("Player" , "activate_wall5" , "func_activate_wall5" , true , 1);
AddEntityCollideCallback("Player" , "activate_wall6" , "func_activate_wall6" , true , 1);
AddEntityCollideCallback("Player" , "activate_wall7" , "func_activate_wall7" , true , 1);
AddEntityCollideCallback("Player" , "activate_wall8" , "func_activate_wall8" , true , 1);
AddEntityCollideCallback("Player" , "activate_wall9" , "func_activate_wall9" , true , 1);
AddEntityCollideCallback("Player" , "activate_wal0" , "func_activate_wal0" , true , 1);
AddEntityCollideCallback("Player" , "activate_wall" , "func_activate_wal1" , true , 1);
}

void func_activate_wall1(string &in asEntity)
{
SetEntityActive("wall1", true);
PlaySoundAtEntity("activate_wall1", "scrape_wood_heavy", "wall1", 0, false);
}

void func_activate_wall2(string &in asEntity)
{
SetEntityActive("wall2", true);
SetEntityActive("wall1", false);
PlaySoundAtEntity("activate_wall2", "scrape_wood_heavy", "wall2", 0, false);
}

void func_activate_wall3(string &in asEntity)
{
SetEntityActive("wall3", true);
SetEntityActive("wall2", false);
PlaySoundAtEntity("activate_wall3", "scrape_wood_heavy", "wall3", 0, false);
}

void func_activate_wall4(string &in asEntity)
{
SetEntityActive("wall4", true);
SetEntityActive("wall3", false);
PlaySoundAtEntity("activate_wall4", "scrape_wood_heavy", "wall4", 0, false);
}

void func_activate_wall5(string &in asEntity)
{
SetEntityActive("wall5", true);
SetEntityActive("wall4", false);
PlaySoundAtEntity("activate_wall5", "scrape_wood_heavy", "wall5", 0, false);
}

void func_activate_wall6(string &in asEntity)
{
SetEntityActive("wall6", true);
SetEntityActive("wall5", false);
PlaySoundAtEntity("activate_wall6", "scrape_wood_heavy", "wall6", 0, false);
}

void func_activate_wall7(string &in asEntity)
{
SetEntityActive("wall7", true);
SetEntityActive("wall6", false);
PlaySoundAtEntity("activate_wall7", "scrape_wood_heavy", "wall7", 0, false);
}

void func_activate_wall8(string &in asEntity)
{
SetEntityActive("wall8", true);
SetEntityActive("wall7", false);
PlaySoundAtEntity("activate_wall8", "scrape_wood_heavy", "wall8", 0, false);
}

void func_activate_wall9(string &in asEntity)
{
SetEntityActive("wall9", true);
SetEntityActive("wall8", false);
PlaySoundAtEntity("activate_wall9", "scrape_wood_heavy", "wall9", 0, false);
}

void func_activate_wall10(string &in asEntity)
{
SetEntityActive("wall10", true);
SetEntityActive("wall9", false);
PlaySoundAtEntity("activate_wall10", "scrape_wood_heavy", "wall10", 0, false);
}

void func_activate_wall11(string &in asEntity)
{
SetEntityActive("wall11", true);
SetEntityActive("wall10", false);
PlaySoundAtEntity("activate_wall11", "scrape_wood_heavy", "wall11", 0, false);
}

[Image: 44917299.jpg]Dubstep <3
(This post was last modified: 06-10-2011, 10:34 PM by xtron.)
06-10-2011, 10:33 PM
Find
Kyle Offline
Posting Freak

Posts: 911
Threads: 36
Joined: Sep 2010
Reputation: 7
#2
RE: weird bugg

Firstly, what is this object that is set to active/inactive that appears behind the player? Because not all entities can be activated/inactivated.

06-10-2011, 11:33 PM
Find
xtron Offline
Senior Member

Posts: 402
Threads: 37
Joined: May 2011
Reputation: 2
#3
RE: weird bugg

"sloped square shelf" in the storage section. I used some random big thing to act as a wall.
The thing is that when I start my map it's activated...It should be deactviated. I didn't even enter the script area and it's there.

[Image: 44917299.jpg]Dubstep <3
(This post was last modified: 06-10-2011, 11:36 PM by xtron.)
06-10-2011, 11:35 PM
Find
Kyle Offline
Posting Freak

Posts: 911
Threads: 36
Joined: Sep 2010
Reputation: 7
#4
RE: weird bugg

I'm not sure if that object can be used to be turned active/inactive.

Another question...

Does the player pass through this place previously so this would be the player's first time passing through the hallways? Does the player need any sort of object/item/thing-to-do before they walk into the hallway?

06-10-2011, 11:38 PM
Find
xtron Offline
Senior Member

Posts: 402
Threads: 37
Joined: May 2011
Reputation: 2
#5
RE: weird bugg

as you can see there's a door before you can enter the hallway. You need a ceratin key to unlock that door and when you open that door the first "sloped square shelf" is activated.

[Image: 44917299.jpg]Dubstep <3
06-10-2011, 11:39 PM
Find
Kyle Offline
Posting Freak

Posts: 911
Threads: 36
Joined: Sep 2010
Reputation: 7
#6
RE: weird bugg

(06-10-2011, 11:39 PM)xtron Wrote: as you can see there's a door before you can enter the hallway. You need a ceratin key to unlock that door and when you open that door the first "sloped square shelf" is activated.

So the "sloped_square_shelf" pops up infront of the player and they have to walk forward and then they become deactivated causing one from behind to become activated?

06-10-2011, 11:41 PM
Find
xtron Offline
Senior Member

Posts: 402
Threads: 37
Joined: May 2011
Reputation: 2
#7
RE: weird bugg

when you enter the first script the first "sloped_square_shelf" gets activated behind you, when you keepon walking forward I made scripts making it look like the "sloped_square_shelf" is moving forward towards you. The "sloped_square_shelf" blocks the way so you can't return.

[Image: 44917299.jpg]Dubstep <3
06-10-2011, 11:45 PM
Find
Kyle Offline
Posting Freak

Posts: 911
Threads: 36
Joined: Sep 2010
Reputation: 7
#8
RE: weird bugg

So how many shelves are there?

06-10-2011, 11:57 PM
Find
xtron Offline
Senior Member

Posts: 402
Threads: 37
Joined: May 2011
Reputation: 2
#9
RE: weird bugg

11 scripts and 11 shelves.

[Image: 44917299.jpg]Dubstep <3
06-10-2011, 11:58 PM
Find
Luis Offline
Frictional Games

Posts: 280
Threads: 19
Joined: Jun 2006
Reputation: 9
#10
RE: weird bugg

Hi xtron.

First of all, your collide callbacks are not using a proper signature. For example:

void func_activate_wall1(string &in asEntity)

should be

void func_activate_wall1(string &in asParent, string &in asChild, int alState)

Second, I see some naming strangeness here. For example, while at some places you are using the name "func_activate_wal1", it is referenced as "func_activate_wall11" somewhere else. Double check your names in the script and in the actual map as well! Smile

Finally, you have basically copied&pasted the same function 11 times only changing the parameters in the calls inside. If you are sure every event is exactly the same, it is better to do this in a single function, making sure you can somehow set up the parameters needed programmatically. While this is optional, this way you are 100% sure everything is done the same way.
In this case, for each area you collide you need the names for the current wall and the previous. Just a little example of how I would do it:

void func_activate_wall(string &in asParent, string &in asChild, int alState)
{
    // First we figure out the index of the area we just collided with
    // (probably not the best way to do it, but all I can get from my currently sleepy brain right now)
    // asChild should contain the name of the collided area
    int lWallIndex = 0;
    for(int i=1; i<=11; ++i)
    {
        string sAreaName = "activate_wall" + i;
        if(sAreaName==asChild)
        {
            lWallIndex = i;
            break;
        }
    }
    
    // If we didn't find any, don't do anything! (should not happen, but just check for the sake of completeness)
    if(lWallIndex==0)
        return;
    
    // We have the index now, so just enable the wall we want, and disable the previous one (we must check there is actually a previous one)
    SetEntityActive("wall"+lWallIndex, true);
    if(lWallIndex>1)
        SetEntityActive("wall"+lWallIndex-1, false);
    
    // Play the sound and we are all set
    PlaySoundAtEntity(asChild, "scrape_wood_heavy", "wall" + lWallIndex, 0, false);
}

And then I would use that for every area. Maybe that was bit advanced-ish for you right now, so just do it the way that feels more comfortable for now, and you will get a hold of all this stuff over time.

With all this being said, that particular shelf is a StaticProp type of entity, so it can't really be set to inactive. If you wanna be able to disable it, you must create another version of it in the ModelEditor tool: just opening the .ent file for it, changing its type to 'Object', subtype 'Static' and saving as some other filename will do. After that, replace the shelves in your map with the new version and everything should be working then!

Hope that helps Smile

EOF
06-11-2011, 01:30 AM
Find




Users browsing this thread: 1 Guest(s)