modding help with projectiles

User avatar
SuperPantsofDoom
Member
 
Posts: 35
Joined: Sun Dec 20, 2015 00:10
In-game: aslar

modding help with projectiles

by SuperPantsofDoom » Fri May 13, 2016 22:38

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
 

User avatar
Krock
Member
 
Posts: 3598
Joined: Thu Oct 03, 2013 07:48
GitHub: SmallJoker

Re: modding help with projectiles

by Krock » Sat May 14, 2016 09:22

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
Newest Win32 builds - Find a mod - All my mods
ALL YOUR DONATION ARE BELONG TO PARAMAT (Please support him and Minetest)
New DuckDuckGo !bang: !mtmod <keyword here>
 

User avatar
SuperPantsofDoom
Member
 
Posts: 35
Joined: Sun Dec 20, 2015 00:10
In-game: aslar

Re: modding help with projectiles

by SuperPantsofDoom » Sat May 14, 2016 15:11

thank you so much i hope this works
 

User avatar
SuperPantsofDoom
Member
 
Posts: 35
Joined: Sun Dec 20, 2015 00:10
In-game: aslar

Re: modding help with projectiles

by SuperPantsofDoom » Sat May 14, 2016 21:54

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.
 

User avatar
AiTechEye
Member
 
Posts: 409
Joined: Fri May 29, 2015 21:14

Re: modding help with projectiles

by AiTechEye » Sun May 15, 2016 07:26

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
Attachments
screenshot_20160515_092112.jpg
screenshot_20160515_092112.jpg (363.57 KiB) Viewed 1339 times
Alive AI Mine/Build AI NPC
Gravitygun HL2
Portalgun Portal
Marssurvive Survive on mars
Bows bows + arrows
SoundCloud (Music)
SoundCloud (Classic)
YouTube
 


Return to Modding Discussion

Who is online

Users browsing this forum: No registered users and 1 guest

cron