Scripts / How to make a simple Freeze player zone?

Author
Message
Neosss199
4
Years of Service
User Offline
Joined: 12th May 2020
Location:
Posted: 12th May 2020 19:46
Hi i am new with Lua scripting, and as far as my knowledge reaches, everything should be fine, but it doesn't show any results.

I explain, I've created a tiggerzone and I have assigned my lua file.



Technically as far as I understand I am doing the following = I check if the player is inside the zone with GetPlayerInZone(e) and if true this return 1 and Freezes the player, but in game naver freezes the player.
PM
AmenMoses
GameGuru Master
8
Years of Service
User Offline
Joined: 20th Feb 2016
Location: Portsmouth, England
Posted: 12th May 2020 22:34 Edited at: 12th May 2020 22:39
That's not how it works.

Use g_Entity[e].plrinzone == 1 then

GetEntityInZone(e) doesn't return a value, it just tells the engine to update the plrinzone state. And as it is called every frame anyhow there is not really any point in calling it yourself.
Been there, done that, got all the T-Shirts!
PM
3com
10
Years of Service
User Offline
Joined: 18th May 2014
Location: Catalonia
Posted: 12th May 2020 22:38
@ Neosss199
LUA is case sensitive, try this one:



Tested and works fine for me.
Laptop: Lenovo - Intel(R) Celeron(R) CPU 1005M @ 1.90GHz

OS: Windows 10 (64) - Ram: 4 gb - Hd: 283 gb - Video card: Intel(R) HD Graphics
cpu mark: 10396.6
2d graphics mark: 947.9
3d graphics mark: 8310.9
memory mark 2584.8
Disk mark: 1146.3
Passmark rating: 3662.4

PM
AmenMoses
GameGuru Master
8
Years of Service
User Offline
Joined: 20th Feb 2016
Location: Portsmouth, England
Posted: 12th May 2020 22:42 Edited at: 12th May 2020 23:05
.. and what 3com said, the _init and _main functions have to be lower case, it's just a GG thing.

** edited to add a useful script.
Been there, done that, got all the T-Shirts!

Attachments

Login to view attachments
PM
Neosss199
4
Years of Service
User Offline
Joined: 12th May 2020
Location:
Posted: 13th May 2020 07:10
I'm an idiot xD, the problem is what the friend 3com said, Along with that I also did not realize that the functions should be called as the file.lua

Works fine with GetPlayerInZone(e) and g_Entity [e] .plrinzone , I don't understand what the difference would be exactly, but I will use the plrinzone

as you commented moises
PM

Login to post a reply

Server time is: 2024-12-22 03:02:00
Your offset time is: 2024-12-22 03:02:00