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
Set Entity Active Problem
bigfoot Offline
Member

Posts: 58
Threads: 12
Joined: Dec 2010
Reputation: 0
#1
Set Entity Active Problem

Hello once again,

uuhm, ok so my problem is this

I have a nice closet.
I have a set of chairs + a round table which are tumbled over and all which I set to active in the level editor, then I have another set of chairs + a round table which are all nice and haven't tumbled over which are inactive.

Then I have this in my code file:

void OnStart()
{
    if(ScriptDebugOn())
    {
       GiveItemFromFile("lantern", "lantern.ent");

       for(int i=0;i<10;i++) GiveItemFromFile("tinderbox_"+i, "tinderbox.ent");
    }
    
    SetEntityPlayerInteractCallback("cabinet_nice_1", "cabinet_nice_1_callback", true);
}

void OnEnter()
{

}

void OnLeave()
{

}

void cabinet_nice_1_callback(){
    SetEntityActive("chair_nice02_9", true);
    SetEntityActive("chair_nice02_8", true);
    SetEntityActive("chair_nice02_10", true);
    SetEntityActive("table_nice_round_3", true);
    
    SetEntityActive("chair_nice02_5", false);
    SetEntityActive("chair_nice02_4", false);
    SetEntityActive("chair_nice02_6", false);
    SetEntityActive("table_nice_round_2", false);
}

So when I touch the cabinet or interact with the cabinet, (I am facing another direction) the tumbled over chair and table should dissapear and the chairs and table that are normal should appear. This doesn't work (this is 1 problem),
then I have another problem which is the normal standing table is already active when I load my map, which should be inactive untill I touch the cabinet.

I aready unchecked the active check saved loaded my map, and rechecked the active check saved and loaded my map but that doesn't work.

Or should I set the active and inactive things in my script in the onEnter function?

Thanks in advance, once again. :p
07-12-2011, 04:54 PM
Find
Tanshaydar Offline
From Beyond

Posts: 3,085
Threads: 17
Joined: Mar 2009
Reputation: 67
#2
RE: Set Entity Active Problem

StaticObject entities cannot be (de)activated.

07-12-2011, 05:00 PM
Website Find
bigfoot Offline
Member

Posts: 58
Threads: 12
Joined: Dec 2010
Reputation: 0
#3
RE: Set Entity Active Problem

(07-12-2011, 05:00 PM)Tanshaydar Wrote: StaticObject entities cannot be (de)activated.

Damn, that sucks Sad, but why does it have an option to make it active or not then? :S
07-12-2011, 05:26 PM
Find
Kyle Offline
Posting Freak

Posts: 911
Threads: 36
Joined: Sep 2010
Reputation: 7
#4
RE: Set Entity Active Problem

(07-12-2011, 05:26 PM)bigfoot Wrote:
(07-12-2011, 05:00 PM)Tanshaydar Wrote: StaticObject entities cannot be (de)activated.

Damn, that sucks Sad, but why does it have an option to make it active or not then? :S

It's not really an entity I guess, just a static object. There is a way to get it working by somehow editing the static object in the model editor to change it into an entity object. I tried doing it once, but I failed. I don't think I'll ever be able to figure completely how. :/

07-12-2011, 05:40 PM
Find
bigfoot Offline
Member

Posts: 58
Threads: 12
Joined: Dec 2010
Reputation: 0
#5
RE: Set Entity Active Problem

Oh it doesn't matter, then the chairs alone will circle around you :p just as creepy, maybe even creepier. anywho uuhm how can I make the interact callback actually work? cause I don't have any errors but the chairs don't activate.
07-12-2011, 05:43 PM
Find
Kyle Offline
Posting Freak

Posts: 911
Threads: 36
Joined: Sep 2010
Reputation: 7
#6
RE: Set Entity Active Problem

(07-12-2011, 05:43 PM)bigfoot Wrote: Oh it doesn't matter, then the chairs alone will circle around you :p just as creepy, maybe even creepier. anywho uuhm how can I make the interact callback actually work? cause I don't have any errors but the chairs don't activate.

An interact callback looks like this, for example:

void OnStart()
{
     SetEntityPlayerInteractCallback("Object", "Func01", true);
}
void Func01(string &in asEntity)
{
     //Whatever you want to happen here.
}

You can use an interact callback with any entity or script area, but not a static object. The hook is that you could put a script area a little on the outside of the static object so it would be as if you interacted with the static object instead of the script area.

In your script, you forgot the parameters where your function is, as it should match (somewhat) with the callback you make.

void cabinet_nice_1_callback(string &in asEntity)

It isn't the callback that makes the function. It is the function already existing which gives the callback a reason to call the function.

In the function, you can refer to something as "asEntity" which makes the game know that you are talking about "cabinet_nice_1".

(This post was last modified: 07-12-2011, 06:05 PM by Kyle.)
07-12-2011, 06:01 PM
Find
bigfoot Offline
Member

Posts: 58
Threads: 12
Joined: Dec 2010
Reputation: 0
#7
RE: Set Entity Active Problem

(07-12-2011, 06:01 PM)Kyle Wrote:
(07-12-2011, 05:43 PM)bigfoot Wrote: Oh it doesn't matter, then the chairs alone will circle around you :p just as creepy, maybe even creepier. anywho uuhm how can I make the interact callback actually work? cause I don't have any errors but the chairs don't activate.

An interact callback looks like this, for example:

void OnStart()
{
     SetEntityPlayerInteractCallback("Object", "Func01", true);
}
void Func01(string &in asEntity)
{
     //Whatever you want to happen here.
}

You can use an interact callback with any entity or script area, but not a static object. The hook is that you could put a script area a little on the outside of the static object so it would be as if you interacted with the static object instead of the script area.

In your script, you forgot the parameters where your function is, as it should match (somewhat) with the callback you make.

void cabinet_nice_1_callback(string &in asEntity)

It isn't the callback that makes the function. It is the function already existing which gives the callback a reason to call the function.

In the function, you can refer to something as "asEntity" which makes the game know that you are talking about "cabinet_nice_1".

Ah, I forgot the string &in asEntity
YUSH IT WORKS WOOHOO, THANK YOU SOOO MUCH.
(This post was last modified: 07-12-2011, 06:06 PM by bigfoot.)
07-12-2011, 06:05 PM
Find
Streetboat Offline
Posting Freak

Posts: 1,099
Threads: 40
Joined: Mar 2011
Reputation: 56
#8
RE: Set Entity Active Problem

(07-12-2011, 05:40 PM)Kyle Wrote:
(07-12-2011, 05:26 PM)bigfoot Wrote:
(07-12-2011, 05:00 PM)Tanshaydar Wrote: StaticObject entities cannot be (de)activated.

Damn, that sucks Sad, but why does it have an option to make it active or not then? :S

It's not really an entity I guess, just a static object. There is a way to get it working by somehow editing the static object in the model editor to change it into an entity object. I tried doing it once, but I failed. I don't think I'll ever be able to figure completely how. :/

Import the mesh from the static object into the Model Editor, then save it as its own custom entity in your custom story folder, and put it in the level editor like that. Make sure you make it a static entity!

[Image: signature-2.png]
07-12-2011, 07:31 PM
Find
Kyle Offline
Posting Freak

Posts: 911
Threads: 36
Joined: Sep 2010
Reputation: 7
#9
RE: Set Entity Active Problem

(07-12-2011, 07:31 PM)Streetboat Wrote: Import the mesh from the static object into the Model Editor, then save it as its own custom entity in your custom story folder, and put it in the level editor like that. Make sure you make it a static entity!

Alright, I'll go try that. Thanks. Smile

07-12-2011, 07:52 PM
Find




Users browsing this thread: 1 Guest(s)