it's a script used to recharge a gun, when placing it in an alcove, and "actionning" the script with a button.
in fact, it destroy the empty gun in the alcove, then it destroy the alcove
it respawn a new alcove, with a new gun.
sometimes, when actionning the buton after having placed a empty gun in the alcove, the game crash.
SpoilerShow
Code: Select all
function checkAlcoveForItems()
local quantity = false
-- Offer
local itemName = "empty_uranium_gun"
-- offer alcove
local altarID = ualco01
-- checks if the offer alcove has an item
if altarID:getItemCount() == 0 then
hudPrint("First you have to place the empty neutron cannon into the alcove!")
quantity = false
elseif altarID:getItemCount() > 1 then
hudPrint("The recharger is overloaded, please use only one item!")
quantity = false
else
-- provide flag that it is okay to proceed with transformation
quantity = true
end
-- checks if the offer is equal to the item you want
if quantity == true then
for i in altarID:containedItems() do
if i.name == itemName then
hudPrint("The recharge was successful!")
removeItem2()
spawn("solaris_prison_alcove", 21, 29, 20, 0, "ualco01")
playSound("laser")
ualco01:addItem(spawn("uranium_gun"))
else
hudPrint("Place the empty neutron cannon in the alcove.")
end
end
end
function removeItem2()
if findEntity("ualco01") ~= nil then
for i in ualco01:containedItems() do
i:destroy()
end
ualco01:destroy()
end
end
end