|
Post by Quintaxel on Sept 13, 2021 13:46:41 GMT 1
Right, good hint. This would indeed be a good trigger to start the function.
|
|
|
Post by Quintaxel on Sept 15, 2021 12:28:52 GMT 1
I did some tests to see if the state of the sniper can be used to trigger the AI and this seems to work. Every time a sniper fires a shot his status changes briefly to 21. If I capture this change of state and store the number of times it changes into a variable then I can use this value to trigger further action. Every time the sniper fires the chance of getting detected by the AI increases. So the sniper could still be used but at a risk. This would add realism to the game I guess. Now I have to think about a way to make the AI forget about the sniper after a certain time. The AI should forget about the sniper when he stops firing for a given time. Something to keep me busy during running
|
|
|
Post by danzig70 on Sept 16, 2021 16:03:58 GMT 1
Watch dogs would be great for bases and POW camps or to patrol mortar positions. You could give them the "follow" command to trail behind a patrol/sentry. Then trigger a search function if someone dies. Great idea!
|
|
|
Post by Quintaxel on Oct 24, 2021 20:12:23 GMT 1
I had some time this afternoon to work on the idea of making the AI react on the use of snipers by the player.
This is what I have so far. When a player sniper fires a shot then the AI is put on alert. Each time a shot is fired the chances of the sniper getting detected by the AI increases with 10 %. So for example, after firing 5 shots there is a 50 % chance that the AI will detect the sniper. If the sniper is detected than a function can be triggered. e.g. the AI could fire it’s artillery near the position of the sniper, or a the AI could send a patrol or do something else in a reaction to the sniper’s “duck shooting”. I would leave this open for now. If the sniper stops firing then, after a given time, the alert state of the AI will cease and the AI will forget about the sniper. Using this function should change the gameplay, at least as far the use of snipers is concerned. It will no longer be possible to kill one artillery crew after another without the AI reacting. I still need to refine and clean up the script. I will try to make a demo to better explain what the funtion does.
|
|
|
Post by Quintaxel on Oct 26, 2021 14:34:05 GMT 1
Here are some screenshot to illustrate the script Below: before the attack And after the sniper has been detected. Note that you see the AI units. This is not the case in the actual game.
|
|
|
Post by Quintaxel on Oct 26, 2021 14:36:07 GMT 1
I did some tests with the SniperRoutine script. The idea seems to work. Once a sniper has been detected then there are several option for the AI to eliminate the threat.
The options I'm working on are to use guard dogs followed by a squad. I had to increase the speed of the dogs. The default walking speed is far too low. Another option is to use an AI artillery to fire at the position of the sniper. This is effective ansd simple to script. A third option is to send in an aircraft (dive bomber) but this could be overkill. Then I have the idea to use AI snipers to eliminate the player's sniper. I have not tried this.
Known issues so far - If a player gives the order to an sniper to fire on an AI unit then the state of the sniper state changes immediately to 21 (unit is attacking), even if the sniper is still too far away from it's target. This could be solved by adding an extra condition, checking if there are any AI units in firing range of the sniper. This will not be a 100% accurate but I want to keep teh script simple. - The moment the sniper is detected then the AI dogs will move to the last know position of the sniper. The AI squad will follow the dogs. if the sniper moves out of the viewing range of the AI Squad then he will not be detected. I could leave this as it is because the player will not know when his sniper has been detected by the AI. Need to think about this.
I also have some questions - Would it be possible to mod a dog unit so it can kill a sniper ? I was thinking of adding a close distance firearm to a dog. The firemarm shoul be invisible and without sound. The moment the dog comes (very) close to the sniper then the sniper would be killed. - Can anyone make me a squad of three dogs ?
|
|
|
Post by gagarin on Oct 26, 2021 14:57:28 GMT 1
I 'll give you a squad of three dogs
|
|
|
Post by gagarin on Oct 26, 2021 15:27:44 GMT 1
three dogs stand in a triangle in the modes: normal step, crawling, accelerated step (on the march). In running mode, they line up. www.sendspace.com/file/u535e0 The second option, with the covering of the player's sniper with artillery, if found, is the most realistic. This is in my opinion.
|
|
|
Post by Quintaxel on Oct 26, 2021 21:41:13 GMT 1
three dogs stand in a triangle in the modes: normal step, crawling, accelerated step (on the march). In running mode, they line up. www.sendspace.com/file/u535e0 The second option, with the covering of the player's sniper with artillery, if found, is the most realistic. This is in my opinion. Thank you for the dog squad gagarin The script of the sniper consists of 2 parts. 1 part (function) checks the actions of the player’s sniper and has the following Syntax function IsSniperAttackingAI (…)
The arguments of the function are the iScriptId of the player’s snipers eg. IsSniperAttackingAI (16301,16302,16303); where 16301, 16302 and 16303 are the scripId’s of the snipers. The function is called as follows function SniperRoutine ()
IsSniperAttackingAI (16301,16302,16303);
end;
The function IsSniperAttackingAI (16301,16302,16303); will check if any of the snipers is firing , keep track of the number of shots each sniper fired and if the AI is alarmed by the shots. The function will also determine if the AI detects the sniper based upon the number of shots fired. Once the sniper is detected another function is called to find and kill the sniper. As gagarin mentioned the simplest and most realistic way to kill the sniper is to use an artillery unit. To do this the script need to find out which artillery unit is closest to the position of the sniper that needs to be killed. This can only be done if these artillery units have a unique iScriptId. The challenge is that the script will have to keep track of the status of each sniper and each artillery unit. I’m sure it can be done but I’ll have to think about it. The script needs to be user friendly so it can be used in actual maps.
|
|
Grot
General
J-23 znowu nadaje
Posts: 4,049
|
Post by Grot on Oct 27, 2021 22:06:19 GMT 1
hi Q I like all the options , but if sniper acts as a spotter without shooting to direct its own arty at enemy's position .. well they are sitting ducks . So to make it more difficult for snipers/spotters how about script when sniper enters arty area (not seeing it yet) AI spawns unit(s) to patrol or protect that sector.
|
|
|
Post by Quintaxel on Oct 28, 2021 7:35:40 GMT 1
hi Q I like all the options , but if sniper acts as a spotter without shooting to direct its own arty at enemy's position .. well they are sitting ducks . So to make it more difficult for snipers/spotters how about script when sniper enters arty area (not seeing it yet) AI spawns unit(s) to patrol or protect that sector. Hi Grot , it should be ‘technically possible’ to script this and probably easier to script on the condition that the mapper is prepared to put script areas on the map to for the patrol to follow. Give me some time to work this out as a function. Could you tell me what the veiwing range of a sniper is in map points or ViS tiles ?
|
|
Grot
General
J-23 znowu nadaje
Posts: 4,049
|
Post by Grot on Oct 30, 2021 13:52:18 GMT 1
hi Q I like all the options , but if sniper acts as a spotter without shooting to direct its own arty at enemy's position .. well they are sitting ducks . So to make it more difficult for snipers/spotters how about script when sniper enters arty area (not seeing it yet) AI spawns unit(s) to patrol or protect that sector. Could you tell me what the veiwing range of a sniper is in map points or ViS tiles ? I dont know sorry
|
|
|
Post by Quintaxel on Nov 2, 2021 12:56:43 GMT 1
hi Q I like all the options , but if sniper acts as a spotter without shooting to direct its own arty at enemy's position .. well they are sitting ducks . So to make it more difficult for snipers/spotters how about script when sniper enters arty area (not seeing it yet) AI spawns unit(s) to patrol or protect that sector. I made a script that start a patrol when a sniper comes within his viewing range of an AI unit. The script can be improved but IMO the reaction of the patrol is slow. I'll send you a demo to check it out. Another idea I have is to spawn AI snipers that spawn the moment a player sniper comes within its viewing range of a AI object like an artillery piece. I already have made a function to make snipers do this. The moment the player's sniper is detected he can then be finished off by the AI's artillery or be neutralized by an AI squad that moves in a straight line to the player's sniper.
|
|
|
Post by gagarin on Nov 2, 2021 18:42:55 GMT 1
Can I, too.
|
|
|
Post by Quintaxel on Nov 3, 2021 13:00:33 GMT 1
|
|