I was wondering if anyone knows how to script an alter, so if a specific item on the alter is removed, it triggers an action.
Deactivate alter is too basic since you can put something on the alter and take another thing off in order to avoid the deactivating function.
Also, another, how do I script a teleporter to teleport an item from one place, to an alter. Rather than on the ground at the tile the alter is on.
Scripting alter.
Re: Scripting alter.
Tick the "Activate Always" checkboxKing Semos wrote:I was wondering if anyone knows how to script an alter, so if a specific item on the alter is removed, it triggers an action.
Deactivate alter is too basic since you can put something on the alter and take another thing off in order to avoid the deactivating function.
- King Semos
- Posts: 123
- Joined: Sun Apr 15, 2012 6:05 pm
Re: Scripting alter.
Filipsan wrote: Tick the "Activate Always" checkbox
I love you.
Re: Scripting alter.
For example:King Semos wrote: Also, another, how do I script a teleporter to teleport an item from one place, to an alter. Rather than on the ground at the tile the alter is on.
Code: Select all
altar_1:addItem(spawn("dagger"))
Re: Scripting alter.
the code for "item on alcove" will be useful, just tweaked to be the opposite, so the script will always look for that item every time the altar is activated or deactivated, and if it ever doesn't find it, you make it to the action you have set up.
viewtopic.php?p=31524#p31524
probably all the different methods there could work, but just using the last one, here is how I might tweak it:
If you are going to test for a very specific ID of an item, then put i.id in the first script and the full id instead of "dagger" in the second script.
viewtopic.php?p=31524#p31524
probably all the different methods there could work, but just using the last one, here is how I might tweak it:
Code: Select all
-- This function returns true if the entity contains a given item.
-- It works for any entity that implements the checkIfThere() method.
function checkIfThere(entity, item) -- DON'T CHANGE ANYTHING IN THIS FUNCTION
for i in entity:containedItems() do
if i.name == item then
return true
end
end
-- if we get here the item was not found
return false
end
-- example usage
function messWithAltar() -- CUSTOMIZE THIS FUNCTION HOW YOU WANT
if containsItem(komagAltar, "dagger") ~= true then
badstuff:happens!
end
endFinished Dungeons - complete mods to play
- King Semos
- Posts: 123
- Joined: Sun Apr 15, 2012 6:05 pm
Re: Scripting alter.
I think I understand what I'm supposed to be trying to do.
But the code isn't working, something is wrong with how I'm doing it.
My goal initially was to teleport an item from one alter to another, but as Filipsan was saying I could just make the 2nd alter spawn a second version of the item, and this would be triggered when the first alter empties. Pulling off a very "Prestige" teleportation.
But the code isn't working, something is wrong with how I'm doing it.
Code: Select all
-- The alter
if alter_19 == empty then
altar_20:addItem(spawn("dagger"))
end
endMy goal initially was to teleport an item from one alter to another, but as Filipsan was saying I could just make the 2nd alter spawn a second version of the item, and this would be triggered when the first alter empties. Pulling off a very "Prestige" teleportation.
