Hi all
Thanks in advance for any input.
Of course all this will reveal a complete lack of coding skill on my part
Note:
Scripts and Models that I post in this thread can be used for Commercial and Non-Commercial purposes
My goal is to create a script for a Force-Field;
The scripts function would include:
1) The normal stuff any door has
---- Open
---- Close
---- Find key to activate if locked
2) When Closed - Push the player backwards if he gets too close to a Force-Field and hurt him a bit
3) 2 would then Generate a partical effect that mimics a ripple or something over the surface of the Force-Field
1) is doable easy enough using a standard door script as a basis
---- a code displayed on screen when entered by player would be better than a key I guess but yeah no idea on that one
2) My first hurdle is pushing the player back when he gets too close
I was hoping there would be a command like PushPlayerBack or the like that would just magically work out which way to push the player - we live in hope
The only command I can find is a ForcePlayer (
angle,
velocity)
Now this does just the trick of pushing the player when setting
velocity to 3
But it always pushes the player in the same direction, so I guess the
angle part is the key to making it work. But I have no idea how to get that info, in fact I doubt if it is even the right command\approach to achieve my goal.
Anyway here is a bit of code I have at present:
local zapPlayer = 0
if g_Entity[e]['activated'] == 1 and g_PlayerHealth > 0 then
PlayerDist = GetPlayerDistance(e)
if (PlayerDist < 50 ) and zapPlayer == 0 then
HurtPlayer(-1,1)
zapPlayer = 1
PlaySound(e,2) -- play sound in slot 2
--PushPlayer (-1,60)
-- need to work out angle
ForcePlayer ( 0, 3)
end
if zapPlayer == 1 then
zapPlayer = 0
end
Anybody know if I be on the right track here, or have any idea how to accomplish this?
Maybe it all concerns those quaterions or whatever those things are that AmenMoses has mentioned before.
Thanks for any input.
Reliquia....
aka OldFlak
i7-4790 @ 3.2GHz. 8GB Ram. NVidia GeForce GTX 1060 6GB. M1: Acer 31.5" @1920x1080 M2: Samsung 31.5" @ 1920 x 1080. M3: Acer 24" @ 1920 x 1080. OS: Windows 10 Pro 64-bit Insider.