Thanks a lot !!script.on_event(defines.events.on_picked_up_item, function(event)
local player = game.players[event.player_index]
player.force.chart(player.surface, {{player.position.x - 300, player.position.y - 300}, {player.position.x + 300, player.position.y + 300}})
if (#game.players <= 1) then
game.show_message_dialog{text = {"msg-map"}}
else
player.print({"msg-map"})
end
end)
on_picked_up_item filter for only one item
- DellAquila
- Inserter
- Posts: 48
- Joined: Fri Mar 16, 2018 2:54 pm
- Contact:
on_picked_up_item filter for only one item
Hello ! I have a item named "map" and I would like it as soon as the person picks it off the floor, it executes this routine, but I can not understando how to filter to only appear when the player picks the item "map"
Re: on_picked_up_item filter for only one item
Code: Select all
if event.item_stack.name == "map" then
--do the map stuff
end
- DellAquila
- Inserter
- Posts: 48
- Joined: Fri Mar 16, 2018 2:54 pm
- Contact:
Re: on_picked_up_item filter for only one item
THANKS STEINIO.. Help a lot!!!
If you can help me with something else... i cant force the belts because of the "-" in "transport-belt type.
I really don't know what to do! Thanks!!! XD
-----
for _, force in pairs (game.forces) do
force.reset_technologies()
if force.technologies["belt-speed-1"].researched == true then
end
end
all shows error
If you can help me with something else... i cant force the belts because of the "-" in "transport-belt type.
I really don't know what to do! Thanks!!! XD
-----
for _, force in pairs (game.forces) do
force.reset_technologies()
if force.technologies["belt-speed-1"].researched == true then
force.["transport-belt"]["transport-belt"].speed = 0.0375
or
force.transport-belt["transport-belt"].speed = 0.0375
or
force.entity.["transport-belt"]["transport-belt"].speed = 0.0375
end
end
all shows error
Re: on_picked_up_item filter for only one item
Oh well i fear the speed value isn't changeable after game start.
I'll look at it.
You probably need to create different belts during startup and replace the placed ones on map after research...
Edit: game.entity_prototypes is only readable but not writable so there is no chance to change the value.
You probably need to create different belts during startup and replace the placed ones on map after research...
Edit: game.entity_prototypes is only readable but not writable so there is no chance to change the value.
- DellAquila
- Inserter
- Posts: 48
- Joined: Fri Mar 16, 2018 2:54 pm
- Contact:
Re: on_picked_up_item filter for only one item
Great Steinios,
Thank you very much for your attention, it helped me a lot! So I do not keep trying these impossible things !!! Thanks!
Thank you very much for your attention, it helped me a lot! So I do not keep trying these impossible things !!! Thanks!