Page 1 of 1

AN altar script

Posted: Sat Aug 09, 2014 6:08 pm
by Karinas23
Hi ive mostly been cannibalising other scripts up till now since i know jack shit about scripting and ive been having small issue with trying to make a script to do something

Basically i have 4 altars 2 with yellow gems and 2 with green gems and i need it to activate a teleporter when the gems are swapped ( the yellow gems are placed on the green gem altars and the green gems are placed on the yellow gem altars ) anyone who can make a script for this and if i need to add any connectors would be appreciated.

An added bonus would be for all the gems to teleport off the altars and be replaced with other items ( like loot ) when theyre all in the right place

Re: AN altar script

Posted: Sat Aug 09, 2014 6:54 pm
by Darsithis
Karinas23 wrote:Hi ive mostly been cannibalising other scripts up till now since i know jack shit about scripting and ive been having small issue with trying to make a script to do something

Basically i have 4 altars 2 with yellow gems and 2 with green gems and i need it to activate a teleporter when the gems are swapped ( the yellow gems are placed on the green gem altars and the green gems are placed on the yellow gem altars ) anyone who can make a script for this and if i need to add any connectors would be appreciated.

An added bonus would be for all the gems to teleport off the altars and be replaced with other items ( like loot ) when theyre all in the right place
Hey Karinas. I did something just like that in one of my mods, inspired by an Eye of the Beholder puzzle of the same type. I make it exclude rocks & torches because they're too easy to find but you can reverse it to limit it to specific items.

Code: Select all

function Sacrifice()

	
	for alcoveItem in sacrificeAltar:containedItems() do
		local itemName = alcoveItem.name
		
		if (itemName ~= "rock" and itemName ~= "torch") then
			alcoveItem:destroy()
			rewardAltar1:addItem(spawn(itemName))
			break;
		else
			return;
		end
	end
	

	for alcoveItem in rewardAltar1:containedItems() do
		local itemName = alcoveItem.name
			
		if (itemName ~= "rock" and itemName ~= "torch") then
			alcoveItem:destroy()
			rewardAltar2:addItem(spawn(itemName))
			break;
		else
			return;
		end
	end	
	
	sacrificeAltar:destroy()
	spawn("deep_temple_altar", party.level, 3, 23, 1, "sacrificeAltar");
	
	for alcoveItem in rewardAltar2:containedItems() do
		local itemName = alcoveItem.name
		
		if (itemName ~= "rock" and itemName ~= "torch") then
			alcoveItem:destroy()
			sacrificeAltar:addItem(spawn(itemName))
			break;
		else
			return;
		end
	end	
	
	sacrificeAltar:addConnector("activate", "sacrificeAltarScript", "Sacrifice")
end