Scripts / [Free Script] take,carry, drop items

Author
Message
Corno_1
GameGuru Tool Maker
13
Years of Service
User Offline
Joined: 3rd Nov 2010
Location:
Posted: 25th Sep 2014 17:53 Edited at: 11th Oct 2014 14:02
Here is my first script!



Important:

- Switch physics off/on (what works for you)

- Make entity dynamic



Features:

Pick item up

Carry item around with you

drop items like a boss



Bugs:

Physics doesn´t switch off with GravityOff(e), so item shake in the air



Have a nice day



Corno_1



Download:

My dream is to develope games, which makes fun when I create it and fun when other people play it.
PM
Teabone
Forum Support
17
Years of Service
User Offline
Joined: 8th Jun 2006
Location: Earth
Posted: 25th Sep 2014 20:51
I'll check this one out once I get home from work

i7 -2600 CPU @ 3.40GHz - Windows 7 - 8GB RAM - Nivida GeForce 420 GT
Teabone
Forum Support
17
Years of Service
User Offline
Joined: 8th Jun 2006
Location: Earth
Posted: 28th Sep 2014 05:40 Edited at: 29th Sep 2014 09:36
Didn't seem to work for me in Beta 1.008



Should I have the entities I wish to be carried a certain weight? Or does that not matter?

i7 -2600 CPU @ 3.40GHz - Windows 7 - 8GB RAM - Nivida GeForce 420 GT
Corno_1
GameGuru Tool Maker
13
Years of Service
User Offline
Joined: 3rd Nov 2010
Location:
Posted: 28th Sep 2014 11:37
Quote: "Didn't seem to work for me in Beta 1.008"

Can you update to 1.0085? Beta 1.008 has so much problems for me I can´t test it, becuase it always crash

My dream is to develope games, which makes fun when I create it and fun when other people play it.
PM
Teabone
Forum Support
17
Years of Service
User Offline
Joined: 8th Jun 2006
Location: Earth
Posted: 29th Sep 2014 09:24
No problem I'll download the newest version in the morning. I'm currently experiencing unpredictable internet connection, so I've not been able to download without interrupts. Hopefully soon. The script looks promising!

i7 -2600 CPU @ 3.40GHz - Windows 7 - 8GB RAM - Nivida GeForce 420 GT
almightyhood
10
Years of Service
User Offline
Joined: 9th Oct 2013
Location:
Posted: 6th Oct 2014 04:01 Edited at: 6th Oct 2014 04:25
I also cant get this to work , I am using 1.0085 put the script on a bookcase but testing didn't pick up the bookcase.

not sure if I did something wrong though with script?

the script is just what I need though





ok I got this 1 to work by chaning it to dynamic instead of static lol, works great now thanks a lot

evga GeForce gtx 750 ti boost2.0 2gb gddr5. win 8.1 quad core 4gb ram.
PM
Corno_1
GameGuru Tool Maker
13
Years of Service
User Offline
Joined: 3rd Nov 2010
Location:
Posted: 6th Oct 2014 12:04
Sorry I forget it to write in my first post. A entity must be always dynamic to use scripts!!

My dream is to develope games, which makes fun when I create it and fun when other people play it.
PM
DVader
20
Years of Service
User Offline
Joined: 28th Jan 2004
Location:
Posted: 6th Oct 2014 13:10
I just wrote a script to do this, by modifying my body script. Didn't notice this one!



SPECS: Q6600 CPU. Nvidia 660GTX. 8 Gig Memory. Win 7.
smallg
Community Leader
18
Years of Service
User Offline
Joined: 8th Dec 2005
Location:
Posted: 6th Oct 2014 18:31
Quote: "I just wrote a script to do this, by modifying my body script. Didn't notice this one!"

are you planning to release yours? corno's script does not work for me so would be nice to see what's different in yours.

life's one big game

windows vista ultimate

i5 @3.3ghz, 4gb ram, geforce gtx460, directx 11
Corno_1
GameGuru Tool Maker
13
Years of Service
User Offline
Joined: 3rd Nov 2010
Location:
Posted: 7th Oct 2014 22:09 Edited at: 7th Oct 2014 22:13
Quote: "corno's script does not work for me"


Strange that so many persons have problem with this script! Can you explain what happens?

Please try the following:

Place the script in the scriptbank folder

Start Reloaded

Place the cardboard box (small) entity

set as main script carryitem.lua

test it



Corno_1

My dream is to develope games, which makes fun when I create it and fun when other people play it.
PM
TattieBoJangle
10
Years of Service
User Offline
Joined: 7th Jan 2014
Location: United Kingdom
Posted: 7th Oct 2014 22:35
Also make sure the entity is dynamic





PC SPECS: Windows 8.1 Pro 64-bit, Intel I7 - 4GHz CPU, Asus R9 6GB GPU - 32GB DDR3 MEM
smallg
Community Leader
18
Years of Service
User Offline
Joined: 8th Dec 2005
Location:
Posted: 9th Oct 2014 11:58
lol i think i know how the scripting works but yh i will explain
it works at first, i get the prompt to pick up the item, i press E and the item (doesnt matter which item i use) vanishes and the prompt briefly changes to drop item and then no prompt at all and no more item (note i only pressed E to pick up, not again to put down, even if i press E again nothing happens either though)... even with set to always active there is no difference.

life's one big game

windows vista ultimate

i5 @3.3ghz, 4gb ram, geforce gtx460, directx 11
AuShadow
GameGuru TGC Backer
10
Years of Service
User Offline
Joined: 2nd Dec 2013
Location: Australia
Posted: 9th Oct 2014 13:01
LMAO explaining to the man who made more scripts for reloaded then any other I've seen yet, sorry but had to point it out, made me laugh .

Now smallg are you sure you're function name and lua file name are the same..... Just kidding

PC Specs: Windows 7 home 64-bit, Amd 7900 3gb DDR5 graphics, 8gb DDR3 Ram, Intel i7 3.4ghz
DVader
20
Years of Service
User Offline
Joined: 28th Jan 2004
Location:
Posted: 9th Oct 2014 18:10
I was thinking of adding more things and putting it on the store as a pack. However, the script works fine in all areas I have tried and could be released as is. There's just one niggle niggle I need to sort before though. Should be easy enough, but i have to be in the mood to get scripting, so not got round to adding anything since posting my video.



SPECS: Q6600 CPU. Nvidia 660GTX. 8 Gig Memory. Win 7.
Corno_1
GameGuru Tool Maker
13
Years of Service
User Offline
Joined: 3rd Nov 2010
Location:
Posted: 10th Oct 2014 14:50
Quote: "LMAO explaining to the man who made more scripts for reloaded then any other I've seen yet, sorry but had to point it out, made me laugh "

Ok, good to know that you laugh about me! But I also explain laughing people why I do this:
When something is not working then there are two options:
- Your mistake
- Other person mistake
(in this case a third)- the engines mistake
To fix the bug, you must be sure the other person did all like you! This way is normal in the information sector. Hope you stop laughing now!

@smallg
Thanks for your small report. I will try to fix it and test it on different PCs. Can I contact you if I finished it? That would be nice...

@DVader I am not sure if you talk about my or your script? Did my script work for you?

My dream is to develope games, which makes fun when I create it and fun when other people play it.
PM
almightyhood
10
Years of Service
User Offline
Joined: 9th Oct 2013
Location:
Posted: 10th Oct 2014 15:00
well the script works fine for me no problems m8 just had to change the asset to be movable was all great to have it aswell as it makes for more interesting game play when player have to move things to find hidden doors
thanks again

evga GeForce gtx 750 ti boost2.0 2gb gddr5. win 8.1 quad core 4gb ram.
PM
AuShadow
GameGuru TGC Backer
10
Years of Service
User Offline
Joined: 2nd Dec 2013
Location: Australia
Posted: 10th Oct 2014 15:04
@corno no disrespect meant mate and sorry if it came off that way I do apologise

PC Specs: Windows 7 home 64-bit, Amd 7900 3gb DDR5 graphics, 8gb DDR3 Ram, Intel i7 3.4ghz
smallg
Community Leader
18
Years of Service
User Offline
Joined: 8th Dec 2005
Location:
Posted: 10th Oct 2014 18:26 Edited at: 10th Oct 2014 18:37
Quote: "well the script works fine for me no problems m8 just had to change the asset to be movable was all great to have it aswell as it makes for more interesting game play when player have to move things to find hidden doors

thanks again "




think u might need to add a few more smiles in there

but seriously to add to my previous list i also made sure the item was movable.



@corno1 sure, will be happy to test it for you again, i still don't see any reason the first script doesnt work for me so i wish you luck finding the issue... and as it's working for everyone else i shouldn't worry too much unless someone else finds it not working

p.s. DVader is talking about his own script



this is what happens for me







@AuShadow lol, language barrier i think

life's one big game

windows vista ultimate

i5 @3.3ghz, 4gb ram, geforce gtx460, directx 11
DVader
20
Years of Service
User Offline
Joined: 28th Jan 2004
Location:
Posted: 10th Oct 2014 18:51
Yes, I was talking about my script. I just put mine up on the store, but awaiting approval. Not tried this one as I wrote my own, just noticed this, as I had just put up my video for mine. With this one out, I doubt I will get many takers, but I'm keen to test things out, and not tried a script before. I will be adding more that will function alongside in the future hopefully with as little fuss as possible. In the hopes of adding survival type elements and such. I have a few ideas, but have yet to fully flesh them out.



SPECS: Q6600 CPU. Nvidia 660GTX. 8 Gig Memory. Win 7.
smallg
Community Leader
18
Years of Service
User Offline
Joined: 8th Dec 2005
Location:
Posted: 10th Oct 2014 18:54
ok i figured out why it's not working, when you say
Quote: "switch physics on"
you really mean switch physics off... works now

life's one big game

windows vista ultimate

i5 @3.3ghz, 4gb ram, geforce gtx460, directx 11
vrg
9
Years of Service
User Offline
Joined: 27th Aug 2014
Location: Netherlands
Posted: 26th Oct 2014 11:14
Is it possible items which you collect with collected() to drop somewhere else ? I am creating a script where you have to put on a radiation protection suit when you are finished you can put the suit off.
vrg
9
Years of Service
User Offline
Joined: 27th Aug 2014
Location: Netherlands
Posted: 26th Oct 2014 12:27
I created the "radiationsuit2" script but Reloaded freeze while starting:


-- LUA Script - precede every function and global member with lowercase name of script + '_main'
-- Protoncubes must be destroyed by player.

local pressed = 0
local radiationsuit = 0
local radiationsuit_state = {}
function radiationsuit2_init(e)
radiationsuit_state[e] = 0
end

function radiationsuit2_main(e)
PlayerDX = g_Entity[e]['x'] - g_PlayerPosX;
PlayerDY = g_Entity[e]['y'] - g_PlayerPosY;
PlayerDZ = g_Entity[e]['z'] - g_PlayerPosZ;
PlayerDist = math.sqrt(math.abs(PlayerDX*PlayerDX)+math.abs(PlayerDY*PlayerDY)+math.abs(PlayerDZ*PlayerDZ));

if PlayerDist < 80 then
radiationsuit = radiationsuit + 1
PromptDuration(radiationsuit.. " Radiation Protectionsuit found. Press E to put the suit on",4000)
-- Put suit on
if g_KeyPressE == 1 and pressed == 0 then
pressed = 1
PlaySound(e,0);
SetAmbienceGreen(e,200);
radiationsuit_state[e] = 1
ResetPosition(e,0,0,0)
ActivateIfUsed(e)
end
end
-- Put suit off
if radiationsuit > 1 then
if g_KeyPressE == 1 and pressed == 0 then
PromptDuration( " Put Radiation Protectionsuit off",2000)
PlaySound(e,0);
SetAmbienceGreen(e,100);
ResetPosition(e,g_PlayerPosX,g_PlayerPosY-60,g_PlayerPosZ)
radiationsuit = radiationsuit - 1
Show(e)
end
end

What is wrong with the script?
3com
9
Years of Service
User Offline
Joined: 18th May 2014
Location: Catalonia
Posted: 26th Oct 2014 14:44
I though you miss last "End" statment in your script. This mean you do not close "function radiationsuit2_main(e)".

HTH
3com
PM
Gtox
3D Media Maker
9
Years of Service
User Offline
Joined: 5th Jun 2014
Location: South Africa
Posted: 26th Oct 2014 15:04 Edited at: 26th Oct 2014 15:05
When a script causes an error, an extra FPSCR icon appears on your taskbar - if you click this icon, you can see what the error is, and what line the error is on. I'm not sure if this works on a single screen setup (maybe if you hit alt+tab), but it does work on a dual screen setup.

Attachments

Login to view attachments
vrg
9
Years of Service
User Offline
Joined: 27th Aug 2014
Location: Netherlands
Posted: 26th Oct 2014 15:40
Reloaded started but the script does not have the function I want. You must put on the suit by pressing the E key and put the suit off by pressing the E key again. I think it will not work
smallg
Community Leader
18
Years of Service
User Offline
Joined: 8th Dec 2005
Location:
Posted: 26th Oct 2014 17:31
Quote: "Is it possible items which you collect with collected() to drop somewhere else ? I am creating a script where you have to put on a radiation protection suit when you are finished you can put the suit off. "


what you need is something like my mine script
http://fpscrforum.thegamecreators.com/?m=forum_view&t=207801&b=2&msg=2498182#m2498182
if you need any further help feel free to let me know

life's one big game

windows vista ultimate

i5 @3.3ghz, 4gb ram, geforce gtx460, directx 11
vrg
9
Years of Service
User Offline
Joined: 27th Aug 2014
Location: Netherlands
Posted: 26th Oct 2014 21:20
Thanks smallg, the problem, collecting the suite is working, the second part of the script putting off the suit is not working.
I think when the suit is gone in the first part, the second part is not working. I need some help with it thanks.
smallg
Community Leader
18
Years of Service
User Offline
Joined: 8th Dec 2005
Location:
Posted: 27th Oct 2014 19:59
vrg wrote: "Thanks smallg, the problem, collecting the suite is working, the second part of the script putting off the suit is not working.
I think when the suit is gone in the first part, the second part is not working. I need some help with it thanks."




adjusted your code above to make a script, hopefully that is closer to what you were aiming for
script file attached

life's one big game

windows vista ultimate

i5 @3.3ghz, 4gb ram, geforce gtx460, directx 11

Attachments

Login to view attachments
vrg
9
Years of Service
User Offline
Joined: 27th Aug 2014
Location: Netherlands
Posted: 27th Oct 2014 21:51
Thanks for the help smallg, I am analysing your script what I did wrong or needed. I don't understand what the meaning is of nil

Login to post a reply

Server time is: 2024-05-02 11:23:13
Your offset time is: 2024-05-02 11:23:13