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
Script Help [SOLVED] AddBodyForce doesn't work
Kiwi2703 Offline
Junior Member

Posts: 27
Threads: 5
Joined: Sep 2012
Reputation: 2
#1
[SOLVED] AddBodyForce doesn't work

Hey Smile
I have an area called ScriptArea_2. I want the player to be pushed forward (about 1 meter) and slighty upward (~0.2m) when he collides with the area.
The script looks like this:

void OnStart()
{
AddEntityCollideCallback("Player", "ScriptArea_2", "theforce", true, 1);
}

void theforce(string &in asParent, string &in asChild, int alState)
{
AddBodyForce("Player", 0.0f, 500.0f, 5000.0f, "world");
}

I set the values so high only for experimental purposes. The problem is, when I walk into the area, absolutely nothing happens.
Any help? Thanks! Smile
(This post was last modified: 09-07-2012, 10:50 AM by Kiwi2703.)
09-06-2012, 06:35 PM
Find
Robby Offline
Posting Freak

Posts: 2,549
Threads: 38
Joined: Jun 2009
Reputation: 47
#2
RE: AddBodyForce doesn't work

(09-06-2012, 06:35 PM)Kiwi2703 Wrote: Hey Smile
I have an area called ScriptArea_2. I want the player to be pushed forward (about 1 meter) and slighty upward (~0.2m) when he collides with the area.
The script looks like this:

void OnStart()
{
AddEntityCollideCallback("Player", "ScriptArea_2", "theforce", true, 1);
}

void theforce(string &in asParent, string &in asChild, int alState)
{
AddBodyForce("Player", 0.0f, 500.0f, 5000.0f, "world");
}

I set the values so high only for experimental purposes. The problem is, when I walk into the area, absolutely nothing happens.
Any help? Thanks! Smile
I don't see anything wrong with this. Have you created the script file while the map was open in Amnesia? If yes, close Amnesia, then start it again.

Also, are the names correct? Triple-check, to be sure.

Infrequently active. Don't expect an immediate response. Best to contact me at a different locale. If I create a thread, expect me to be quite active.
(This post was last modified: 09-06-2012, 06:43 PM by Robby.)
09-06-2012, 06:38 PM
Website Find
Kreekakon Offline
Pick a god and pray!

Posts: 3,063
Threads: 70
Joined: Mar 2012
Reputation: 124
#3
RE: AddBodyForce doesn't work

Try this command instead:
void AddPlayerBodyForce(float afX, float afY, float afZ, bool abUseLocalCoords);

[Image: Tv0YgQb.gif]
Image by BandyGrass
09-06-2012, 06:44 PM
Find
EXAWOLT Offline
Member

Posts: 113
Threads: 14
Joined: Apr 2012
Reputation: 3
#4
RE: AddBodyForce doesn't work

AddPlayerBodyForce(float afX, float afY, float afZ, bool abUseLocalCoords);

simply nuff said




09-06-2012, 06:44 PM
Find
Robby Offline
Posting Freak

Posts: 2,549
Threads: 38
Joined: Jun 2009
Reputation: 47
#5
RE: AddBodyForce doesn't work

Yeah, didn't think of ^. Try that instead.

LOL, 2 posts on the same time.

Infrequently active. Don't expect an immediate response. Best to contact me at a different locale. If I create a thread, expect me to be quite active.
09-06-2012, 06:48 PM
Website Find
EXAWOLT Offline
Member

Posts: 113
Threads: 14
Joined: Apr 2012
Reputation: 3
#6
RE: AddBodyForce doesn't work

haha, this do happen us some times^^

simply nuff said




09-06-2012, 06:51 PM
Find
Kiwi2703 Offline
Junior Member

Posts: 27
Threads: 5
Joined: Sep 2012
Reputation: 2
#7
RE: AddBodyForce doesn't work

(09-06-2012, 06:44 PM)Kreekakon Wrote:
void AddPlayerBodyForce(float afX, float afY, float afZ, bool abUseLocalCoords);
It worked but I had to set the values to 10000.0f and higher... no idea why it wants so much power Huh
Many thanks anyways! Smile
09-06-2012, 06:52 PM
Find
EXAWOLT Offline
Member

Posts: 113
Threads: 14
Joined: Apr 2012
Reputation: 3
#8
RE: AddBodyForce doesn't work

about the callback:
Pushes the player into a certain direction. Note that you need values above ~2000 to see any effects.

simply nuff said




09-06-2012, 06:52 PM
Find
Robby Offline
Posting Freak

Posts: 2,549
Threads: 38
Joined: Jun 2009
Reputation: 47
#9
RE: AddBodyForce doesn't work

(09-06-2012, 06:52 PM)Kiwi2703 Wrote:
(09-06-2012, 06:44 PM)Kreekakon Wrote:
void AddPlayerBodyForce(float afX, float afY, float afZ, bool abUseLocalCoords);
It worked but I had to set the values to 10000.0f and higher... no idea why it wants so much power Huh
Many thanks anyways! Smile

Note that rather high values are needed when applying forces.

[align=start]
As said on the script functions page located on the wiki.
[/align]

Infrequently active. Don't expect an immediate response. Best to contact me at a different locale. If I create a thread, expect me to be quite active.
09-06-2012, 06:56 PM
Website Find
Kiwi2703 Offline
Junior Member

Posts: 27
Threads: 5
Joined: Sep 2012
Reputation: 2
#10
RE: AddBodyForce doesn't work

(09-06-2012, 06:56 PM)Nemet Robert Wrote:
(09-06-2012, 06:52 PM)Kiwi2703 Wrote:
(09-06-2012, 06:44 PM)Kreekakon Wrote:
void AddPlayerBodyForce(float afX, float afY, float afZ, bool abUseLocalCoords);
It worked but I had to set the values to 10000.0f and higher... no idea why it wants so much power Huh
Many thanks anyways! Smile

Note that rather high values are needed when applying forces.

[align=start]
As said on the script functions page located on the wiki.
[/align]

Actually, on the scripts page were some really low values.. like 3.5f and such
09-06-2012, 06:59 PM
Find




Users browsing this thread: 2 Guest(s)