[MOD 0.12.30] Vampire Biter - V0.0.5
[MOD 0.12.30] Vampire Biter - V0.0.5
So I have an idea for a new biter enemy type. I’m going to call them Vampires (or suckers) for now.
1. How it will work is that they will attack both the player and other biters.
2. Each time they kill an enemy biter, the killed biter will become a Vampire biter.
3. There won’t be a lot of these spawners, but the units will get stronger and stronger over time.
4. When a single Vampire biter has killed x number of units, it will get bigger.
UPDATE 4/18/16:
Thanks everyone for the code help, mainly Adil who wrote most of the current mod
1 – Force Code – DONE
2 – Spawn new V-Biter when killing enemy – DONE
3 – Limit spawn rate – DONE
4 – Have V-Biters level up, based on number of kills… Currently it seems this is not possible. The Turret entity has a kill counter, but not units. JorgenRe has some code below to try and emulate it, but currently won’t work on the V-Biters.
Currently I'm not sure where to go with this, if anyone has some ideas let me know.
1. How it will work is that they will attack both the player and other biters.
2. Each time they kill an enemy biter, the killed biter will become a Vampire biter.
3. There won’t be a lot of these spawners, but the units will get stronger and stronger over time.
4. When a single Vampire biter has killed x number of units, it will get bigger.
UPDATE 4/18/16:
Thanks everyone for the code help, mainly Adil who wrote most of the current mod
1 – Force Code – DONE
2 – Spawn new V-Biter when killing enemy – DONE
3 – Limit spawn rate – DONE
4 – Have V-Biters level up, based on number of kills… Currently it seems this is not possible. The Turret entity has a kill counter, but not units. JorgenRe has some code below to try and emulate it, but currently won’t work on the V-Biters.
Currently I'm not sure where to go with this, if anyone has some ideas let me know.
- Attachments
-
- Vampire_Biters_0.0.5.zip
- V-Biter 0.0.5
- (7.2 KiB) Downloaded 334 times
Last edited by TheSAguy on Tue Apr 19, 2016 3:02 am, edited 4 times in total.
Re: New Enemy Type - Vampire Biter
Will update this post as i go on.
- Making the Vampire biters attack other biters – Through ‘Force’ but don’t know how.
Nothing yet.
- Convert a killed biter to a Vampire biter. Done with ‘events.on_entity_died’, but how do you tell it only if a Vampire Biter did the killing.
This one might be a request for api seeing as i see no way of reading who killed the biter(read the api docs), but as a work around you can do a count_entities_filtered where type = player. then a count for vampire biters.
then for count of turrets. Now if only vampire biter is greater than zero it will be a vampire biter that 99 % sure did the kill.
However i dont know how bad it will be for the game's perfomance, but since its only counting it should be fine. Trye it out before abandoning i think !
- Lastly, each Vampire biter needs a counter of how many enemies it killed. When counter reaches, let’s say 50, kill it and spawn a larger
Vampire biter. I’m not exactly sure how to implement this. Turrets have a kill counter, so there is a way to do keep track of number of kills, I think…
Counter for any entity
As you see i put the biters into a global table that it puts code onto each biter.
Now as stated above at start of code. I'm a little unsure on how to properly do the finding of the vampire biters. You may want to put up a request for api changes.
\<ol><li>Test</li></ol>
- Making the Vampire biters attack other biters – Through ‘Force’ but don’t know how.
Nothing yet.
- Convert a killed biter to a Vampire biter. Done with ‘events.on_entity_died’, but how do you tell it only if a Vampire Biter did the killing.
This one might be a request for api seeing as i see no way of reading who killed the biter(read the api docs), but as a work around you can do a count_entities_filtered where type = player. then a count for vampire biters.
then for count of turrets. Now if only vampire biter is greater than zero it will be a vampire biter that 99 % sure did the kill.
However i dont know how bad it will be for the game's perfomance, but since its only counting it should be fine. Trye it out before abandoning i think !
- Lastly, each Vampire biter needs a counter of how many enemies it killed. When counter reaches, let’s say 50, kill it and spawn a larger
Vampire biter. I’m not exactly sure how to implement this. Turrets have a kill counter, so there is a way to do keep track of number of kills, I think…
Counter for any entity
Code: Select all
--Called every second or so also remember to create the table global.en at load, next thing will be to adapt it to your purpose
--which right now im not so sure about since you will need to find the vampire biters then add them to the table.
function customcode()
stop = false
if game.players[1].selected ~= nil then
for i = 1, #global.en do
if global.en[i].ent == game.player.selected then
game.player.print("Found number: "..global.en[i].number.."! Count: "..global.en[i].counter)
stop = true
end
end
if stop == false then
global.en[#global.en+1] = {}
global.en[#global.en].ent = game.players[1].selected
global.en[#global.en].counter = 60
global.en[#global.en].number = #global.en
end
end
for i = 1, #global.en do
global.en[i].counter = global.en[i].counter - 11
if global.en[i].counter <= 0 then
global.en[#global.en].counter = 60
game.surfaces.nauvis.create_entity({
name="stone",
amount=5000,
position={global.en[i].ent.position.x,global.en[i].ent.position.y}
})
end
end
game.players[1].print("Counting: ")
end
Now as stated above at start of code. I'm a little unsure on how to properly do the finding of the vampire biters. You may want to put up a request for api changes.
- Get entity that killed something during event_on_death
- Run code on entity when its created. Like an event you add to its config file. Custom event calls for when something is created.
\<ol><li>Test</li></ol>
Logo
Noticed the told change in FFF #111 so il continue to use my signature ^_^Thanks for listening to our suggestions, devs !
I would jump of joy if we could specify which tiles spawned in a surfaces
Re: New Enemy Type - Vampire Biter
I'm doing something wrong with my force creation, can someone please help me out here.
My Control.lua:
Error:
Thanks.
My Control.lua:
Code: Select all
require("defines")
game.create_force('vampire')
game.forces['vampire'].set_cease_fire('enemy', false)
game.forces['vampire'].set_cease_fire('player', false)
Code: Select all
__Vampire_Biters__/control.lua:3: attempt to index global 'game' (a nil value)
Last edited by TheSAguy on Fri Apr 01, 2016 3:03 am, edited 1 time in total.
Re: New Enemy Type - Vampire Biter
Game has to have started to do that. So it must be put somewhere else. Same for all game. ...TheSAguy wrote:I'm doing something wrong with my force creation, can someone please help me out here.
My Control.lua:Error:Code: Select all
require("defines") game.create_force('vampire') game.forces['vampire'].set_cease_fire('enemy', false) game.forces['vampire'].set_cease_fire('player', false)
Thanks.Code: Select all
__Vampire_Biters__/control.lua:3: attempt to index global 'game' (a nil value)
Last edited by jorgenRe on Thu Mar 31, 2016 7:07 pm, edited 1 time in total.
Logo
Noticed the told change in FFF #111 so il continue to use my signature ^_^Thanks for listening to our suggestions, devs !
I would jump of joy if we could specify which tiles spawned in a surfaces
Re: New Enemy Type - Vampire Biter
One place to not put it is in on_load. There is no acces to game there
It will work in any other - can use mod changed event for initialization.
It will work in any other - can use mod changed event for initialization.
Re: New Enemy Type - Vampire Biter
Thanks for claryfying my faulty memoryorzelek wrote:One place to not put it is in on_load. There is no acces to game there
It will work in any other - can use mod changed event for initialization.
Logo
Noticed the told change in FFF #111 so il continue to use my signature ^_^Thanks for listening to our suggestions, devs !
I would jump of joy if we could specify which tiles spawned in a surfaces
Re: New Enemy Type - Vampire Biter
Okay, getting a little closer,
I was able to create the force and the new biters kill the others Fun to watch.
The game does crash sometimes on creation, not sure if it's to do with how I do the force.
Still figuring out the converting part. When I enable "script.on_event({defines.events.on_entity_died,},function(event) On_Remove(event) end)" I'm still getting a crash.
Check it out.
I was able to create the force and the new biters kill the others Fun to watch.
The game does crash sometimes on creation, not sure if it's to do with how I do the force.
Still figuring out the converting part. When I enable "script.on_event({defines.events.on_entity_died,},function(event) On_Remove(event) end)" I'm still getting a crash.
Check it out.
Last edited by TheSAguy on Mon Apr 18, 2016 4:38 pm, edited 1 time in total.
Re: New Enemy Type - Vampire Biter
Current version. 0.0.3.
Re: New Enemy Type - Vampire Biter
Wouldn't a vampire, named in accordance with standard vanilla naming mindset, be a "sucker" ?
I do mods. Modding wiki is friend, it teaches how to mod. Api docs is friend too...
I also update mods, some of them even work.
Recently I did a mod tutorial.
I also update mods, some of them even work.
Recently I did a mod tutorial.
Re: New Enemy Type - Vampire Biter
LOL - True.Adil wrote:Wouldn't a vampire, named in accordance with standard vanilla naming mindset, be a "sucker" ?
Re: [MOD 0.12.30] Vampire Biter - V0.0.5
this mod is awesome!