LOG 2 Scripting 2
Posted: Fri Oct 17, 2014 4:15 am
Ok sorry to be a pain in the butt , but scripts are not working like they use to. So I think ill have to wait for Assets or Script definitions here. I have tried lots of basic Scripts from the original LOG 1 and the script definitions have changed. Eg:
1 - This is a script that opens a door when 2 torches are put into 2 torch holders. It wont run and comes up with the error
(attempt to call method 'hasTorch' (a nil value)
2 - This script when 2 locks are connected to it should open a door. (prison_lock) is the counter value = 0. When I put a Key into the lock it has the error (attempt to perform arithmetic on global 'prison_lock' (a table value)
3 - Ok this I used this a lot in LOG 1 but does not work either. Basicaly the alcove or altar connects to the Script and does it's thing.
The error it comes up with is (attempt to call method 'getItemCount' (a nil value)
So as I have found out a lot of functions for objects just don't cut it in LOG2, all the basic scripting the community has put out there more or less wont work. I have tried many, many scripts and face the same problems eg nil value, methods etc.... So I am going to take a wild guess here scripting will have to be learned all over again I think not sure I could be wrong, I am not the best at scripting but I try. Maybe the scripts have to be varied. I will have to wait anyway that's it 
Oh and by the way Thank you to Almost Human for a awesome new Editor, good job guys I love it very much, thxs to Skuggs for the videos. I have learnt heaps from them
1 - This is a script that opens a door when 2 torches are put into 2 torch holders. It wont run and comes up with the error
(attempt to call method 'hasTorch' (a nil value)
Code: Select all
function DoorOpen1()
if torch_holder_12:hasTorch() == true and
torch_holder_13:hasTorch() == true then
dungeon_door_wooden_4:open()
else
dungeon_door_wooden_4:close()
end
endCode: Select all
function PrisonLocks()
playSound("secret")
prison_lock = prison_lock + 1
if prison_lock==1 then
hudPrint("First lock unlocked.")
elseif prison_lock==2 then
hudPrint("Second lock unlocked.")
findEntity("dungeon_door_wooden_2"):open()
hudPrint("Prison Mines are now accessable")
hudPrint("")
end
endThe error it comes up with is (attempt to call method 'getItemCount' (a nil value)
Code: Select all
function checkDoor1(self)
local alcove = findEntity("altar_1")
if (alcove ~= nil)and(alcove:getItemCount()>0) then
local item for item in alcove:containedItems() do
if item.name == "rock" then
--- Destroy Items here ---
self:destroy() -- This will Destroy the LOCK REM THIS --
item:destroy() -- Destroy the Key --
-- HudPrints Here and Key lock Sound and Fx's --
hudPrint("Yes the Yuanti Dagger is mine.")
party:shakeCamera(1,1)
dungeon_door_wooden_1:open()
else
hudPrint("")
end
end
end
endOh and by the way Thank you to Almost Human for a awesome new Editor, good job guys I love it very much, thxs to Skuggs for the videos. I have learnt heaps from them