Page 1 of 1
Change global variable after using item.
Posted: Mon Apr 30, 2018 10:31 am
by Villfuk02
I'm new to modding and i was wondering how to change global variable after using an item. Similarly to using fish to heal yourself. I would also like to be able to display in the tooltip how much will the value change (again like the heal amount displayed in tooltip of a fish). There is also a cooldown after using a fish. How would i set my own?
Re: Change global variable after using item.
Posted: Tue May 01, 2018 10:55 am
by Villfuk02
bump
Re: Change global variable after using item.
Posted: Tue May 01, 2018 3:16 pm
by darkfrei
Villfuk02 wrote:I'm new to modding and i was wondering how to change global variable after using an item. Similarly to using fish to heal yourself. I would also like to be able to display in the tooltip how much will the value change (again like the heal amount displayed in tooltip of a fish). There is also a cooldown after using a fish. How would i set my own?
viewtopic.php?f=135&t=45107
Code: Select all
0.891 Script @___info-mod__/info.lua:44: data.raw.fish = {
data.raw.fish.fish.type = "fish"
data.raw.fish.fish.name = "fish"
data.raw.fish.fish.icon = "__base__/graphics/icons/fish.png"
data.raw.fish.fish.icon_size = 32
data.raw.fish.fish.flags[1] = "placeable-neutral"
data.raw.fish.fish.flags[2] = "not-on-map"
data.raw.fish.fish.minable.mining_time = 1
data.raw.fish.fish.minable.result = "raw-fish"
data.raw.fish.fish.minable.count = 5
data.raw.fish.fish.max_health = 20
data.raw.fish.fish.subgroup = "creatures"
data.raw.fish.fish.order = "b-a"
data.raw.fish.fish.collision_box[1][1] = -0.75
data.raw.fish.fish.collision_box[1][2] = -0.75
data.raw.fish.fish.collision_box[2][1] = 0.75
data.raw.fish.fish.collision_box[2][2] = 0.75
data.raw.fish.fish.selection_box[1][1] = -0.5
data.raw.fish.fish.selection_box[1][2] = -0.3
data.raw.fish.fish.selection_box[2][1] = 0.5
data.raw.fish.fish.selection_box[2][2] = 0.3
data.raw.fish.fish.pictures[1].filename = "__base__/graphics/entity/fish/fish-1.png"
data.raw.fish.fish.pictures[1].priority = "extra-high"
data.raw.fish.fish.pictures[1].width = 22
data.raw.fish.fish.pictures[1].height = 36
data.raw.fish.fish.pictures[2].filename = "__base__/graphics/entity/fish/fish-2.png"
data.raw.fish.fish.pictures[2].priority = "extra-high"
data.raw.fish.fish.pictures[2].width = 32
data.raw.fish.fish.pictures[2].height = 32
data.raw.fish.fish.autoplace.influence = 0.01
}
Code: Select all
1.098 Script @___info-mod__/info.lua:44: data.raw.capsule = {
data.raw.capsule["raw-fish"].type = "capsule"
data.raw.capsule["raw-fish"].name = "raw-fish"
data.raw.capsule["raw-fish"].icon = "__base__/graphics/icons/fish.png"
data.raw.capsule["raw-fish"].icon_size = 32
data.raw.capsule["raw-fish"].flags[1] = "goes-to-quickbar"
data.raw.capsule["raw-fish"].subgroup = "raw-resource"
data.raw.capsule["raw-fish"].capsule_action.type = "use-on-self"
data.raw.capsule["raw-fish"].capsule_action.attack_parameters.type = "projectile"
data.raw.capsule["raw-fish"].capsule_action.attack_parameters.ammo_category = "capsule"
data.raw.capsule["raw-fish"].capsule_action.attack_parameters.cooldown = 30
data.raw.capsule["raw-fish"].capsule_action.attack_parameters.range = 0
data.raw.capsule["raw-fish"].capsule_action.attack_parameters.ammo_type.category = "capsule"
data.raw.capsule["raw-fish"].capsule_action.attack_parameters.ammo_type.target_type = "position"
data.raw.capsule["raw-fish"].capsule_action.attack_parameters.ammo_type.action.type = "direct"
data.raw.capsule["raw-fish"].capsule_action.attack_parameters.ammo_type.action.action_delivery.type = "instant"
data.raw.capsule["raw-fish"].capsule_action.attack_parameters.ammo_type.action.action_delivery.target_effects.type = "damage"
data.raw.capsule["raw-fish"].capsule_action.attack_parameters.ammo_type.action.action_delivery.target_effects.damage.type = "physical"
data.raw.capsule["raw-fish"].capsule_action.attack_parameters.ammo_type.action.action_delivery.target_effects.damage.amount = -80
data.raw.capsule["raw-fish"].order = "h[raw-fish]"
data.raw.capsule["raw-fish"].stack_size = 100
And it's all. All another you can add by control.lua
on_player_used_capsule