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 How do I make a chair move?
Spelos Away
Banned

Posts: 231
Threads: 19
Joined: Sep 2014
#18
RE: How do I make a chair move?

Alright, I finally got to check the script. It seems that you forgot to change the playerY and chairY variable names to their Z variants when renaming.

I'm not going to stress this too much, but:
"chairY is not defined" is a very simple error, especially when it tells you the line.
But sure, happens to all of us.

Working script:
Spoiler below!

PHP Code: (Select All)
float playerX;
float playerZ;
float chairX;
float chairZ;

void OnStart()
{
    
AddEntityCollideCallback("Player""test_area""TestFunction"false1);
}

void TestFunction(string &in asParentstring &in asChildint alState)
{
    
TimerPushLoop("timer_Chair");
}

void TimerPushLoop(string &in asTimer)
{
    
AddTimer(asTimer0.1f"TimerPushLoop");
    
NudgeChairTowardsPlayer();
    
// Add some kind of break so that the chair doesn't follow you forever.
    // Or perhaps don't. =)
}

void NudgeChairTowardsPlayer()
{
    
chairX GetEntityPosX("chair");
    
chairZ GetEntityPosZ("chair");
    
playerX GetPlayerPosX();
    
playerZ GetPlayerPosZ();
    
    
float playerXinRelationToChair playerX chairX;
    
float playerZinRelationToChair playerZ chairZ;
    
    
float forceMultiplier 500;
    
    
AddPropForce("chair"playerXinRelationToChair forceMultiplier0.0fplayerZinRelationToChair forceMultiplier"World");



I AM HAVING TOO MUCH FUN WITH THE SCRIPT!
[video=youtube]https://youtu.be/Y5QPm5jl9hE[/video]

Thanks again,
12-16-2016, 09:36 AM
Find


Messages In This Thread
How do I make a chair move? - by goodcap - 12-10-2016, 06:57 AM
RE: How do I make a chair move? - by Spelos - 12-10-2016, 10:24 AM
RE: How do I make a chair move? - by Spelos - 12-11-2016, 09:00 AM
RE: How do I make a chair move? - by Mudbill - 12-10-2016, 04:03 PM
RE: How do I make a chair move? - by goodcap - 12-10-2016, 05:16 PM
RE: How do I make a chair move? - by goodcap - 12-10-2016, 07:31 PM
RE: How do I make a chair move? - by Mudbill - 12-10-2016, 07:48 PM
RE: How do I make a chair move? - by goodcap - 12-10-2016, 08:08 PM
RE: How do I make a chair move? - by goodcap - 12-10-2016, 09:17 PM
RE: How do I make a chair move? - by Spelos - 12-12-2016, 08:19 PM
RE: How do I make a chair move? - by Spelos - 12-16-2016, 09:36 AM
RE: How do I make a chair move? - by Daemian - 12-16-2016, 06:01 PM



Users browsing this thread: 1 Guest(s)