Angerpull
Member
Posts: 88
Threads: 24
Joined: Jun 2011
Reputation:
0
|
Why doesnt it work?
Hello. I made a script that when I walk into an area, I want a object to disappear, and reappear in a another area. I have a bust on a couple of drawers and I want that to disappear and appear infront of the door (creepy).
So what is wrong with my script? The bust appear right away when I enter the map, so I cannot enter the room cuz the damn thing is blocking my way. And yes I have checked off the 'Active' thing on the entity. Still it appears!
(This post was last modified: 07-06-2011, 07:32 AM by Angerpull.)
|
|
07-06-2011, 02:46 AM |
|
Kyle
Posting Freak
Posts: 911
Threads: 36
Joined: Sep 2010
Reputation:
7
|
RE: Why doesnt it work?
It doesn't work because it's a static prop. It needs to be an object or something, for it allows it to be set active or not.
|
|
07-06-2011, 02:51 AM |
|
Angerpull
Member
Posts: 88
Threads: 24
Joined: Jun 2011
Reputation:
0
|
RE: Why doesnt it work?
(07-06-2011, 02:51 AM)Kyle Wrote: It doesn't work because it's a static prop. It needs to be an object or something, for it allows it to be set active or not.
Any way I can make it work? Or is it completely out of the question?
Any help would be seriously nice.
(This post was last modified: 07-06-2011, 03:21 AM by Angerpull.)
|
|
07-06-2011, 02:57 AM |
|
cook
Member
Posts: 103
Threads: 6
Joined: Apr 2011
Reputation:
0
|
RE: Why doesnt it work?
Kyle is mistaken, the bust is an Entity. You've got the two of them mixed up.
AddEntityCollideCallback("Player", "Bustie", "Bustied", true, 1);
should be
AddEntityCollideCallback("Player", "triggername", "Bustied", true, 1);
You have your Collide area set to one of Busts currently, you want an EntityInteract callback if you want to do that sort of thing - but I assume you want to move the busts when it's out of the players view, so make a trigger(script area) in a nearby area that'll set it off when the player collides with that and then set triggername to what that trigger is called in the Editor.
More complex methods: after a trigger has been stepped in, and the bust looked at - activate a callback/script area that when a player looks at an area away from the bust, the bust disappears. This will make it appear more natural and allows you to do it in line of sight, whilst preventing it from being triggered by the player looking at the area outside of the trigger - from a different angle that might allow sight of the bust.
If one of the Busts is still in the doorway - check you didn't get them mixed up in the Editor - ticked the wrong one active.
(This post was last modified: 07-06-2011, 04:30 AM by cook.)
|
|
07-06-2011, 04:27 AM |
|
Angerpull
Member
Posts: 88
Threads: 24
Joined: Jun 2011
Reputation:
0
|
RE: Why doesnt it work?
(07-06-2011, 04:27 AM)cook Wrote: Kyle is mistaken, the bust is an Entity. You've got the two of them mixed up.
AddEntityCollideCallback("Player", "Bustie", "Bustied", true, 1);
should be
AddEntityCollideCallback("Player", "triggername", "Bustied", true, 1);
You have your Collide area set to one of Busts currently, you want an EntityInteract callback if you want to do that sort of thing - but I assume you want to move the busts when it's out of the players view, so make a trigger(script area) in a nearby area that'll set it off when the player collides with that and then set triggername to what that trigger is called in the Editor.
More complex methods: after a trigger has been stepped in, and the bust looked at - activate a callback/script area that when a player looks at an area away from the bust, the bust disappears. This will make it appear more natural and allows you to do it in line of sight, whilst preventing it from being triggered by the player looking at the area outside of the trigger - from a different angle that might allow sight of the bust.
If one of the Busts is still in the doorway - check you didn't get them mixed up in the Editor - ticked the wrong one active.
Okay so could you give me a script so it works? This is just fcking confusing. I can make a cave in happen just fine, but when I try to make Busts appear in a different location, that's when shit hits the fan and the game says 'Nope'.
So a script that works would be cool.
|
|
07-06-2011, 05:26 AM |
|
cook
Member
Posts: 103
Threads: 6
Joined: Apr 2011
Reputation:
0
|
RE: Why doesnt it work?
I just tested it and it can't be de-activated, it still appears in the map - this happens with the deformed statues too, I'm not sure what the criteria is for this since the bust is an entity, or is atleast listed in the entities. My bad, thought Kyle meant literally a Static Prop from the Statics tab.
You may be able to fix it by editing it in the Model Editor, but I'd just use another Entity, for future reference I'm sure all of the statues have this problem, but the Knights and the Childsnake don't. The chained man statue in the ptest folder doesn't do this.
(This post was last modified: 07-06-2011, 05:46 AM by cook.)
|
|
07-06-2011, 05:43 AM |
|
Roenlond
Senior Member
Posts: 331
Threads: 3
Joined: Apr 2011
Reputation:
0
|
RE: Why doesnt it work?
The actual model is a static prop but it is still an entity, only its properties disallow it disappearing. I am pretty sure that you can create a new bust by copying and editing the old, but I'm not certain on just how.
|
|
07-06-2011, 10:26 AM |
|
jens
Frictional Games
Posts: 4,093
Threads: 199
Joined: Apr 2006
Reputation:
202
|
RE: Why doesnt it work?
It is easy, open the original entity file in the model editor, re-save the entity with another name, go to the user variables (in one of the menus) and set it to Object with sub type Static. That should be all you need to do to turn a StaticProp entity into an entity that can be used in scripts.
|
|
07-06-2011, 10:54 AM |
|
|