Facebook Twitter YouTube Frictional Games | Forum | Newsletter | Dev Blog | Dev Wiki | Support | Shelf | Store

Privacy Policy


Post Reply 
 
Thread Rating:
  • 0 Votes - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Call Monster When Interact With Door?
Author Message
theDARKW0LF Offline
Member

Posts: 150
Joined: Sep 2010
Reputation: 0
Post: #1
Call Monster When Interact With Door?
Hi guys, quick question...

What's the proper code to create an event where a monster is spawned after I interact with a door? I haven't created one of these specific situations before so I'm pretty much using trial and error methods right now...

Right now my code looks like this:
void CollideAreaGruntDoorCallback(string &in asParent, string &in asChild, int alState)
{
    SetEntityPlayerInteractCallback("DoorGrunt", "SpawnGrunt", false);
}

void SpawnGrunt(string &in asParent, string &in asChild, int alState)
{
    SetEntityActive("SpotGrunt2", true);
    GiveSanityDamage(10, true);
    AddEnemyPatrolNode("SpotGrunt", "PathNodeArea_98", 1, "");
    AddTimer("Waypoints", 13.0f, "TimerSpotGrunt2");
}

void TimerSpotGrunt2(string &in asTimer)
{
    if(asTimer == "Waypoints")
    {
        ClearEnemyPatrolNodes("SpotGrunt2");
        AddEnemyPatrolNode("SpotGrunt2", "PathNodeArea_83", 1, "");
    }
}

Something's wrong here, but I'm not too sure what, any help?

Check out my custom stories(1)(2)!
(This post was last modified: 03-04-2011 08:13 AM by theDARKW0LF.)
03-04-2011 08:07 AM
Find all posts by this user Quote this message in a reply
Russ Money Offline
Senior Member

Posts: 360
Joined: Dec 2010
Reputation: 3
Post: #2
RE: Call Monster When Interact With Door?
SetEntityActive("SpotGrunt2", true);

SpotGrunt2 is the name of the grunt enemy entity?

I don't know what the name of the monster is, so I can't tell you if that's coded correctly.\

Edit:

Also, if you meant for the door to be intractable after a trigger,

SetEntityPlayerInteractCallback("DoorGrunt", "SpawnGrunt", false);

Then, it's right, if it's a door that's to spawn the monster whenever it gets touched, then just put it in OnStart.
(This post was last modified: 03-04-2011 08:33 AM by Russ Money.)
03-04-2011 08:31 AM
Find all posts by this user Quote this message in a reply
theDARKW0LF Offline
Member

Posts: 150
Joined: Sep 2010
Reputation: 0
Post: #3
RE: Call Monster When Interact With Door?
(03-04-2011 08:31 AM)Russ Money Wrote:  SetEntityActive("SpotGrunt2", true);

SpotGrunt2 is the name of the grunt enemy entity?

I don't know what the name of the monster is, so I can't tell you if that's coded correctly.\

Edit:

Also, if you meant for the door to be intractable after a trigger,

SetEntityPlayerInteractCallback("DoorGrunt", "SpawnGrunt", false);

Then, it's right, if it's a door that's to spawn the monster whenever it gets touched, then just put it in OnStart.

Yes, SpotGrunt2 is the enemy. I'll try that out and get back to you, thanks!

Check out my custom stories(1)(2)!
03-04-2011 08:38 PM
Find all posts by this user Quote this message in a reply
theDARKW0LF Offline
Member

Posts: 150
Joined: Sep 2010
Reputation: 0
Post: #4
RE: Call Monster When Interact With Door?
Yup, that worked. Appears that I had other things typed out incorrectly as well, but all has been remedied now!

Appreciate the help!

Check out my custom stories(1)(2)!
03-05-2011 01:31 AM
Find all posts by this user Quote this message in a reply
Droopy Offline
Member

Posts: 111
Joined: Feb 2011
Reputation: 0
Post: #5
RE: Call Monster When Interact With Door?
(03-05-2011 01:31 AM)theDARKW0LF Wrote:  Yup, that worked. Appears that I had other things typed out incorrectly as well, but all has been remedied now!

You don't mind sharing the finished script for those who may have the same problems?
(This post was last modified: 03-06-2011 05:51 PM by Droopy.)
03-06-2011 05:51 PM
Find all posts by this user Quote this message in a reply
Russ Money Offline
Senior Member

Posts: 360
Joined: Dec 2010
Reputation: 3
Post: #6
RE: Call Monster When Interact With Door?
(03-06-2011 05:51 PM)Droopy Wrote:  
(03-05-2011 01:31 AM)theDARKW0LF Wrote:  Yup, that worked. Appears that I had other things typed out incorrectly as well, but all has been remedied now!

You don't mind sharing the finished script for those who may have the same problems?

It'd look something like this

OnStart()
}
SetEntityPlayerInteractCallback("door", "monsterscare2", true);
{

void monsterscare2(string &in asEntity)
{
SetEntityActive("servant_grunt_1", true);
}
03-06-2011 10:42 PM
Find all posts by this user Quote this message in a reply
theDARKW0LF Offline
Member

Posts: 150
Joined: Sep 2010
Reputation: 0
Post: #7
RE: Call Monster When Interact With Door?
(03-06-2011 05:51 PM)Droopy Wrote:  You don't mind sharing the finished script for those who may have the same problems?

Sure. This is how mine goes:
void OnStart()
{

SetEntityPlayerInteractCallback("DoorGrunt", "SpawnGrunt", false);
    
}

void SpawnGrunt(string &in entity)
{
    SetEntityActive("SpotGrunt2", true);
    GiveSanityDamage(10, true);
    AddEnemyPatrolNode("SpotGrunt2", "PathNodeArea_100", 15, "");
    AddTimer("Waypoints1", 15.0f, "TimerSpotGrunt2");
    AddTimer("Waypoints2", 20.0f, "TimerSpotGrunt2");
    AddTimer("Waypoints3", 30.0f, "TimerSpotGrunt2");
}

void TimerSpotGrunt2(string &in asTimer)
{
    if(asTimer == "Waypoints1")
    {
        ClearEnemyPatrolNodes("SpotGrunt2");
    }
    else if(asTimer == "Waypoints2")
    {
        AddEnemyPatrolNode("SpotGrunt2", "PathNodeArea_54", 10, "");
    }
    else if(asTimer == "Waypoints3")
    {
        AddEnemyPatrolNode("SpotGrunt2", "PathNodeArea_83", 1, "");
    }
}

Check out my custom stories(1)(2)!
(This post was last modified: 03-07-2011 03:14 AM by theDARKW0LF.)
03-07-2011 03:12 AM
Find all posts by this user Quote this message in a reply
Post Reply 




User(s) browsing this thread: 1 Guest(s)