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
Push up door smooth script
stevenbocco Offline
Junior Member

Posts: 28
Threads: 15
Joined: May 2012
Reputation: 0
#1
Push up door smooth script

Do anyone know a script that makes a door get pushed open when the player collides with an area,
if you do please post it down here and i would be pleased Smile!
I know you guys know this so im already saying thank you :p
(This post was last modified: 05-23-2012, 12:29 PM by stevenbocco.)
05-22-2012, 08:59 PM
Find
FragdaddyXXL Offline
Member

Posts: 136
Threads: 20
Joined: Apr 2012
Reputation: 7
#2
RE: Push up door smooth script

Quote:void AddPropForce(string& asName, float afX, float afY, float afZ, string& asCoordSystem);
void AddPropImpulse(string& asName, float afX, float afY, float afZ, string& asCoordSystem);
void AddBodyForce(string& asName, float afX, float afY, float afZ, string& asCoordSystem);
void AddBodyImpulse(string& asName, float afX, float afY, float afZ, string& asCoordSystem);
Pushes objects. Note that rather high values are needed when applying forces.
asName - the object to push
afX - direction along the X-axis
afY - direction along the Y-axis
afZ - direction along the Z-axis
asCoordSystem - determines which coordinate system is used, usually “world”

Try using an impulse to open the door. I've had problems in the past with this, and you're bound to run into them as well. You need to make it so that the door does not "snap" into the closed position with this:
Quote:void SetSwingDoorDisableAutoClose(string& asName, bool abDisableAutoClose);
Deactivates the “auto-close” when a door is nearly closed.

And then set the door to be just a little open already. You do that in the editor. You click on the door, and set its open amount to 0.1.

Now when the player enters an area, add a prop impulse to open the door. You'll have to do some trial and error to get just the right amount of impulse.

Dark Seclusion Here
05-22-2012, 09:48 PM
Find
stevenbocco Offline
Junior Member

Posts: 28
Threads: 15
Joined: May 2012
Reputation: 0
#3
RE: Push up door smooth script

(05-22-2012, 09:48 PM)FragdaddyXXL Wrote:
Quote:void AddPropForce(string& asName, float afX, float afY, float afZ, string& asCoordSystem);
void AddPropImpulse(string& asName, float afX, float afY, float afZ, string& asCoordSystem);
void AddBodyForce(string& asName, float afX, float afY, float afZ, string& asCoordSystem);
void AddBodyImpulse(string& asName, float afX, float afY, float afZ, string& asCoordSystem);
Pushes objects. Note that rather high values are needed when applying forces.
asName - the object to push
afX - direction along the X-axis
afY - direction along the Y-axis
afZ - direction along the Z-axis
asCoordSystem - determines which coordinate system is used, usually “world”

Try using an impulse to open the door. I've had problems in the past with this, and you're bound to run into them as well. You need to make it so that the door does not "snap" into the closed position with this:
Quote:void SetSwingDoorDisableAutoClose(string& asName, bool abDisableAutoClose);
Deactivates the “auto-close” when a door is nearly closed.

And then set the door to be just a little open already. You do that in the editor. You click on the door, and set its open amount to 0.1.

Now when the player enters an area, add a prop impulse to open the door. You'll have to do some trial and error to get just the right amount of impulse.

thank you i'll try Smile!
05-22-2012, 10:42 PM
Find
stevenbocco Offline
Junior Member

Posts: 28
Threads: 15
Joined: May 2012
Reputation: 0
#4
RE: Push up door smooth script

(05-22-2012, 09:48 PM)FragdaddyXXL Wrote:
Quote:so i tryed but i got an error on line 123

void opening(string &in asParent, string &in asChild, int alState)
{
122 SetSwingDoorDisableAutoClose("castle", true);
123 AddPropImpulse("castle", 0f, 0f, -900f, "world");
}
it said expected , or ) help Smile?
05-23-2012, 12:14 PM
Find
FragdaddyXXL Offline
Member

Posts: 136
Threads: 20
Joined: Apr 2012
Reputation: 7
#5
RE: Push up door smooth script

(05-23-2012, 12:14 PM)stevenbocco Wrote:
(05-22-2012, 09:48 PM)FragdaddyXXL Wrote:
Quote:so i tryed but i got an error on line 123

void opening(string &in asParent, string &in asChild, int alState)
{
122 SetSwingDoorDisableAutoClose("castle", true);
123 AddPropImpulse("castle", 0f, 0f, -900f, "world");
}
it said expected , or ) help Smile?
That means that it's expecting there to be a finishing parenthesis ) or it's missing a ,

Also, that -900f is going to send the door into the 4th dimension. Try something around -15f for starters. Big Grin

As for the error, try looking for a missing: " or ) or a comma. I can't see where the error is, and it leads me to believe a few things:
You may have not hit "Save" in the text editor before starting up the level (happens to me all the time), or
the exception is in another area close to line 123 or
I'm blind xD.

Dark Seclusion Here
(This post was last modified: 05-23-2012, 06:14 PM by FragdaddyXXL.)
05-23-2012, 06:13 PM
Find
paththeir Offline
Junior Member

Posts: 8
Threads: 1
Joined: Mar 2012
Reputation: 0
#6
RE: Push up door smooth script

This is because you're using integers, not floats. It will looks like:
void opening(string &in asParent, string &in asChild, int alState)
{
122 SetSwingDoorDisableAutoClose("castle", true);
123 SetSwingDoorClosed("castle", false, true); //Yes, you could add it
124 AddPropImpulse("castle", 0.0f, 0.0f, -20.0f, "world");
}
(This post was last modified: 05-29-2012, 10:47 AM by paththeir.)
05-29-2012, 10:47 AM
Find
Adrianis Offline
Senior Member

Posts: 620
Threads: 6
Joined: Feb 2012
Reputation: 27
#7
RE: Push up door smooth script

(05-29-2012, 10:47 AM)paththeir Wrote: This is because you're using integers, not floats. It will looks like:
void opening(string &in asParent, string &in asChild, int alState)
{
122 SetSwingDoorDisableAutoClose("castle", true);
123 SetSwingDoorClosed("castle", false, true); //Yes, you could add it
124 AddPropImpulse("castle", 0.0f, 0.0f, -20.0f, "world");
}
Actually, you should find that the script engine deals with it in the same way if you have used -20, -20.0 or -20.0f. Unless there is a limitation I am not yet aware of, I have always taken the simplest option of not defining the .0 decimal even with a float, and have not used the 'f' afterwards either, haven't come across any problems as a result. If someone knows better I would love to be corrected on that, to save future problems Tongue

If the wrong data type was being used the error message should be more like 'no matching signature to AddPropImpulse(string, float, float, int, string)'
05-29-2012, 01:33 PM
Find




Users browsing this thread: 2 Guest(s)