[Resolved]How do I use my own projectile?
Posted: Mon Apr 18, 2016 7:49 pm
Hello there!
This is my first go at modding, and I'm basically trying to make a better (if a little overpowered
) version of the basic grenade, called ' advanced grenade' .
Reason I'm trying to make it, is to easily clear trees
I'm aware there is a Thermite mod for that (or ofcourse the vanilla way, construction robots), but it seemed like a good opportunity to teach myself to to make my own mod.
My problem is that I can't figure out how to use my own projectile.
I can make my custom item throw the basic grenade projectile, just not my own.
Whenever I add "advanced-grenade-projectile" at,
I get the following error:
![Image](https://forums.factorio.com/images/ext/21effc857ac4107b56fbf3a1ee79ec7d.png)
If someone could help me figure out what I'm doing wrong it'd be greatly appreciated!
Full Code below.
info.json
item.lua
recipe.lua
projectile.lua
This is my first go at modding, and I'm basically trying to make a better (if a little overpowered
![Razz :P](./images/smilies/icon_razz.gif)
Reason I'm trying to make it, is to easily clear trees
![Razz :P](./images/smilies/icon_razz.gif)
I'm aware there is a Thermite mod for that (or ofcourse the vanilla way, construction robots), but it seemed like a good opportunity to teach myself to to make my own mod.
My problem is that I can't figure out how to use my own projectile.
I can make my custom item throw the basic grenade projectile, just not my own.
Whenever I add "advanced-grenade-projectile" at
Code: Select all
ammo_type =
{
category = "capsule",
target_type = "position",
action =
{
type = "direct",
action_delivery =
{
type = "projectile",
projectile = "advanced-grenade-projectile",
starting_speed = 0.6
}
}
}
I get the following error:
![Image](https://forums.factorio.com/images/ext/21effc857ac4107b56fbf3a1ee79ec7d.png)
If someone could help me figure out what I'm doing wrong it'd be greatly appreciated!
![Very Happy :D](./images/smilies/icon_e_biggrin.gif)
Full Code below.
info.json
Code: Select all
require("prototypes.item")
require("prototypes.recipe")
require("prototypes.projectile")
item.lua
Code: Select all
data:extend({
{
type = "capsule",
name = "advanced-grenade",
icon = "__base__/graphics/icons/basic-grenade.png",
flags = {"goes-to-quickbar"},
capsule_action =
{
type = "throw",
attack_parameters =
{
type = "projectile",
ammo_category = "capsule",
cooldown = 5,
projectile_creation_distance = 0.6,
range = 50,
ammo_type =
{
category = "capsule",
target_type = "position",
action =
{
type = "direct",
action_delivery =
{
type = "projectile",
projectile = "advanced-grenade-projectile",
starting_speed = 0.6
}
}
}
}
},
subgroup = "capsule",
order = "a[basic-grenade]",
stack_size = 100
}
})
Code: Select all
data:extend({
{
type = "recipe",
name = "advanced-grenade",
enabled = "true",
ingredients =
{
{"coal", 1},
},
result = "advanced-grenade"
},
})
Code: Select all
data:extend(
{
type = "projectile",
name = "advanced-grenade-projectile",
flags = {"not-on-map"},
acceleration = 0.03,
action =
{
{
type = "direct",
action_delivery =
{
type = "instant",
target_effects =
{
{
type = "create-entity",
entity_name = "massive-explosion"
},
{
type = "create-entity",
entity_name = "medium-scorchmark",
check_buildability = true
}
}
}
},
{
type = "area",
perimeter = 16.5,
action_delivery =
{
type = "instant",
target_effects =
{
{
type = "damage",
damage = {amount = 80, type = "explosion"}
},
{
type = "create-entity",
entity_name = "explosion"
}
}
}
}
},
light = {intensity = 0.5, size = 4},
animation =
{
filename = "__base__/graphics/entity/basic-grenade/basic-grenade.png",
frame_count = 1,
width = 24,
height = 24,
priority = "high"
},
shadow =
{
filename = "__base__/graphics/entity/basic-grenade/basic-grenade-shadow.png",
frame_count = 1,
width = 24,
height = 32,
priority = "high"
}
}
)