Scripts / [SOLVED] Can someone please tell me why this tiny script wont work?.

Author
Message
Phodis
8
Years of Service
User Offline
Joined: 2nd Feb 2016
Location:
Posted: 8th Jun 2020 19:03
Hi everyone I am trying to learn some basics and thought I would try adding in a script.
So I found a basic LUA script that I want to use. It simply rotates an object/character towards the player... now weather I attach the script to a barrel or a character it wont work. (I'd like it to actually work with both)....

I go into the FPE file as well and point the object to the script
I go to the properties on the object/character as well, and change the ai to point to this script...but it never works.

There must be some simple little thing I have missed. Can anyone help me with this please?.
This is the script I am using...

function billboard_init(e)
end
function billboard_main(e)
PlayerDist = GetPlayerDistance(e)
if PlayerDist < 100 then
RotateToPlayer(e)
end
end

The author of this post has marked a post as an answer.

Go to answer
PM
Teabone
Forum Support
17
Years of Service
User Offline
Joined: 8th Jun 2006
Location: Earth
Posted: 8th Jun 2020 19:39
This post has been marked by the post author as the answer.
What is your lua script file name called. It must be the same as your functions.

For example it should be called billboard.lua
Store Assets - Store Link

i7 -2600 CPU @ 3.40GHz - Windows 7 - 8GB RAM - Nivida GeForce GTX 960
Phodis
8
Years of Service
User Offline
Joined: 2nd Feb 2016
Location:
Posted: 8th Jun 2020 20:29
Thanks TeaBone!!!... that was the one little I missed!!
I got it working, anything I attach it to, rotates to face me perfectly now!..

I wish I could figure out how to make it rotate vertically as well now tho... I don't suppose there is an idiots guide to 3d programming in LUA
anywhere that might be good to really help me get started anywhere?.

Once again cheers for your help!
PM
GubbyBlips
5
Years of Service
User Offline
Joined: 14th Jan 2019
Location:
Posted: 9th Jun 2020 00:42
At least a rudimentary help file for Lua w/ GG usage would
be pretty useful accessed from the UI- agreed?
Ahhh what is this -- found one; GG/Help.
PM
Phodis
8
Years of Service
User Offline
Joined: 2nd Feb 2016
Location:
Posted: 9th Jun 2020 16:18
Thanks GubbyBlips, I didn't know that was even there!
Looks like everything I need to start with, thanks for making me aware of it.
PM

Login to post a reply

Server time is: 2024-04-24 10:50:29
Your offset time is: 2024-04-24 10:50:29