Scripts / problem with destroy script

Author
Message
HappyAlpaka
8
Years of Service
User Offline
Joined: 21st Jan 2016
Location:
Posted: 3rd Feb 2016 17:45
Hi,

i wanna make a quest where you have to collect 8 oranges.
Everything works fine, but when i add a "destroy(e)" to the script, it shows me up this:

"scriptbank\muhlberg\orange_quest.lua:15: attempt to call global 'destroy' (a nil value)"

i wanted to make that if you collect an orange, it disappears so that you cant collect the same orange 8-times.

my script:




function orange_quest_init(e)
sammeltime = 0
end

function orange_quest_main(e)
PlayerDistOrange = GetPlayerDistance(e)

if PlayerDistOrange < 60 and nebenquest==1 and nebenressource < 8 then
Prompt("E zum Sammeln druecken")
if g_KeyPressE==1 and GetTimer(e)>sammeltime then
sammeltime=GetTimer(e)+1000
destroy(e)
nebenressource = nebenressource+1

end
end

end



*just to explain:
i use "nebenquest" to check if the quest is active.
and "nebenressource" is the count of oranges.
PM
Pirate Myke
Forum Support
14
Years of Service
User Offline
Joined: 31st May 2010
Location: El Dorado, California
Posted: 3rd Feb 2016 18:25 Edited at: 3rd Feb 2016 18:32
destroy(e)
should be
Destroy(e)

Lua is very case sensitive about most things, the commands are no exception.

You can get the proper commands syntex from the global.lua file in the script banks folder.
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.

perelect
9
Years of Service
User Offline
Joined: 27th Mar 2015
Location: Australia
Posted: 3rd Feb 2016 18:36
HappyAlpaka

Hi the command is

Destroy(e)

not

destroy(e)

Cheers
Desktop: Intel(R) Core(TM) i7-4790 CPU @ 3.60GHz (8 CPUs), ~3.6GHz, Windows 8.1 64-bit, 16 GB Ram, NVIDIA GeForce GTX 750 Ti, Display Memory: 4018 MB. Resolution 1360x768, Passmark 3528.
Laptop: Pavilion dv6 Notebook, Intel(R) Core(TM) i5-2410M CPU @ 2.30 GHz, Win 7 64 bit, 16 GB Ram, Radeon (TM) HD 6490M, 2336 MB Memory. Resolution 1366x768, Intel(R) HD Graphics 3000. (WEI 5.8)
HappyAlpaka
8
Years of Service
User Offline
Joined: 21st Jan 2016
Location:
Posted: 3rd Feb 2016 20:42
ahh thank you very much!

I'm very new in scripting, the only thing i did before GameGuru was RPG Maker VX Ace

Thanks alot!!!
PM

Login to post a reply

Server time is: 2024-12-22 12:51:18
Your offset time is: 2024-12-22 12:51:18