Page 11 of 396
Re: Ask a simple question, get a simple answer
Posted: Thu Nov 06, 2014 2:11 am
by TSotP
do chests count as a surface? i'm trying to modify Skuggasveinn alcove script to have a chest open a door when a specific item is inserted.
one of the problems is that the specific item is one that i spawned using this code
Code: Select all
local twig = self.go:spawn("branch")
twig.item:setDescription("A small twig from a tree")
twig.item:setWeight(0.8)
twig.item:setUiName("Twig")
i'm then using this for my chest
Code: Select all
function surfaceContains(surface, item)
for v,i in surface:contents() do
if i.go.name == item then return true
end
end
end
function openShieldDoor()
if surfaceContains(twig_chest.surface, "twig") then
tomb_door_portcullis_4.door:open()
else
tomb_door_portcullis_4.door:close()
end
end
but nothing happens when i put the 'twig' in the chest. I have the chest connected to the 'openShieldDoor' function. I have no idea what i am doing wrong.
Once i get this working, i just need to copy it 3 times for the other 3 doors&items and i'm about half way through completing my knightmare re-remake lol
Re: Ask a simple question, get a simple answer
Posted: Thu Nov 06, 2014 3:11 am
by GoldenShadowGS
I think you will need to define the new item. look at Skuggasveinn's tutorial 12 on making a new/cloned item. I tested your code and if you change twig to branch:
if surfaceContains(dungeon_alcove_1.surface, "branch") then
the door will open with a branch or your spawned twig.
Re: Ask a simple question, get a simple answer
Posted: Thu Nov 06, 2014 7:56 am
by cameronC
I get an "invalid spell gesture" error when trying to load a dungeon with one custom spell defined. The gesture line reads:
The scripting ref says it just takes a numeric value of the runes. What am I doing wrong? I've changed the rune numbers multiple times without anything changing.
Re: Ask a simple question, get a simple answer
Posted: Thu Nov 06, 2014 8:06 am
by petri
The gesture 16 is invalid because you can't draw that on the rune panel. It must be a continuous line.
Re: Ask a simple question, get a simple answer
Posted: Thu Nov 06, 2014 8:07 am
by cameronC
petri wrote:The gesture 16 is invalid because you can't draw that on the rune panel. It must be a continuous line.
Doh! Thank you!
Re: Ask a simple question, get a simple answer
Posted: Thu Nov 06, 2014 8:29 am
by blob
NutJob wrote:
If you only want to change some fundamentals of an object just spawn it in and change what you want.
Example
Code: Select all
local skull_of_dargoth = spawn("skull")
skull_of_dargoth.item:setDescription("Only in purest darkness\nshall the way be shown.")
skull_of_dargoth.item:setWeight(0.8)
skull_of_dargoth.item:setUiName("Brittle Human Skull")
I'm trying to do that but with spawning a beacon head and swapping the model but I can't get it to work.
Code: Select all
local beacon_furnace_head = spawn("beacon_furnace_head")
beacon_furnace_head.object:setModel(assets/models/env/demon_head.model)
I'm way off aren't I? : l
Re: Ask a simple question, get a simple answer
Posted: Thu Nov 06, 2014 10:06 am
by Matlock19
edit: moved everything to another post.
Re: Ask a simple question, get a simple answer
Posted: Thu Nov 06, 2014 10:08 am
by TSotP
blob wrote:NutJob wrote:
If you only want to change some fundamentals of an object just spawn it in and change what you want.
Example
Code: Select all
local skull_of_dargoth = spawn("skull")
skull_of_dargoth.item:setDescription("Only in purest darkness\nshall the way be shown.")
skull_of_dargoth.item:setWeight(0.8)
skull_of_dargoth.item:setUiName("Brittle Human Skull")
I'm trying to do that but with spawning a beacon head and swapping the model but I can't get it to work.
Code: Select all
local beacon_furnace_head = spawn("beacon_furnace_head")
beacon_furnace_head.object:setModel(assets/models/env/demon_head.model)
I'm way off aren't I? : l
is that second code the exact code you are using? I might be way off, but isn't the demon head spelled "d
aemon_head.model"?
Re: Ask a simple question, get a simple answer
Posted: Thu Nov 06, 2014 10:46 am
by blob
The model name I found in the .dat file was demon_head.model but yeah its named daemon_head in LoG's editor. I tried both.
Maybe its the way I write the path that is wrong?
Re: Ask a simple question, get a simple answer
Posted: Thu Nov 06, 2014 11:11 am
by JohnWordsworth
You will definitely want to make sure you are passing a string to setModel by adding quotes around the path...
Code: Select all
beacon_furnace_head.object:setModel("assets/models/env/demon_head.model")
But you might also need to refer to the model with an FBX extension (if the code runs like model defines) like so...
Code: Select all
beacon_furnace_head.object:setModel("assets/models/env/demon_head.fbx")
I'm not able to test either of those at the moment, but it might give you somewhere to look next.