Questions for DarkGod (or others)
Moderator: Moderator
Re: Questions for DarkGod (or others)
Fixed the speed issue. A little new question:
I have a PlayerDisplay that shows an attribute from Player.lua. I have a command to change that attribute. But the PlayerDisplay doesn't update until after a turn is taken. Is there a way to instantly refresh it? I've made a lot of different attempts to call the player display function directly, but none seem to work.
I have a PlayerDisplay that shows an attribute from Player.lua. I have a command to change that attribute. But the PlayerDisplay doesn't update until after a turn is taken. Is there a way to instantly refresh it? I've made a lot of different attempts to call the player display function directly, but none seem to work.
Re: Questions for DarkGod (or others)
okay I have a question to. how do I remove a equipped item?
my code goes something like this
I have tried several things like local inven = self:getInven("INVEN_BODY") and local inven = self:getInven("BODY") but I either get object undefined errors or it does'nt remove the item. any ideas?
my code goes something like this
Code: Select all
local body = self:getInven(self.INVEN_BODY)
local inven = self:getInven("INVEN")
--talent code
self:removeObject(inven, body[1])
Those who complain are just Volunteering to fix the problem
<yufra> every vault designer should ask themselves exactly that: What Would Grey Do?
<yufra> every vault designer should ask themselves exactly that: What Would Grey Do?
Re: Questions for DarkGod (or others)
Hmm, in the ToME code the arrows when shooting are removed by "a = self:removeObject(self:getInven("QUIVER"), 1)". Can some perversion of that work for you?
I've gotten a bit worn out from coding, in spite of not achieving much yet (or maybe because of it). To help alleviate the strain I've taken a break from coding to make a cool image:
https://sites.google.com/site/darrenjoh ... uerage.png
No more booby lady on my load screen :P
I've gotten a bit worn out from coding, in spite of not achieving much yet (or maybe because of it). To help alleviate the strain I've taken a break from coding to make a cool image:
https://sites.google.com/site/darrenjoh ... uerage.png
No more booby lady on my load screen :P
Re: Questions for DarkGod (or others)
A question:
What are the top dev priorities?
What can we expect in the future?
What are you working on now?
What are the top dev priorities?
What can we expect in the future?
What are you working on now?
Re: Questions for DarkGod (or others)
This thread is for questions relating to the development of T-Engine modules (note the subforum this post is in). Questions relating to ToME4 should go in the appropriate forum.
Re: Questions for DarkGod (or others)
For some reason your 7DRL's name cracks me up, Grey. I keep thinking "Rogue Warrior" and "Rogue Rash."
I'm probably not going to finish, both due to lack of experience and an extremely shortened time window. I've decided to call my project Going Rogue, the story of a prominent thief who thinks his gang needs a change of leadership. Unfortunately, it looks like someone called ahead.
Honestly, I'll be shocked if I get further than deleting all the example module stuff and renaming it.
I'm probably not going to finish, both due to lack of experience and an extremely shortened time window. I've decided to call my project Going Rogue, the story of a prominent thief who thinks his gang needs a change of leadership. Unfortunately, it looks like someone called ahead.
Honestly, I'll be shocked if I get further than deleting all the example module stuff and renaming it.
Sorry about all the parentheses (sometimes I like to clarify things).
Re: Questions for DarkGod (or others)
Well you may as well start with Run from the Shadow instead of the example module in my opinion. It has inventory and other things set up already, so less work involved. It has various things removed as well though, such as the talent code.
Quick Q from me: How do I turn off a particle effect? I can turn one on well enough, but removing it seems more difficult.
Quick Q from me: How do I turn off a particle effect? I can turn one on well enough, but removing it seems more difficult.
Re: Questions for DarkGod (or others)
Take a look at T_HYMN_OF_SHADOWS. You need to store the return value of the "addParticles" call, and then pass it to the "removeParticles" call.Grey wrote: Quick Q from me: How do I turn off a particle effect? I can turn one on well enough, but removing it seems more difficult.
<DarkGod> lets say it's intended
Re: Questions for DarkGod (or others)
Hmm, shoulda thought of that really... Cheers, yufra.
Okay, new question for tiger_eye (you know you like to help :P) - in hex mode, how do I target an action on a specific tile around the player? In cartesian I'd say x+1 (or whatever else) but I'm not so sure with the hex grid. Is it just taking all the grids except x+1 and x-1? Or is it more involved than that?
Okay, new question for tiger_eye (you know you like to help :P) - in hex mode, how do I target an action on a specific tile around the player? In cartesian I'd say x+1 (or whatever else) but I'm not so sure with the hex grid. Is it just taking all the grids except x+1 and x-1? Or is it more involved than that?
Re: Questions for DarkGod (or others)
tiger_eye is definitely your man, but I'll try to clarify a few things before he gets in. The hex mode still uses x+/-1, the interesting behavior is on the y-side. It is something like on the odd x coordinates you use y and y+1 and on the even x coordinates you use y-1 and y. You can write your code in a grid-agnostic fashion, though, by using some of the handy functions created in utils.lua. I took a few minutes to document them, and pasted the results below. I'll guess at a specific use case, though.Grey wrote: Okay, new question for tiger_eye (you know you like to help) - in hex mode, how do I target an action on a specific tile around the player? In cartesian I'd say x+1 (or whatever else) but I'm not so sure with the hex grid. Is it just taking all the grids except x+1 and x-1? Or is it more involved than that?
Use case
Say you want to get the tile that is in the "9" direction from your current actor's tile. You could do this and have it work in both the square and hex grid modes:
Code: Select all
tx, ty = util.coordAddDir(self.x, self.y, 9)
Code: Select all
--- Returns true if using a hex-grid, false otherwise.
function util.isHex()
Code: Select all
--- Converts a direction to an angle.
-- @param dir The numpad direction from the source tile.
-- @param sx The x-coordinate of the source tile.
-- @param sy The y-coordinate of the source tile.
-- @return The angle in degrees.
function util.dirToAngle(dir, sx, sy)
Code: Select all
--- Converts a direction into an absolute map coordinate.
-- @param dir The numpad direction from the source tile.
-- @param sx The x-coordinate of the source tile.
-- @param sy The y-coordinate of the source tile.
-- @return A {x, y} array of the destination tile.
function util.dirToCoord(dir, sx, sy)
Code: Select all
--- Converts an offset map coordinate into a numpad direction.
-- Note that all possible offsets are not valid depending on the grid mode.
-- @param dx The x-offset (-1, 0, 1).
-- @param dy The y-offset (-1, 0, 1).
-- @param sx The x-coordinate of the source tile.
-- @param sy The y-coordinate of the source tile.
-- @return A {x, y} array of the destination tile.
function util.coordToDir(dx, dy, sx, sy)
Code: Select all
--- Returns a table of the directions to the side of the provided direction.
-- @param dir The numpad direction from the source tile.
-- @param sx The x-coordinate of the source tile.
-- @param sy The y-coordinate of the source tile.
-- @return A table with the keys "left", "right", "hard_left", and "hard_right" and the appropriate numpad directions.
function util.dirSides(dir, sx, sy)
Code: Select all
--- Returns the numpad direction opposite the provided direction.
-- @param dir The numpad direction from the source tile.
-- @param sx The x-coordinate of the source tile.
-- @param sy The y-coordinate of the source tile.
-- @return The numpad direction opposite the dir argument.
function util.opposedDir(dir, sx, sy)
Code: Select all
--- Returns the numpad direction between two absolute map coordinates.
-- @param x1 The x-coordinate of the source tile.
-- @param y1 The y-coordinate of the source tile.
-- @param x2 The x-coordinate of the destination tile.
-- @param y2 The y-coordinate of the destination tile.
-- @return The numpad direction from {x1, y1} towards {x2, y2}.
function util.getDir(x1, y1, x2, y2)
Code: Select all
--- A list of adjacent coordinates depending on core.fov.set_algorithm.
-- @param x x-coordinate of the source tile.
-- @param y y-coordinate of the source tile.
-- @param no_diagonals Boolean that restricts diagonal motion.
-- @param no_cardinals Boolean that restricts cardinal motion.
-- @return Array of {x, y} coordinate arrays indexed by direction from source.
function util.adjacentCoords(x, y, no_diagonals, no_cardinals)
Code: Select all
--- Converts a source coordinate + numpad dir into a new absolute coordinate.
-- @param x The x-coordinate of the source tile.
-- @param y The y-coordinate of the source tile.
-- @param dir The numpad direction from the source tile.
-- @return A {x, y} array of the destination coordinate.
function util.coordAddDir(x, y, dir)
<DarkGod> lets say it's intended
Re: Questions for DarkGod (or others)
Even after much fiddling this won't work for me. I even tried copying the code from it into a simple:Zonk wrote:Check BloodyDeath.lua in /engine/interface.luaGrey wrote:
6. Adding blood stains to the map on creature death - essentially just recolouring the tiles.
Might take some tweaking for what you want to do, though, but I did get it to work time ago.
Code: Select all
game.level.map(self.x, self.y, engine.Map.TERRAIN, game.level.map(self.x, self.y, engine.Map.TERRAIN):clone{
color_r=255,color_g=0,color_b=10
})
Yufra's hackier method works, but is a little more dull :(
Re: Questions for DarkGod (or others)
Which is my hackier method? For Blood Arbiter I ended up taking from engine.BloodyDeath and tweaking it a bit. Here is the link to the relevant commit: link.Grey wrote: Even after much fiddling this won't work for me. I even tried copying the code from it into a simple:
But this didn't work.Code: Select all
game.level.map(self.x, self.y, engine.Map.TERRAIN, game.level.map(self.x, self.y, engine.Map.TERRAIN):clone{ color_r=255,color_g=0,color_b=10 })
Yufra's hackier method works, but is a little more dull
<DarkGod> lets say it's intended
Re: Questions for DarkGod (or others)
Ah, cool! With a bit of tweaking that works. Don't suppose you know how to make the tile symbol colours change too?
Re: Questions for DarkGod (or others)
Got blood workly nicely now.
New question, since I'm always after more visual polish - how do I add smooth movement and things like knockback moving smoothly?
Also recursive knockback seems to fail on me. I get an error on line 296 of engine/Actor.lua saying "attempt to call local 'recursive' (a boolean value)". Non-recursive knockback works just fine, knockback triggering knockback would be such a fun thing to add...
New question, since I'm always after more visual polish - how do I add smooth movement and things like knockback moving smoothly?
Also recursive knockback seems to fail on me. I get an error on line 296 of engine/Actor.lua saying "attempt to call local 'recursive' (a boolean value)". Non-recursive knockback works just fine, knockback triggering knockback would be such a fun thing to add...
Re: Questions for DarkGod (or others)
Recursive knockback, copy the code from field-control/heave the parameter is not a bool it's a function.
Smooth move is very easy. In load.lua you do:
Then in Actor.lua look for setMoveAnim in ToME's Actor.lua, there is one for :move() and one for knockback. That's all 
Smooth move is very easy. In load.lua you do:
Code: Select all
local Map = require "engine.Map"
Map.smooth_scroll = 3

[tome] joylove: You can't just release an expansion like one would release a Kraken XD
--
[tome] phantomfrettchen: your ability not to tease anyone is simply stunning
--
[tome] phantomfrettchen: your ability not to tease anyone is simply stunning
