I'm hitting wall with events currently. I'm trying to do alarm system that would make radars more usefull.
Current idea: When entity is destroyed if in range of radar -> send message to player.
Problem is that "onunitdied" is not called for all entities. Only for "unit" type?
I guess the name makes sense. So other event name for other entities destruction?
While I was trying to find workaround. I got idea of connecting function to one of entity's methods. Could it be done?
Also could "onsectorscanned" -event give the scanning radar as parameter? I had some idea for this but I already forgot it
Game events request.
Game events request.
Test mode
Searching Flashlight
[WIP]Fluid handling expansion
[WIP]PvP gamescript
[WIP]Rocket Express
Autofill: The torch has been pass to Nexela
Searching Flashlight
[WIP]Fluid handling expansion
[WIP]PvP gamescript
[WIP]Rocket Express
Autofill: The torch has been pass to Nexela
Re: Game events request.
Yes, onunitdied should actually be onentitydied, and should work for all entities that can die.
https://forums.factorio.com/wiki/inde ... torscanned
Yes, I added the info to the wiki:rk84 wrote:Also could "onsectorscanned" -event give the scanning radar as parameter? I had some idea for this but I already forgot it
https://forums.factorio.com/wiki/inde ... torscanned
Re: Game events request.
Thank you.kovarex wrote:Yes, onunitdied should actually be onentitydied, and should work for all entities that can die.
Yes, I added the info to the wiki:rk84 wrote:Also could "onsectorscanned" -event give the scanning radar as parameter? I had some idea for this but I already forgot it
https://forums.factorio.com/wiki/inde ... torscanned
creepers are the only thing I have managed to get out of onunitdied.
Code: Select all
...
elseif event.name == "onunitdied" then
glob.player.print(event.unit.name)
...
Test mode
Searching Flashlight
[WIP]Fluid handling expansion
[WIP]PvP gamescript
[WIP]Rocket Express
Autofill: The torch has been pass to Nexela
Searching Flashlight
[WIP]Fluid handling expansion
[WIP]PvP gamescript
[WIP]Rocket Express
Autofill: The torch has been pass to Nexela
Re: Game events request.
I think that onunit died, is on entity DIED (you need to shoot it)
Re: Game events request.
No. you get it even if you ram creepers with your car. And I have tried weapons.ficolas wrote:I think that onunit died, is on entity DIED (you need to shoot it)
edit: woo I'm a long handed.
Test mode
Searching Flashlight
[WIP]Fluid handling expansion
[WIP]PvP gamescript
[WIP]Rocket Express
Autofill: The torch has been pass to Nexela
Searching Flashlight
[WIP]Fluid handling expansion
[WIP]PvP gamescript
[WIP]Rocket Express
Autofill: The torch has been pass to Nexela
Re: Game events request.
I mean, you need to kill it, not to mine it
Re: Game events request.
I'm not mining...ficolas wrote:I mean, you need to kill it, not to mine it
I used this script to test onunitdied. Can you get this script to print on screen non-unit -type entity with health? I can't.
Code: Select all
if event.name ~= "ontick" then
game.getplayer().print("Event: " .. event.name)
if event.name == "onunitdied" then
game.getplayer().print(event.unit.name .. " died.")
end
end
Test mode
Searching Flashlight
[WIP]Fluid handling expansion
[WIP]PvP gamescript
[WIP]Rocket Express
Autofill: The torch has been pass to Nexela
Searching Flashlight
[WIP]Fluid handling expansion
[WIP]PvP gamescript
[WIP]Rocket Express
Autofill: The torch has been pass to Nexela
Re: Game events request.
You need to wait for next version to make it work
And the event will be called onentitydied
And the event will be called onentitydied
Re: Game events request.
ah ok. Sorry I though it was working for others. I Can't wait for update. Thank you.kovarex wrote:You need to wait for next version to make it work
And the event will be called onentitydied
Test mode
Searching Flashlight
[WIP]Fluid handling expansion
[WIP]PvP gamescript
[WIP]Rocket Express
Autofill: The torch has been pass to Nexela
Searching Flashlight
[WIP]Fluid handling expansion
[WIP]PvP gamescript
[WIP]Rocket Express
Autofill: The torch has been pass to Nexela