Page 1 of 1

[Modpack] Magic, experience and enchanting [0.6] [Magic]

PostPosted: Tue Jan 27, 2015 02:41
by guideahon
Hi, i'm new here and new to lua programing, i made this magic mod based on hud, xp, enchanting and throwing mod (Thanks to them), i hope you like it and give feedback, sorry for my bad english.

Image

This mod adds a magic hud bar, an xp bar, an enchantment table, spells: set home spell, go home spell, normal magic damage, lava magic, water magic and weak magic and also, a set of four staffs, the crafts aren't cheap because they're intended to be mostly used on pvp.

WARNING: This mod comes with a modified version of xp mod and hud (and hunger) mod so you have to disable ANY hud changing mod

My licence is CC0.
(Enchanting textures are from community collaboration project mod: )
viewtopic.php?f=9&t=10311

Xp mod: dwtfywt
viewtopic.php?id=3291

Hud and hunger:
Code: WTFPL
Textures: CC BY-SA 3.0, WTFPL
viewtopic.php?id=6342

Throwing:
License: WTFPL
viewtopic.php?id=2805

TODO:
-ENCHANT AND ENCHANTMENT TABLE
-Weaker and cheaper spells (Code Wuzzy's orbs)
-Better staff textures


Help needed:

-Enchants (enchantment table and xp are useless, i can code some xp-using spells or xp using potions, but i need enchantment table that lowers the xp, i dont know how to make a new machine that exchanges for example, my pick and a potion for an enchanted new pick at the cost of some experience)

I need you all to give me ideas and comments on erros or anything else you want added.

Ps: A bit laggy like throwing mod

Download:
V0.6
Magic_V_0_6.zip
(208.52 KiB) Downloaded 666 times


V0.5
Magic_V_0.5.zip
(1.29 MiB) Downloaded 327 times

Re: NEW [MOD] MAGIC

PostPosted: Tue Jan 27, 2015 07:26
by srifqi
Hi!
Welcome to Minetest Forum!

Sorry, but you MUST post your mod in WIP Mods section, not in Mod Releases - even if your mod is done. (See viewtopic.php?f=11&t=1271)
BTW, It's a nice mod.

Re: NEW [MOD] MAGIC

PostPosted: Tue Jan 27, 2015 10:31
by guideahon
Thank you for your reply, should I remove this thread and create a new one or wait for a mod to move it?

Re: NEW [MOD] MAGIC

PostPosted: Tue Jan 27, 2015 12:34
by srifqi
You can contact mod to move this thread. No need to delete.

Re: [MOD] MAGIC

PostPosted: Tue Jan 27, 2015 14:40
by guideahon
Thank you, i asked a mod to please move it, if everything goes right, i'll upload version 0.3 today

Re: [MOD] MAGIC

PostPosted: Wed Jan 28, 2015 12:04
by guideahon
I guess mods are occupied, i'll post this on WIP, but when mod sees this, please erase the post, thank you!!!

Re: [MOD] MAGIC

PostPosted: Wed Jan 28, 2015 17:46
by cHyper
+1 nice mod.

Re: [MOD] MAGIC V_0.4.3

PostPosted: Mon Feb 02, 2015 10:19
by guideahon
TODO:
-Go home - set home orbs dont work (Help needed)
-Enchants (enchantment table and xp are useless)
-Enchantment table texture
-Weaker and cheaper spells (Need ideas)
-Lava and water spells not last forever

I need you all to give me ideas and comments on erros or anything else you want added.

Please report bugs and features you want added

Re: [Mod] MAGIC V_0.4.4

PostPosted: Fri Feb 06, 2015 11:40
by guideahon
V.4.4 Server bug fixes

TODO:
-Go home - set home orbs dont work (Help needed)
-Enchants (enchantment table and xp are useless)
-Enchantment table texture
-Weaker and cheaper spells (Need ideas)
-Lava and water spells not last forever

I need you all to give me ideas and comments on erros or anything else you want added.

Please report bugs and features you want added

Re: [Mod] MAGIC V_0.4.4

PostPosted: Fri Feb 06, 2015 16:43
by Wuzzy
Hey, this is not a mod, this is a modpack. You should change the thread title to “[Modpack] MAGIC [0.4.4] [magic]” to avoid confusion. Also, you must use a thread title like this if you want this mod to be moved by the moderators to Mod Releases.


In Minetest 0.4.11, I started a minetest_game 0.4.11 world with only this modpack (!), version 0.4.4, activated and immediately got this error:

17:40:28: ERROR[ServerThread]: Assignment to undeclared global "xp2" inside a function at /home/wuzzy/.minetest/mods/magic/experience/init.lua:140.
17:40:28: ERROR[main]: ServerError: /home/wuzzy/.minetest/mods/magic/experience/init.lua:141: attempt to index global 'xp2' (a nil value)
17:40:28: ERROR[main]: stack traceback:
17:40:28: ERROR[main]: /home/wuzzy/.minetest/mods/magic/experience/init.lua:141: in function '?'
17:40:28: ERROR[main]: /usr/share/minetest/builtin/game/register.lua:348: in function </usr/share/minetest/builtin/game/register.lua:336>
17:40:28: ACTION[ServerThread]: singleplayer leaves game. List of players:

Re: [Modpack] MAGIC V_0.4.4 [Magic]

PostPosted: Sat Feb 07, 2015 00:07
by guideahon
I just posted and update that should correct it, try it and tell me, thank you for reporting!

Re: [Modpack] MAGIC V_0.4.5 [Magic]

PostPosted: Sat Feb 07, 2015 02:17
by Wuzzy
Sorry, I still get errors. :-(
This time I only used minetest_game with all most from the magic modpack

Your phone or window isn't wide enough to display the code box. If it's a phone, try rotating it to landscape mode.
Code: Select all
03:13:44: ACTION[main]: WARNING: Mod name conflict detected: "hud"
03:13:44: ACTION[main]: Will not load: /home/wuzzy/.minetest/mods/magic/hud
03:13:44: ACTION[main]: Overridden by: /home/wuzzy/.minetest/mods/hud
03:13:44: ERROR[main]: ServerMap::loadMapMeta(): could not open/home/wuzzy/.minetest/worlds/OTHERMODTEST/map_meta.txt
03:13:44: ACTION[main]:         .__               __                   __   
03:13:44: ACTION[main]:   _____ |__| ____   _____/  |_  ____   _______/  |_
03:13:44: ACTION[main]:  /     \|  |/    \_/ __ \   __\/ __ \ /  ___/\   __\
03:13:44: ACTION[main]: |  Y Y  \  |   |  \  ___/|  | \  ___/ \___ \  |  | 
03:13:44: ACTION[main]: |__|_|  /__|___|  /\___  >__|  \___  >____  > |__| 
03:13:44: ACTION[main]:       \/        \/     \/          \/     \/       
03:13:44: ACTION[main]: World at [/home/wuzzy/.minetest/worlds/OTHERMODTEST]
03:13:44: ACTION[main]: Server for gameid="minetest" listening on 0.0.0.0:63057.
03:13:45: ERROR[main]: generateImage(): Could not load image "enchanting_table.png" while building texture
03:13:45: ERROR[main]: generateImage(): Creating a dummy image for "enchanting_table.png"
03:13:45: ERROR[main]: generateImage(): Could not load image "enchanting_table_top.png" while building texture
03:13:45: ERROR[main]: generateImage(): Creating a dummy image for "enchanting_table_top.png"
03:13:49: ACTION[ServerThread]: singleplayer [127.0.0.1] joins game.
03:13:49: ACTION[ServerThread]: singleplayer joins game. List of players: singleplayer
03:13:49: ERROR[ServerThread]: Assignment to undeclared global "playerName" inside a function at /home/wuzzy/.minetest/mods/magic/magic/init.lua:54.
Irrlicht log: Could not load texture:
Irrlicht log: Could not load texture:
Irrlicht log: Could not load texture:
Irrlicht log: Could not load texture:
Font size: 8 16
03:13:49: ERROR[ServerThread]: Assignment to undeclared global "xp2" inside a function at /home/wuzzy/.minetest/mods/magic/experience/init.lua:140.
03:13:49: ERROR[ServerThread]: Assignment to undeclared global "magic_shoot_magic" inside a function at /home/wuzzy/.minetest/mods/magic/magic/init.lua:118.
Irrlicht log: Could not open file of texture: character.png


Also: Why do you package the HUD mod with this? Maybe this is the cause of the errors?
Because I also have the original HUD mod present (but not active).

Re: [Modpack] MAGIC V_0.4.5 [Magic]

PostPosted: Sat Feb 07, 2015 03:56
by Napiophelios
3:13:49: ERROR[ServerThread]: Assignment to undeclared global "magic_shoot_magic" inside a function at /home/wuzzy/.minetest/mods/magic/magic/init.lua:118.


@Wuzzy : you still get the errors with or without hud mod present.

@guideahon : I made a nether_magic.lua that combines Wuzzy's Teletool (stripped down a little) with the throwing mod's teleport arrow; it worked pretty good till your latest updates.
Now the game crashes whenever I try to use the staves to launch any magic projectiles.
I also get the error quoted above.

Can you fix it?
Your phone or window isn't wide enough to display the code box. If it's a phone, try rotating it to landscape mode.
Code: Select all
--[[

THROWING-MOD (Teleport Arrow) by PilzAdam
License of code : WTFPL

Teletool by Wuzzy
License of code : WTFPL ???

Magic_nether_pearl.png by Napiophelios
License : WTFPL

Sound Effects : unknown origin/license

--]]

minetest.register_craftitem("magic:netherpearl_orb", {
   description = "Nether Pearl",
   inventory_image = "magic_nether_pearl.png",
 range = 20.0,
 --stack_max = 1,
on_use = function(itemstack, user, pointed_thing)
if(pointed_thing.type == "node") then
local pos = pointed_thing.above
local over1 = minetest.get_node({x=pos.x,y=pos.y+1,z=pos.z})
local over2 = minetest.get_node({x=pos.x,y=pos.y+2,z=pos.z})
local src = user:getpos()
local dest = {x=pos.x, y=math.ceil(pos.y)-0.5, z=pos.z}
user:setpos(dest)
minetest.after(0.5, function(dest) minetest.sound_play( {name="teleport", gain=1}, {pos=dest, max_hear_distance=12}) end, dest)
  end
end,
})

minetest.register_node("magic:netherpearl_orb_box", {
   drawtype = "nodebox",
   node_box = {
      type = "fixed",
      fixed = {
         {-8.5/17, 2.5/17, 2.5/17, -6.5/17, -2.5/17, -2.5/17},
         {-8.5/17, 0.5/17, 0.5/17, -6.5/17, -0.5/17, -0.5/17},
      }
   },
   tiles = {"magic_nether_pearl.png", "magic_nether_pearl.png", "magic_nether_pearl.png", "magic_nether_pearl.png", "magic_nether_pearl.png", "magic_nether_pearl.png"},
   groups = { projectilemagic = 1},
})

local MAGIC_ENTITY = {
   physical = false,
   timer = 0,
   visual = "wielditem",
   visual_size = {x=1, y=1},
   textures = {"magic:netherpearl_orb_box"},
   lastpos= {},
   collisionbox = {0, 0, 0, 0, 0, 0},
   player = "",
}

MAGIC_ENTITY.on_step = function(self, dtime)
   self.timer = self.timer + dtime
   local pos = self.object:getpos()
   local node = minetest.get_node(pos)

   if self.timer > 0.2 then
      local objs = minetest.get_objects_inside_radius({x = pos.x, y = pos.y, z = pos.z}, 2)
      for k, obj in pairs(objs) do
         if obj:get_luaentity() ~= nil then
            if obj:get_luaentity().name ~= "magic:netherpearl_orb_entity" and obj:get_luaentity().name ~= "__builtin:item" then
               if self.player ~= "" then
                  self.player:setpos(pos)
                  --self.player:get_inventory():add_item("main", ItemStack("magic:netherpearl_orb"))
               minetest.sound_play("teleport", {pos = self.lastpos})
               end
                self.object:remove()
             end
         else
            if self.player ~= "" then
               self.player:setpos(pos)
               self.player:get_inventory():add_item("main", ItemStack("magic:netherpearl_orb"))
               minetest.sound_play("teleport0", {pos = self.lastpos})
            end
            self.object:remove()
         end
      end
   end

   if self.lastpos.x ~= nil then
      if minetest.registered_nodes[node.name].walkable then
         if self.player ~= "" then
               self.player:setpos(self.lastpos)
               --self.player:get_inventory():add_item("main", ItemStack("magic:netherpearl_orb"))
               minetest.sound_play("teleport", {pos = self.lastpos})
            end
         self.object:remove()
      end
   end
   self.lastpos= {x = pos.x, y = pos.y, z = pos.z}
end

minetest.register_entity("magic:netherpearl_orb_entity", MAGIC_ENTITY)

Re: [Modpack] MAGIC V_0.4.5 [Magic]

PostPosted: Sat Feb 07, 2015 17:13
by guideahon
Wuzzy wrote:Sorry, I still get errors. :-(
This time I only used minetest_game with all most from the magic modpack

Your phone or window isn't wide enough to display the code box. If it's a phone, try rotating it to landscape mode.
Code: Select all
[u]03:13:44: ACTION[main]: WARNING: Mod name conflict detected: "hud"
03:13:44: ACTION[main]: Will not load: /home/wuzzy/.minetest/mods/magic/hud[/u]
03:13:44: ACTION[main]: Overridden by: /home/wuzzy/.minetest/mods/hud
03:13:44: ERROR[main]: ServerMap::loadMapMeta(): could not open/home/wuzzy/.minetest/worlds/OTHERMODTEST/map_meta.txt
03:13:44: ACTION[main]:         .__               __                   __   
03:13:44: ACTION[main]:   _____ |__| ____   _____/  |_  ____   _______/  |_
03:13:44: ACTION[main]:  /     \|  |/    \_/ __ \   __\/ __ \ /  ___/\   __\
03:13:44: ACTION[main]: |  Y Y  \  |   |  \  ___/|  | \  ___/ \___ \  |  | 
03:13:44: ACTION[main]: |__|_|  /__|___|  /\___  >__|  \___  >____  > |__| 
03:13:44: ACTION[main]:       \/        \/     \/          \/     \/       
03:13:44: ACTION[main]: World at [/home/wuzzy/.minetest/worlds/OTHERMODTEST]
03:13:44: ACTION[main]: Server for gameid="minetest" listening on 0.0.0.0:63057.
03:13:45: ERROR[main]: generateImage(): Could not load image "enchanting_table.png" while building texture
03:13:45: ERROR[main]: generateImage(): Creating a dummy image for "enchanting_table.png"
03:13:45: ERROR[main]: generateImage(): Could not load image "enchanting_table_top.png" while building texture
03:13:45: ERROR[main]: generateImage(): Creating a dummy image for "enchanting_table_top.png"
03:13:49: ACTION[ServerThread]: singleplayer [127.0.0.1] joins game.
03:13:49: ACTION[ServerThread]: singleplayer joins game. List of players: singleplayer
03:13:49: ERROR[ServerThread]: Assignment to undeclared global "playerName" inside a function at /home/wuzzy/.minetest/mods/magic/magic/init.lua:54.
Irrlicht log: Could not load texture:
Irrlicht log: Could not load texture:
Irrlicht log: Could not load texture:
Irrlicht log: Could not load texture:
Font size: 8 16
03:13:49: ERROR[ServerThread]: Assignment to undeclared global "xp2" inside a function at /home/wuzzy/.minetest/mods/magic/experience/init.lua:140.
03:13:49: ERROR[ServerThread]: Assignment to undeclared global "magic_shoot_magic" inside a function at /home/wuzzy/.minetest/mods/magic/magic/init.lua:118.
Irrlicht log: Could not open file of texture: character.png


Also: Why do you package the HUD mod with this? Maybe this is the cause of the errors?
Because I also have the original HUD mod present (but not active).


Hi, i packed the hud mod to add a magic hud bar, can you disable and rename the hud mod (temporal) and enable mine (is just a modified version of the original, you wont lose anything)
Can you play or does it kick you out? Some errors are normal but as long as they let you play, it's ok

Re: [Modpack] MAGIC V_0.4.5 [Magic]

PostPosted: Sat Feb 07, 2015 17:37
by guideahon
I love it that you're making a mod with my code, i would love to merge a magic nether realm, with large cavegen.

Napiophelios wrote:
3:13:49: ERROR[ServerThread]: Assignment to undeclared global "magic_shoot_magic" inside a function at /home/wuzzy/.minetest/mods/magic/magic/init.lua:118.


@Wuzzy : you still get the errors with or without hud mod present.

@guideahon : I made a nether_magic.lua that combines Wuzzy's Teletool (stripped down a little) with the throwing mod's teleport arrow; it worked pretty good till your latest updates.
Now the game crashes whenever I try to use the staves to launch any magic projectiles.
I also get the error quoted above.

Can you fix it?
Your phone or window isn't wide enough to display the code box. If it's a phone, try rotating it to landscape mode.
Code: Select all
--[[

THROWING-MOD (Teleport Arrow) by PilzAdam
License of code : WTFPL

Teletool by Wuzzy
License of code : WTFPL ???

Magic_nether_pearl.png by Napiophelios
License : WTFPL

Sound Effects : unknown origin/license

--]]

minetest.register_craftitem("magic:netherpearl_orb", {
   description = "Nether Pearl",
   inventory_image = "magic_nether_pearl.png",
 range = 20.0,
 --stack_max = 1,
on_use = function(itemstack, user, pointed_thing)
if(pointed_thing.type == "node") then
local pos = pointed_thing.above
local over1 = minetest.get_node({x=pos.x,y=pos.y+1,z=pos.z})
local over2 = minetest.get_node({x=pos.x,y=pos.y+2,z=pos.z})
local src = user:getpos()
local dest = {x=pos.x, y=math.ceil(pos.y)-0.5, z=pos.z}
user:setpos(dest)
minetest.after(0.5, function(dest) minetest.sound_play( {name="teleport", gain=1}, {pos=dest, max_hear_distance=12}) end, dest)
  end
end,
})

minetest.register_node("magic:netherpearl_orb_box", {
   drawtype = "nodebox",
   node_box = {
      type = "fixed",
      fixed = {
         {-8.5/17, 2.5/17, 2.5/17, -6.5/17, -2.5/17, -2.5/17},
         {-8.5/17, 0.5/17, 0.5/17, -6.5/17, -0.5/17, -0.5/17},
      }
   },
   tiles = {"magic_nether_pearl.png", "magic_nether_pearl.png", "magic_nether_pearl.png", "magic_nether_pearl.png", "magic_nether_pearl.png", "magic_nether_pearl.png"},
   groups = { projectilemagic = 1},
})

local MAGIC_ENTITY = {
   physical = false,
   timer = 0,
   visual = "wielditem",
   visual_size = {x=1, y=1},
   textures = {"magic:netherpearl_orb_box"},
   lastpos= {},
   collisionbox = {0, 0, 0, 0, 0, 0},
   player = "",
}

MAGIC_ENTITY.on_step = function(self, dtime)
   self.timer = self.timer + dtime
   local pos = self.object:getpos()
   local node = minetest.get_node(pos)

   if self.timer > 0.2 then
      local objs = minetest.get_objects_inside_radius({x = pos.x, y = pos.y, z = pos.z}, 2)
      for k, obj in pairs(objs) do
         if obj:get_luaentity() ~= nil then
            if obj:get_luaentity().name ~= "magic:netherpearl_orb_entity" and obj:get_luaentity().name ~= "__builtin:item" then
               if self.player ~= "" then
                  self.player:setpos(pos)
                  --self.player:get_inventory():add_item("main", ItemStack("magic:netherpearl_orb"))
               minetest.sound_play("teleport", {pos = self.lastpos})
               end
                self.object:remove()
             end
         else
            if self.player ~= "" then
               self.player:setpos(pos)
               self.player:get_inventory():add_item("main", ItemStack("magic:netherpearl_orb"))
               minetest.sound_play("teleport0", {pos = self.lastpos})
            end
            self.object:remove()
         end
      end
   end

   if self.lastpos.x ~= nil then
      if minetest.registered_nodes[node.name].walkable then
         if self.player ~= "" then
               self.player:setpos(self.lastpos)
               --self.player:get_inventory():add_item("main", ItemStack("magic:netherpearl_orb"))
               minetest.sound_play("teleport", {pos = self.lastpos})
            end
         self.object:remove()
      end
   end
   self.lastpos= {x = pos.x, y = pos.y, z = pos.z}
end

minetest.register_entity("magic:netherpearl_orb_entity", MAGIC_ENTITY)


Can you post the debug.txt instantly after you get the error? Maybe i can fix it, i made some changes to allow magic on multiplayer

Re: [Modpack] MAGIC V_0.4.5 [Magic]

PostPosted: Sat Feb 07, 2015 18:08
by Wuzzy
Okay, renaming the original HUD mod made the bug go away. But this still sucks. I do not want to arbtitrarily rename mods. Maybe you should consider renaming your packaged HUD mod, since you also have altered it a bit.

Okay, this aside, there are still a few missing textures. Just see the log I posted. Normally you should not ignore bugs like these. They are not critical, but they should be fixed anyways.

Re: [Modpack] MAGIC V_0.4.5 [Magic]

PostPosted: Sat Feb 07, 2015 18:22
by guideahon
Wuzzy wrote:Okay, renaming the original HUD mod made the bug go away. But this still sucks. I do not want to arbtitrarily rename mods. Maybe you should consider renaming your packaged HUD mod, since you also have altered it a bit.

Okay, this aside, there are still a few missing textures. Just see the log I posted. Normally you should not ignore bugs like these. They are not critical, but they should be fixed anyways.


Hi Wuzzy, i thought about it but since my hud cant work with the other one, one should always be disabled, but i'll se what i can do. I'll check the other errors, thank you for your suggestions, any other idea you have i'd love to hear it, have fun!!

Re: [Modpack] Magic [0.4.6] [Magic]

PostPosted: Mon Feb 09, 2015 00:43
by guideahon
UPDATE:
Lava and water spells dont last forever, yay!

Re: [Modpack] Magic, experience and enchanting [0.5] [Magic]

PostPosted: Mon Feb 09, 2015 22:53
by guideahon
UPDATE:
Go home, set home orbs now work
Minor bug fixes (Thx to Wuzzy)

Re: [Modpack] Magic, experience and enchanting [0.5] [Magic]

PostPosted: Tue Feb 10, 2015 01:27
by Wuzzy
Some random ideas for new spells:
  • Poison Orb: Will create a cloud of poisonous gas it the impact site, it will last for a few seconds (maybe +/- some random time) and will damage all players inside it
  • Orb of Healing: Will heal the target (orb comes in 2 power levels, like the damaging orbs), useful for team games
  • Geo Orb: Will create a lot of magic earth on the impact site. It deals no damage, but can be used to annoy/slow down another player. The magic earth can be dug away with a sufficiently strong shovel or it goes away after some time
  • Orb of Displacement: Will teleport the target by a random amount to somewhere else, but always within a small radius and always where a player can legally stand (i.e. not inside stone). There may be a small chance this spell may fail if there is very few space where the target could be theoretically be teleported. In practice, the code coud do 3 random “tries”, and checks each time if the destination is valid. If it fails it tries again. If it fails 3 times, the spell fails. As soon a legal destiantion is found, this orb is done. Deals no direct damage.
  • Orb of Neutralization: Will neutralize any magically casted node, such as water, lava, magic earth, gas cloud, etc. in a small radius
  • Hunger Orb: Will increase hunger level of those hit (unless you want to remove hunger from this modpack)


About your problem with enchantments: I don't know exactly how to help you here, but I can give you some hints: You probably may want to create detached inventories and also check minetest.register_on_craft (or however it is called).

Re: [Modpack] Magic, experience and enchanting [0.5] [Magic]

PostPosted: Tue Mar 10, 2015 21:58
by guideahon
LOOTS of bugfixes.
Added orbs of Healing (Wuzzys idea)
Staffs now have reload time.

(Still need help with enchanting)