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
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


Messages In This Thread
weird bugg - by xtron - 06-10-2011, 10:33 PM
RE: weird bugg - by Kyle - 06-10-2011, 11:33 PM
RE: weird bugg - by xtron - 06-10-2011, 11:35 PM
RE: weird bugg - by Kyle - 06-10-2011, 11:38 PM
RE: weird bugg - by xtron - 06-10-2011, 11:39 PM
RE: weird bugg - by Kyle - 06-10-2011, 11:41 PM
RE: weird bugg - by xtron - 06-10-2011, 11:45 PM
RE: weird bugg - by Kyle - 06-10-2011, 11:57 PM
RE: weird bugg - by xtron - 06-10-2011, 11:58 PM
RE: weird bugg - by Luis - 06-11-2011, 01:30 AM
RE: weird bugg - by xtron - 06-11-2011, 12:42 PM



Users browsing this thread: 1 Guest(s)