Page 1 of 1

modding help with projectiles

PostPosted: Fri May 13, 2016 22:38
by SuperPantsofDoom
I'm working on a mod that adds a fire sword that shoots orbs of fire at mobs but i don't know of a function that does projectiles

Re: modding help with projectiles

PostPosted: Sat May 14, 2016 09:22
by Krock
Define on_use of your sword and spawn a particle like this:
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
local look_dir = user:get_look_dir()
local player_pos = user:getpos()
if not look_dir or not player_pos then
   return
end
-- Add arm offset
player_pos.y = player_pos.y + 1.6
minetest.add_particle({
   pos = table.copy(player_pos),
   velocity = vector.multiply(look_dir, 30), -- velocity of 30
   texture = "texture.png",
)

lua_api.txt reference

Re: modding help with projectiles

PostPosted: Sat May 14, 2016 15:11
by SuperPantsofDoom
thank you so much i hope this works

Re: modding help with projectiles

PostPosted: Sat May 14, 2016 21:54
by SuperPantsofDoom
i got an error


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
2016-05-14 14:29:47: ERROR[main]:    ...rograms\minetest-0.4.13\bin\..\mods\more_swords\init.lua:2: in function <...rograms\minetest-0.4.13\bin\..\mods\more_swords\init.lua:1>
2016-05-14 14:31:37: INFO: event_handler(): Ctrl+C, Close Event, Logoff Event or Shutdown Event, shutting down.

Re: modding help with projectiles

PostPosted: Sun May 15, 2016 07:26
by AiTechEye
like this?

Its a sword, that shoots fire orbs with a picture effect spawning around it.
the orbs hurts 10 mobs or player, but not on the user

fireorbsword.zip
(2.71 KiB) Downloaded 155 times


Image