anti-nest/base turret
-
- Fast Inserter
- Posts: 193
- Joined: Fri May 06, 2016 10:35 pm
- Contact:
anti-nest/base turret
How do I set a turret so that it will only attack worms, spawners, and other player's buildings (for PvP)?
-
- Fast Inserter
- Posts: 193
- Joined: Fri May 06, 2016 10:35 pm
- Contact:
Re: anti-nest/base turret
Is this something that gets specified for the turret? For the ammunition? Does it have to be part of the control.lua?
Re: anti-nest/base turret
Yes, it must be done through script.
A true turret entity from the game will only care if its enemy or friend.
You'll need to use lua to perform all the turret logic.
It's not like it will be problematic though: buildings are immobile and don't appear out of nowhere.
A true turret entity from the game will only care if its enemy or friend.
You'll need to use lua to perform all the turret logic.
It's not like it will be problematic though: buildings are immobile and don't appear out of nowhere.
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.
-
- Fast Inserter
- Posts: 193
- Joined: Fri May 06, 2016 10:35 pm
- Contact:
Re: anti-nest/base turret
Rats, really?
Damn . That might create a fair bit of lag for what I want to do....
Damn . That might create a fair bit of lag for what I want to do....
Re: anti-nest/base turret
If done correctly, a "turret" that "can only shoot immobile entities" will be in the list of the less performance taxing mods.
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.
-
- Fast Inserter
- Posts: 193
- Joined: Fri May 06, 2016 10:35 pm
- Contact:
Re: anti-nest/base turret
Adil wrote:If done correctly, a "turret" that "can only shoot immobile entities" will be in the list of the less performance taxing mods.
Oh?
I've read a little bit of the logic/control.lua from the Bio-Cannon & Additional Turrets mods.... How exactly would I go about coding what you described?
Btw, thanks for your help
Re: anti-nest/base turret
You can use the bomber logic from modding tutorial. No graphics, but searching and hit entities by timer.Adil wrote:If done correctly, a "turret" that "can only shoot immobile entities" will be in the list of the less performance taxing mods.
-
- Fast Inserter
- Posts: 193
- Joined: Fri May 06, 2016 10:35 pm
- Contact:
Re: anti-nest/base turret
Hmm... Adil, what way did you have in mind? I read up on the bomber tutorial, & I think it'll definitely help me. But, is there a command that makes a turret attack a specific entity?
Re: anti-nest/base turret
No there's no command for that.
I was referring to the fact that you can emulate the turret behavior with quite little computations involved, if the goal is to attack only immobile objects. The entity would not actually be a "turret" from the game engine perspective. Most likely it'd be a chest from which you'd deduct ammunition via the script command and use the scripts to damage the enemy entities.
What makes scripts slow is the interface api, some of them notably more slow than the others. The `find_entities` function from the bomber tutorial is one of the slowest in the game.
The idea is that that command actually needs to be called very infrequently. You could maintain short ordered lists of valid targets for each `turret` and only sometimes run scan for the enemy entities when the list is empty. The buildings created by players (robots) can be detected with respective events, for biters new base detection could be rigged by maintaining the counts of entities belonging to their force.
I was referring to the fact that you can emulate the turret behavior with quite little computations involved, if the goal is to attack only immobile objects. The entity would not actually be a "turret" from the game engine perspective. Most likely it'd be a chest from which you'd deduct ammunition via the script command and use the scripts to damage the enemy entities.
What makes scripts slow is the interface api, some of them notably more slow than the others. The `find_entities` function from the bomber tutorial is one of the slowest in the game.
The idea is that that command actually needs to be called very infrequently. You could maintain short ordered lists of valid targets for each `turret` and only sometimes run scan for the enemy entities when the list is empty. The buildings created by players (robots) can be detected with respective events, for biters new base detection could be rigged by maintaining the counts of entities belonging to their force.
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.