Page 64 of 396
Re: Ask a simple question, get a simple answer
Posted: Fri May 08, 2015 11:29 pm
by Duncan1246
Isaac wrote:I would model a ray that was several tiles long, and add it as a model component to the party when fired. With an offset & rotation that originates from whichever slot the champion occupies.[totally faking] the PC's poor firearm accuracy at range.
minmay wrote:I assume Duncan1246 wanted to display the beam for more than a single frame. Even if they were okay with that, it'd still break if the party is turning.
Thanks for your replies, you go further than I and I have to test some of your proposals. My idea for now is to create a beam between two points, several tiles long, spawned from the first to the second, and the beam must last until some party's action. It's not a party's weapon, so no problem for free look and I choose the position from where the party will see the beam. I think that the second proposal of Minmay is the most convenient in this case. In a second time, the possibility of beam rotation is interesting also.
Anyway, thanks, I think I have some hard work to do now, specially modeling...
Re: Ask a simple question, get a simple answer
Posted: Sat May 09, 2015 1:13 am
by Isaac
minmay wrote:I assume Duncan1246 wanted to display the beam for more than a single frame. Even if they were okay with that, it'd still break if the party is turning.
That happens anyway. Turn while throwing a projectile, and the item flies off to the side.
Re: Ask a simple question, get a simple answer
Posted: Sat May 09, 2015 1:17 am
by minmay
Isaac wrote:minmay wrote:I assume Duncan1246 wanted to display the beam for more than a single frame. Even if they were okay with that, it'd still break if the party is turning.
That happens anyway. Turn while throwing a projectile, and the item flies off to the side.
Flying off to the side is what it should do. You don't want players to be able to fire the beam at any angle, do you?
Oh and you can attack while the camera is moving back to the rest position anyway, or while standing over a pressure plate, etc. etc. so even for a single frame and no turning, attaching it to the party wouldn't work.
Re: Ask a simple question, get a simple answer
Posted: Sat May 09, 2015 1:21 pm
by AndakRainor
The definition of thorn_wall seems to be missing in the asset pack. Is there any way to get all its components to know its structure ?
Re: Ask a simple question, get a simple answer
Posted: Sun May 10, 2015 3:01 am
by Isaac
Certain items have a tags table in their definition. Is this accessible in a script, and if so ~how?
Re: Ask a simple question, get a simple answer
Posted: Sun May 10, 2015 4:50 am
by minmay
Not that I know of. Tags are just for the convenience of dungeon editor users.
Re: Ask a simple question, get a simple answer
Posted: Sun May 10, 2015 7:16 pm
by AndakRainor
Code: Select all
setMouseItem(item)
Sets the given item as mouse item, or destroys the mouse item if item is nil.
If I replace the mouse item with a new spawned item, is the previous item destroyed the same way, or should I use nil before setting a new item ?
(I was wondering if it could be a good idea to add a sticky on the subject of memory leaks... I was thinking about projectiles exiting the map, items removed form inventory without a location in a game map, or any other possible trap for a modder...)
Re: Ask a simple question, get a simple answer
Posted: Mon May 11, 2015 3:17 am
by minmay
AndakRainor wrote:Code: Select all
setMouseItem(item)
Sets the given item as mouse item, or destroys the mouse item if item is nil.
If I replace the mouse item with a new spawned item, is the previous item destroyed the same way, or should I use nil before setting a new item ?
From my testing, it appears that component/object references lost by removing them from the mouse/inventory/whatever are not garbage collected, so there is a potential resource leak here. However, they also won't be serialized, so that resource leak disappears as soon as the player reloads the game. It's also a
very small one; the object isn't on a map, so it won't be wasting time updating or rendering anything. All it really does is consume a little Lua memory. You rarely need to worry about it, unless you are losing thousands of items this way.
Re: Ask a simple question, get a simple answer
Posted: Mon May 11, 2015 6:59 pm
by The cube
Code: Select all
function translate()
count = 0
for v,i in forest_altar_1.surface:contents() do
if i.go.id == "foreign_note" then
local note = spawn("note");
note.scrollitem:setScrollText("translated_text")
forest_altar_1.surface:addItem(note.item); <-------
i:destroy()
end
end
end
this gives me a stack overflow error at the line with a smiley. What's wrong?
Re: Ask a simple question, get a simple answer
Posted: Mon May 11, 2015 7:10 pm
by minmay
looks like you're triggering the connector again every time you add an item
also, you really, really, really should not modify the contents of a surface while iterating through them, that script can break in like 5000 different ways because of that; use i:destroyDelayed() instead of i:destroy() and add the notes after you finish iterating