Scripts / loot script help

Author
Message
MChapman
9
Years of Service
User Offline
Joined: 19th May 2015
Location: USA
Posted: 12th Mar 2016 21:19 Edited at: 12th Mar 2016 21:48
I have this script inside A van entity, it should at first prompt the player, and then when the player presses the e key a medkit will spawn around the van. When i run this nothing happens I tried to set always on and off, and the van is a dynamic entity. I get a "Attempt to try to compare a value with a nil error? The variable that I think is throwing errors is my looted variable that has either a 1 or a 0... I was trying to check to see what the variable was. If looted == 1 then the entity has been looted and if the looted == 0 the van hasn't been looted. I hope this is enough info on what i'm trying to do.


Markchapman10 is my Skype let's have some dev talk.
smallg
Community Leader
19
Years of Service
User Offline
Joined: 8th Dec 2005
Location:
Posted: 12th Mar 2016 21:44
you need to move this inside the main script
pDist = GetPlayerDistance(e)
lua guide for GG
https://steamcommunity.com/sharedfiles/filedetails/?id=398177770
windows 10
i5 @4ghz, 8gb ram, AMD R9 200 series , directx 11
MChapman
9
Years of Service
User Offline
Joined: 19th May 2015
Location: USA
Posted: 12th Mar 2016 21:54
face palm......... I did but now all I'm getting is the prompt pressing e don't do anything. learning this is gonna drive me crazy thanks smallg.
Markchapman10 is my Skype let's have some dev talk.
smallg
Community Leader
19
Years of Service
User Offline
Joined: 8th Dec 2005
Location:
Posted: 12th Mar 2016 23:16 Edited at: 13th Mar 2016 17:17
it should be g_KeyPressE not g_KeyPressedE
also your "press e to loot needs an extra condition or it will always show up


edit; fixed the script, you should declare variables outside of the init(e) and also SpawnIfUsed(e) is not a valid function
lua guide for GG
https://steamcommunity.com/sharedfiles/filedetails/?id=398177770
windows 10
i5 @4ghz, 8gb ram, AMD R9 200 series , directx 11
McTank
8
Years of Service
User Offline
Joined: 2nd Mar 2016
Location:
Posted: 13th Mar 2016 16:21
This doesn't work for me at all, no prompt nothing.
PM
MChapman
9
Years of Service
User Offline
Joined: 19th May 2015
Location: USA
Posted: 13th Mar 2016 17:38 Edited at: 13th Mar 2016 17:40
yea, lol.I'm rewriting it, after I get this script though ill make a text base inventory.... Lua is definitely fun. Something that gets me is how would someone program a button ? I have the button working but when I press the button in its as if I was holding it in. I've tried a button press variable but to no prevail.
Markchapman10 is my Skype let's have some dev talk.

Login to post a reply

Server time is: 2024-12-22 14:55:45
Your offset time is: 2024-12-22 14:55:45