Post your modding questions here

Byakuren
Member
 
Posts: 816
Joined: Tue Apr 14, 2015 01:59
GitHub: raymoo
IRC: Hijiri
In-game: Raymoo + Clownpiece

Re: Post your modding questions here

by Byakuren » Mon Jul 17, 2017 03:59

No, they are not the same. forceload_block will load a block until it is freed (transient forceloads are freed when the server shuts down, as well as if they are manually freed with forceload_free_block).

You might want to describe what specifically you are trying to do though, because loading an area to get timers to run seems like a hacky way to do things.
Every time a mod API is left undocumented, a koala dies.
 

User avatar
ErrorNull
Member
 
Posts: 201
Joined: Thu Mar 03, 2016 00:43

Re: Post your modding questions here

by ErrorNull » Mon Jul 17, 2017 05:00

Thanks Byakuren. I admit it is a bit hacky. Here's my current challenge:

Sokomine's mg_villages mod spawns villages during mapgen time.. during which i can 'hook in' and spawn my own villagers via a convenient api function provided by mg_villages.

My villager entities spawn to the map just fine for those villages that generate at a position within the active range of the player.. like around 40m. But, mg_villages mod will also generate villages like 100m and much farther away, for which my villager entities do not seem to spawn correctly.. though my lua debug output shows the entity is created and add_entity seems to not throw any errors. But then, when player arrives at the distant village, the (spawned?) villager does not seem to load or execute the on_activate and on_staticdata functions.

In addition, my villager spawning algorithm also needs node metadata access at the position of each village when it generates. I found that for villages that are far away from the player, minetest throws errors that it cannot access the node metadata.. i suspect because those positions are still not loaded and node are the 'ignore' type.

So far I have experimented with executing emerge_area at the position of these distance villages as they generate. This seems to fix my node metadata access, and I don't get those errors anymore. This also seems to help (but not solve) my villagers spawning.. as now my debug output shows the on_activate and on_staticdata functions executing on the villager spawn attempts. But, when a player arrives that the village, the villager entity does not load -- on_activate does not seem to run.

My next experimentation is to use nodetimers that are tied to each villager spawn position and to periodically check for player distance to these spawn positions. When player is within say 30m distance, the nodetimer will detect this on its next cycle and spawn the villager for reals. Hehe. Is there a more elegant method?
Last edited by ErrorNull on Mon Jul 17, 2017 07:15, edited 1 time in total.
 

User avatar
orwell
Member
 
Posts: 779
Joined: Wed Jun 24, 2015 18:45
Location: Raxacoricofallapatorius
GitHub: orwell96
IRC: orwell96_mt
In-game: orwell

Re: Post your modding questions here

by orwell » Mon Jul 17, 2017 07:14

You could use an run_on/at_every_load LBM for your spawner node, which immediately removes the node and spawns the villager as soon as the block is loaded.
Lua is great!
List of my mods
I like singing. I like dancing. I like ... niyummm...
 

User avatar
ErrorNull
Member
 
Posts: 201
Joined: Thu Mar 03, 2016 00:43

Re: Post your modding questions here

by ErrorNull » Mon Jul 17, 2017 07:26

I'll look into LBMs further. haven't used them before, but might as well try them! i remember sokomine also mentioned LBMs with regard to how the mob spawn nodes were designed. maybe i should've tried LBMs sooner! thanks.
 

User avatar
christoferlevich
Member
 
Posts: 323
Joined: Thu Dec 01, 2016 23:44
Location: Athol, Massachusetts
GitHub: ChristoferL

Re: Post your modding questions here

by christoferlevich » Mon Jul 17, 2017 13:26

Gerald wrote:My solution is the following:
modify currency/shop.lua
  • Add a table e.g. "default.shop.replacements" to register replacements.
  • Add two inventories to the shop (see line 111) "owner_wants_adjusted" and "customers_gave_adjusted"
  • While trading go through the "owner_wants" and "cotumer_gave" inventories and copy everything to the adjusted versions if there is no replacement and replace if there is one.
  • Check for accord in the adjusted inventories. (see line 191)
  • exchange using the adjusted inventories (this is strange because everything is replaced even if it fits perfectly; The shopowner only gets pennys but there is no other simple solution) (see line 197)


I was sniffing code in the Bank Accounts Mod (viewtopic.php?t=16271) counts the bills (1, 5, 10) (in teller computer for deposits) as individual dollar amounts - looking to figure this one out as I think I can easily adapt it right down to the pennies if I adjust the multiplier (in their code) properly.
everything can be a learning experience...
 

User avatar
christoferlevich
Member
 
Posts: 323
Joined: Thu Dec 01, 2016 23:44
Location: Athol, Massachusetts
GitHub: ChristoferL

Re: Post your modding questions here

by christoferlevich » Mon Jul 17, 2017 15:36

n/m
Last edited by christoferlevich on Mon Jul 17, 2017 20:40, edited 1 time in total.
everything can be a learning experience...
 

User avatar
christoferlevich
Member
 
Posts: 323
Joined: Thu Dec 01, 2016 23:44
Location: Athol, Massachusetts
GitHub: ChristoferL

Re: Post your modding questions here

by christoferlevich » Mon Jul 17, 2017 18:24

So I managed to register an alias and the shop (in currency mod) accepts a nickle as 5 pennies (set the shop for 6 pennies but paid with a nickle and a penny which it didn't do before the alias) but now, when I make the exchange, the alias doesn't disapear with the penny (as payment). That includes if I stack the nickels. Nothing leaves the nickel (alias for penny 5)

Any one know what might clear an 'alias' in the formspec when making an exchange? If I can get by this hurdle I have just about everything I need for the educational US Currency mod I am working on. Still researching and tweaking, but now I might finally be stuck.

-it gets worse... I deleted the alias register but its still functioning. UG - where is it stored?
Last edited by christoferlevich on Mon Jul 17, 2017 23:08, edited 1 time in total.
everything can be a learning experience...
 

User avatar
christoferlevich
Member
 
Posts: 323
Joined: Thu Dec 01, 2016 23:44
Location: Athol, Massachusetts
GitHub: ChristoferL

Re: Post your modding questions here

by christoferlevich » Mon Jul 17, 2017 21:28

Gerald wrote:My solution is the following:
modify currency/shop.lua
  • Add a table e.g. "default.shop.replacements" to register replacements.
  • Add two inventories to the shop (see line 111) "owner_wants_adjusted" and "customers_gave_adjusted"
  • While trading go through the "owner_wants" and "cotumer_gave" inventories and copy everything to the adjusted versions if there is no replacement and replace if there is one.
  • Check for accord in the adjusted inventories. (see line 191)
  • exchange using the adjusted inventories (this is strange because everything is replaced even if it fits perfectly; The shopowner only gets pennys but there is no other simple solution) (see line 197)


Im trying... everything I've tried seems to fail... going through tutorials, mods, and anything else I can find to learn. LOL - I simply couldn't figure out how to do what you stated, exactly. Least, not yet.
everything can be a learning experience...
 

owlondrugs
New member
 
Posts: 8
Joined: Sun Jul 23, 2017 12:53
In-game: Owlondrugs

Re: Post your modding questions here

by owlondrugs » Sun Jul 23, 2017 19:15

I created the ore.But it is generated only in minimal Development world...Why?
 

User avatar
Wuzzy
Member
 
Posts: 3569
Joined: Mon Sep 24, 2012 15:01
GitHub: Wuzzy2
IRC: Wuzzy
In-game: Wuzzy

Hardware coloring

by Wuzzy » Thu Jul 27, 2017 22:15

A really dumb question:

Why is it called “hardware colouring”?

What does this have to do with hardware?
My creations. I gladly accept bitcoins: 17fsUywHxeMHKG41UFfu34F1rAxZcrVoqH
 

sofar
Developer
 
Posts: 2060
Joined: Fri Jan 16, 2015 07:31
GitHub: sofar
IRC: sofar
In-game: sofar

Re: Hardware coloring

by sofar » Thu Jul 27, 2017 23:02

Wuzzy wrote:A really dumb question:

Why is it called “hardware colouring”?

What does this have to do with hardware?


There are no new textures created, the hardware is just told to modify the existing texture in a certain (colorful) way?
 

User avatar
v-rob
Member
 
Posts: 673
Joined: Thu Mar 24, 2016 03:19
Location: Right behind you.
GitHub: v-rob

Re: Post your modding questions here

by v-rob » Fri Jul 28, 2017 06:34

I have a question: I want to make a block that plays a sound and repeats it if it has power from mesecons, but when the power turns off, the sound stops. I can get the sound to play, but not stop at the right time or repeat.
 

User avatar
Napiophelios
Member
 
Posts: 981
Joined: Mon Jul 07, 2014 01:14
GitHub: Napiophelios
IRC: Nappi
In-game: Nappi

Re: Post your modding questions here

by Napiophelios » Fri Jul 28, 2017 07:04

v-rob wrote:I have a question: I want to make a block that plays a sound and repeats it if it has power from mesecons, but when the power turns off, the sound stops. I can get the sound to play, but not stop at the right time or repeat.


I had a similar problem;
viewtopic.php?p=248170#p248170
check few replies after mine for some suggestions
 

User avatar
v-rob
Member
 
Posts: 673
Joined: Thu Mar 24, 2016 03:19
Location: Right behind you.
GitHub: v-rob

Re: Post your modding questions here

by v-rob » Fri Jul 28, 2017 07:49

Thanks! Problem solved immediately.
 

Tactical Slime
New member
 
Posts: 1
Joined: Fri Jul 28, 2017 19:44
In-game: Tactical_Slime

Re: Post your modding questions here

by Tactical Slime » Fri Jul 28, 2017 19:48

topic : How do i make a ui?
reason : i want to make a generator that uses fuel
more info : i couldent find any tutorials about making a ui
 

User avatar
TumeniNodes
Member
 
Posts: 2807
Joined: Fri Feb 26, 2016 19:49
Location: in the dark recesses of the mind
GitHub: TumeniNodes
IRC: tumeninodes
In-game: TumeniNodes

Re: Post your modding questions here

by TumeniNodes » Sat Jul 29, 2017 04:17

Tactical Slime wrote:topic : How do i make a ui?
reason : i want to make a generator that uses fuel
more info : i couldent find any tutorials about making a ui


https://rubenwardy.com/minetest_modding ... specs.html
Ich mag keine grünen Eier und Schinken, ich mag sie nicht Sam I Am
 

hajo
Member
 
Posts: 596
Joined: Thu Oct 13, 2016 10:45
Location: DE

Re: Post your modding questions here

by hajo » Sat Jul 29, 2017 19:22

christoferlevich wrote:I am attempting to modify the old currency mod to work with US Currency ..
I want to base the entire currency on pennies,

How is that different from just using gold-ingots ?
alias system .. dollar bill is 100 pennies .. separate inv image .. develop shops

* Links to currency & shop-mods you are using ?
* Other mods you tried, and reasons they don't fit your goal ?
* You already have item-definitions/graphics for pennies. nickels, dollars etc. ?

* Use robots & BMs :)
On the old robots-server, I had written a program simple shop, and some variants...

Eg, a snack-shop that sells different goods (coffee, donuts, etc., each good with
its own price) depending on the button that was pressed to activate the shop,
or a shop that accepts as payment 1 gold as well as 3 steel (or copper etc.).
Last edited by hajo on Sat Aug 12, 2017 14:15, edited 1 time in total.
 

CC10
Member
 
Posts: 19
Joined: Sun Aug 28, 2016 21:25
GitHub: CC10MAGIC
In-game: CC10

Re: Post your modding questions here

by CC10 » Sun Jul 30, 2017 00:36

Topic: Displaying skins
Reason: On a map/server/game I'm making I want to display available skins like you would display armor in Minecraft. Is there any mod that does that?
 

User avatar
Lone_Wolf
Member
 
Posts: 2180
Joined: Sun Apr 09, 2017 05:50
Location: Hopefully very far from yours, snoop :P
GitHub: LoneWolfHT
IRC: Lone_Wolf
In-game: Lone_Wolf

Re: Post your modding questions here

by Lone_Wolf » Tue Aug 01, 2017 13:14

CC10 wrote:Topic: Displaying skins
Reason: On a map/server/game I'm making I want to display available skins like you would display armor in Minecraft. Is there any mod that does that?

There is no mod/clientmod that does that yet. There is a poll though.
 

mezantrop
New member
 
Posts: 9
Joined: Fri Aug 04, 2017 07:59
Location: Brno, CZ
GitHub: mezantrop

Re: Post your modding questions here

by mezantrop » Fri Aug 04, 2017 08:28

topic: set_attach usage help.
reason: I want to attach and move two nodes together.
more info: Sorry for a dumb question, I'm newbie to minetest game as well as minetest development. Now trying to create two entities and make the second to repeat all moves of the first one. Have stuck at the early beginning with attaching the second entity to the first:

Code: Select all
    second = minetest.add_entity(pos_behind_first, "my_mod:second")
    second:set_attach(self.object, "", {x=0,y=0,z=0}, {x=0,y=0,z=0})


Couldn't someone explain me how to use it properly, as obviously, I'm doing it wrong.
P.S. what is the "bone" - the second argument of set_attach?

Thank you in advance.
 

User avatar
cx384
Member
 
Posts: 498
Joined: Wed Apr 23, 2014 09:38
GitHub: cx384
IRC: cx384

Re: Post your modding questions here

by cx384 » Fri Aug 04, 2017 08:39

mezantrop wrote:P.S. what is the "bone" - the second argument of set_attach?

Each object needs a model which has bones.
Can your read this?
 

User avatar
DS-minetest
Member
 
Posts: 1109
Joined: Thu Jun 19, 2014 19:49
Location: I'm scared that if this is too exact, I will be unable to use my keyboard.
GitHub: DS-Minetest
In-game: DS

Re: Post your modding questions here

by DS-minetest » Fri Aug 04, 2017 09:40

cx384 wrote:
mezantrop wrote:P.S. what is the "bone" - the second argument of set_attach?

Each object needs a model which has bones.

No they don't need bones, but mesh entities can have bones for animations and bone position setting. "" is good at attaching since attaching to a bone is currently bad, the objects don't stick together correctly.

If pos_behind_first is a valid pos and there's a registered entity called "my_mod:second" and self.object is an object, I don't see any problems with your code. Maybe it's not your fault, I have some problems with attaching, too. I guess you do this in "my_mod:second"'s on_activate. Sorry, but I think, I can't help you with this.
Do not call me -minetest.
Call me DS or DS-minetest.
I am German, so you don't have to pm me English if you are also German.
The background is a lie.
 

mezantrop
New member
 
Posts: 9
Joined: Fri Aug 04, 2017 07:59
Location: Brno, CZ
GitHub: mezantrop

Re: Post your modding questions here

by mezantrop » Fri Aug 04, 2017 10:05

DS-minetest wrote:If pos_behind_first is a valid pos and there's a registered entity called "my_mod:second" and self.object is an object, I don't see any problems with your code. Maybe it's not your fault, I have some problems with attaching, too. I guess you do this in "my_mod:second"'s on_activate. Sorry, but I think, I can't help you with this.


Yes, pos_behind_first is a position just "behind" the first node. It's valid.
self.object should be the object reference to the first node (hope I'm right with it), as I call it from on_activate() of the first node. And you gave me the clue, I should do it from on_activate() of the second node, because the second node might not be created at the moment of set_attach() in the first node. Thank you very much for that!
 

User avatar
DS-minetest
Member
 
Posts: 1109
Joined: Thu Jun 19, 2014 19:49
Location: I'm scared that if this is too exact, I will be unable to use my keyboard.
GitHub: DS-Minetest
In-game: DS

Re: Post your modding questions here

by DS-minetest » Fri Aug 04, 2017 13:45

mezantrop wrote:
DS-minetest wrote:If pos_behind_first is a valid pos and there's a registered entity called "my_mod:second" and self.object is an object, I don't see any problems with your code. Maybe it's not your fault, I have some problems with attaching, too. I guess you do this in "my_mod:second"'s on_activate. Sorry, but I think, I can't help you with this.


Yes, pos_behind_first is a position just "behind" the first node. It's valid.
self.object should be the object reference to the first node (hope I'm right with it), as I call it from on_activate() of the first node. And you gave me the clue, I should do it from on_activate() of the second node, because the second node might not be created at the moment of set_attach() in the first node. Thank you very much for that!

Don't confuse nodes with objects. Nodes are the things that normally are cubes. (Also don't confuse nodes with blocks, blocks are mapblocks (16^3 nodes). And don't confuse mapblocks with chunks, chunks are mapgen chunks.)
Actually I meant the on_activate of the first entity. But it's great and good to know if it works good to attach in the attached on_activate!
Do not call me -minetest.
Call me DS or DS-minetest.
I am German, so you don't have to pm me English if you are also German.
The background is a lie.
 

mezantrop
New member
 
Posts: 9
Joined: Fri Aug 04, 2017 07:59
Location: Brno, CZ
GitHub: mezantrop

Re: Post your modding questions here

by mezantrop » Fri Aug 04, 2017 14:51

DS-minetest wrote:Don't confuse nodes with objects. Nodes are the things that normally are cubes. (Also don't confuse nodes with blocks, blocks are mapblocks (16^3 nodes). And don't confuse mapblocks with chunks, chunks are mapgen chunks.)
Actually I meant the on_activate of the first entity. But it's great and good to know if it works good to attach in the attached on_activate!


Thank you for clarification, because, I do confuse :) Finally I have got attachment to work, calling set_attach() from first entity, attaching the second one like:

Code: Select all
second:set_attach(self.object, "", {x=0,y=0,z=-10}, {x=0,y=0,z=0})
 

PreviousNext

Return to Modding Discussion



Who is online

Users browsing this forum: No registered users and 3 guests