Frictional Games Forum (read-only)

Full Version: Why doesnt it work?
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
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!

Spoiler below!
void OnStart()
{
AddEntityCollideCallback("Player", "Bustie", "Bustied", true, 1);
}

void Bustied(string &in asParent , string &in asChild , int alState)
{
SetEntityActive("Bustie" , true);
SetEntityActive("Bustie2" , false);
}
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)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.
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.
(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.

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