Search found 5 matches
- Sat Apr 29, 2017 12:23 pm
- Forum: Modding help
- Topic: Killing a character within script
- Replies: 9
- Views: 1889
Re: Killing a character within script
Yeah that was the problem, works perfectly now. Thankyou
- Sat Apr 29, 2017 10:44 am
- Forum: Modding help
- Topic: Killing a character within script
- Replies: 9
- Views: 1889
Re: Killing a character within script
Ok, thanks for your help anyway! 

- Sat Apr 29, 2017 9:43 am
- Forum: Modding help
- Topic: Killing a character within script
- Replies: 9
- Views: 1889
Re: Killing a character within script
Ok, so now I get this error thrown:
attempt to index field 'character' (a nil value)
by this code:
for index, plyr in pairs(game.players) do
....
plyr.character.health = plyr.character.health - 1 --This line runs fine and the players health decrease incrementally
if plyr.character.health == 0 ...
attempt to index field 'character' (a nil value)
by this code:
for index, plyr in pairs(game.players) do
....
plyr.character.health = plyr.character.health - 1 --This line runs fine and the players health decrease incrementally
if plyr.character.health == 0 ...
- Sat Apr 29, 2017 9:08 am
- Forum: Modding help
- Topic: Killing a character within script
- Replies: 9
- Views: 1889
Re: Killing a character within script
When doing that I get this error
and in the docs there is no reference to a .die() method:
http://lua-api.factorio.com/0.15.3/LuaPlayer.html
Code: Select all
LuaPlayer doesn't contain key die.
http://lua-api.factorio.com/0.15.3/LuaPlayer.html
- Sat Apr 29, 2017 7:34 am
- Forum: Modding help
- Topic: Killing a character within script
- Replies: 9
- Views: 1889
Killing a character within script
I can decrease a characters health over time but once it reaches zero the character remains on zero health without dying. Is there a method for killing the character?