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
Want Enemies to Open Doors
Dizturbed Offline
Member

Posts: 160
Threads: 39
Joined: Jun 2011
Reputation: 0
#11
RE: Want Enemies to Open Doors

here's an example using an entity and an area collide.. Sleepy

PHP Code: (Select All)
AddEntityCollideCallback("grunt_1""ScriptArea_4""grunt2active"true1); 

why dont you just make a function that when the entity collides with the area, the door opens? :p

Correct me if im wrong Smile

07-14-2011, 09:39 PM
Find
nemesis567 Offline
Posting Freak

Posts: 874
Threads: 65
Joined: May 2011
Reputation: 10
#12
RE: Want Enemies to Open Doors

Is it me, or some post got deleted?
EDIT: NVM

Today I dreamt the life I could live forever. You only know that when you feel it for you know not what you like until you've experienced it.
(This post was last modified: 07-14-2011, 10:35 PM by nemesis567.)
07-14-2011, 10:34 PM
Find
convolution223 Offline
Member

Posts: 78
Threads: 15
Joined: Jul 2011
Reputation: 0
#13
RE: Want Enemies to Open Doors

(07-14-2011, 09:39 PM)Dizturbed Wrote: here's an example using an entity and an area collide.. Sleepy

PHP Code: (Select All)
AddEntityCollideCallback("grunt_1""ScriptArea_4""grunt2active"true1); 

why dont you just make a function that when the entity collides with the area, the door opens? :p

Correct me if im wrong Smile

That was the first thing I tried. For some reason I can't get AddEntityCollideCallback's to work for enemies. Maybe it's got something to do with having to do type something special in the level editor???

(I can do AddEntityCollideCallback's for the player perfectly, but for some reason I can't get enemies to trigger them... Sad )
07-15-2011, 03:37 AM
Find
ferryadams11 Offline
Junior Member

Posts: 17
Threads: 1
Joined: Apr 2011
Reputation: 0
#14
RE: Want Enemies to Open Doors

Hey I can help u Tongue

void OnStart()
{
if(GetEntitiesCollide("grunt_1", "EnemyAtDoor") == true) && (GetSwingDoorLocked("door1") == false))
{
SetSwingDoorDisableAutoClose("door1", true);
//WITH THE NUMBERS I'M NOT QUITE GOOD SO EDIT SOME IF NEEDED//
SetMoveObjectStateExt("door1", 1.0f, 1.0f, 1.2f, 0.2f, false);
}
}

Hope it works now Smile

EDIT: Make sure you named all entities correctly to avoid problems
(This post was last modified: 07-15-2011, 02:44 PM by ferryadams11.)
07-15-2011, 02:29 PM
Find
convolution223 Offline
Member

Posts: 78
Threads: 15
Joined: Jul 2011
Reputation: 0
#15
RE: Want Enemies to Open Doors

(07-15-2011, 02:29 PM)ferryadams11 Wrote: Hey I can help u Tongue

void OnStart()
{
if(GetEntitiesCollide("grunt_1", "EnemyAtDoor") == true) && (GetSwingDoorLocked("door1") == false))
{
SetSwingDoorDisableAutoClose("door1", true);
//WITH THE NUMBERS I'M NOT QUITE GOOD SO EDIT SOME IF NEEDED//
SetMoveObjectStateExt("door1", 1.0f, 1.0f, 1.2f, 0.2f, false);
}
}

Hope it works now Smile

EDIT: Make sure you named all entities correctly to avoid problems

i've checked the entity names tons of times and there's nothing wrong there... i really thought your code would work what with the disabling autoclose and all.... I am very frustrated that I've spent hours trying to do this and he just keeps breaking the door. I tried countless variations of your code with number tweaks and got the door to start opening... while he's breaking it down that is. But now he just breaks it down, like my hopes and dreams. all crushed and scattered on the floor... Here's what i've got now:
void BrutePatrol(string &in asTimer)
{
    if (GetLanternActive()==true){
    //ShowEnemyPlayerPosition(GetLocalVarString("ActiveEnemy"));
    ShowEnemyPlayerPosition("brute1");
    }else{
    AddEnemyPatrolNode("brute1", "PathNodeArea_1", 3.0f, "");
    AddEnemyPatrolNode("brute1", "PathNodeArea_6", 0, "");
    AddEnemyPatrolNode("brute1", "PathNodeArea_4", 0.0f, "");
    AddEnemyPatrolNode("brute1", "PathNodeArea_2", 10.0f, "");
    AddEnemyPatrolNode("brute1", "PathNodeArea_4", 0.0f, "");
    
    AddTimer("BrutePatrol_timerWait", 0.0f, "BruteWait");

    }
    
}
void BruteWait(string &in asTimer){
SetEnemyDisableTriggers("brute1", true);
AddTimer("BrutePatrol_timer2", 14.0f, "BrutePart2");
}
void BrutePart2(string &in asTimer){
    SetEnemyDisableTriggers("brute1", false);
    if (GetLanternActive()==true){
    //ShowEnemyPlayerPosition(GetLocalVarString("ActiveEnemy"));
    ShowEnemyPlayerPosition("brute1");
    }else{
    AddEnemyPatrolNode("brute1", "PathNodeArea_3", 12.0f, "");
    AddTimer("BrutePatrol_timer1", 0.0f, "BrutePatrol");
    }
}

void CollideAreaTest03(string &in asParent, string &in asChild, int alState)
{

//OPEN THE DAMN DOOR YOU BRAINLESS IDIOT (this doesn't work)
    /*if(GetSwingDoorLocked("door1")==false){
    //SetMoveObjectStateExt("door1", 1, 0.9, 1, 0.2, true);
    //SetMoveObjectState("door1", 1);
    SetSwingDoorClosed("door1", false, false);
    }*/
        if (GetEntitiesCollide("brute1","EnemyAtDoor")==true && GetSwingDoorLocked("door1")==false){
        SetSwingDoorDisableAutoClose("door1", true);
        //SetSwingDoorClosed("door1", false, false);
        SetMoveObjectStateExt("door1", 1.0f, 1.8f, 2.2f, 0.5f, false);
        
        }
}
AddEntityCollideCallback("brute1", "EnemyAtDoor", "CollideAreaTest03", false, 1);



07-15-2011, 07:02 PM
Find




Users browsing this thread: 3 Guest(s)