Scripts / ammo.lua script [QUESTION]

Author
Message
xSyndicate58
7
Years of Service
User Offline
Joined: 25th Feb 2017
Location:
Posted: 27th Feb 2017 11:44
Hey community, I'm totally new to GameGuru and LUA scripting, so please don't blame me.

So I tried modifying the default ammo.lua file, so that the character has to press E to pick ammo up, instead of only walking above it.

this is my Code:



I'm getting the error
LUA ERROR!: scriptbank\ammo.lua:15 'then' expcted near '='

I'm not sure what to do. I hope you guys can help me out..

gretings.
PM
Belidos
3D Media Maker
8
Years of Service
User Offline
Joined: 23rd Nov 2015
Playing: The Game
Posted: 27th Feb 2017 12:02
I think its be cause you have too many "and" statements in one line.


i5, NV960 2GB, 16GB memory, 2x 2TB Hybrid, Win10.
smallg
Community Leader
18
Years of Service
User Offline
Joined: 8th Dec 2005
Location:
Posted: 27th Feb 2017 12:02 Edited at: 27th Feb 2017 12:05
name it ammo_range.lua


edit
Quote: "I think its be cause you have too many "and" statements in one line."

nope, he missed an = while checking the key press... also that variable doesn't exist, also 2 functions inside each other... also the function names are all different... many issues
lua guide for GG
https://steamcommunity.com/sharedfiles/filedetails/?id=398177770
windows 10
i5 @4ghz, 8gb ram, AMD R9 200 series , directx 11
xSyndicate58
7
Years of Service
User Offline
Joined: 25th Feb 2017
Location:
Posted: 27th Feb 2017 12:33
Thanks for the responses.

I have a question in general about LUA: Can't I have more than the one main function in one script?

sincerely
PM
smallg
Community Leader
18
Years of Service
User Offline
Joined: 8th Dec 2005
Location:
Posted: 27th Feb 2017 13:56
you can yes but not inside each other, i dont think any language would support that
lua guide for GG
https://steamcommunity.com/sharedfiles/filedetails/?id=398177770
windows 10
i5 @4ghz, 8gb ram, AMD R9 200 series , directx 11
xSyndicate58
7
Years of Service
User Offline
Joined: 25th Feb 2017
Location:
Posted: 27th Feb 2017 15:47
alright thanks. Thread can be closed
PM
lalemanalex87
GameGuru TGC Backer
9
Years of Service
User Offline
Joined: 28th Feb 2015
Location:
Posted: 6th Mar 2017 01:01
i was wondering can i use that script in my game if i can who should i give credit to, and i was wondering is there away to do that with the med kits to be able to pick up with e, sorry if this is wrong place to ask just wondering am bad at lua still trying to learn it
PM
Pirate Myke
Forum Support
13
Years of Service
User Offline
Joined: 31st May 2010
Location: El Dorado, California
Posted: 6th Mar 2017 01:44 Edited at: 6th Mar 2017 05:55
Give credit to who ever wrote it.

smallg wrote the second one. ammo_range.lua

The one you had posted started from a stock script, so give yourself credit for the additions, and TGC for the base script if you want.
Intel(R) Core(TM)2 Quad CPU Q6600 @ 2.40GHz, 2400 Mhz, 4 Core(s), 4 Logical Processor(s), 8gb RAM, Nvidia gtx660, Windows 7 Pro 64bit, Screen resolution 1680 x 1050.

Login to post a reply

Server time is: 2024-04-26 17:43:41
Your offset time is: 2024-04-26 17:43:41