kaoz
General
inter faesces et urinam nascimur
Posts: 1,112
|
Post by kaoz on Nov 16, 2020 22:28:54 GMT 1
Cmd 16 for suppressive fire and Cmd 9 to make them stop, if needed. ;-)
|
|
|
Post by Quintaxel on Apr 11, 2021 20:19:47 GMT 1
Here's an improved script of a script I wrote earlier. ( see post) The function checks if the units given as an argument are on the map. If this is the case the coordinates of the unit is displayed. The function comes in handy when mapping. function IsUnitOnMap (...)
local i = 1, state, x, y;
while arg[i] ~= nil do
state = GetUnitState (arg[i]);
x,y = GetObjCoord (arg[i]);
if state ~= -1 then
DisplayTrace ("The unit with ScriptId %g is placed on the map at coordinates %g , %g", arg[i],x,y);
else
DisplayTrace ("There is no unit with ScriptId %g on the map, sorry", arg[i]);
end;
i = i+1
end;
end;
|
|
|
Post by Quintaxel on Jun 4, 2021 12:28:07 GMT 1
The BK Lua function returns the current state of a unit.
So GetUnitState (100);
will return the state of the unit with iScriptID 100. The returned values are integer values and correspond to a certain state or activity of the unit.
When the unit 100 is moving then GetUnitState (100); will return te value 32. When the unit is waiting then the value 0 is returned. A list of possible values can be found in Calvin's Lua guide.
This function does not seem to work with mortars ? When the unit is moving I get values of -1 returned, being the value for units that do not exist ? Is this a known issue ?
|
|
|
Post by feldgrau on Jun 4, 2021 16:24:09 GMT 1
Hello Q,
If the soldiers dismantled the mortar and then run away, the mortar loses its ScriptID. When the mortar is reassembled, the mortar has the ScriptID -1. The same goes for heavy MG. I think that's due to the missing 3. MOD file.
|
|
|
Post by Quintaxel on Jun 5, 2021 17:04:58 GMT 1
|
|
|
Post by Quintaxel on Aug 10, 2021 7:58:59 GMT 1
Can anyone explain how the function below works or what is does ?
IsWarehouseConnected(iScript_StorageID)
Calvin's Lua guide states "This function tests if a campaign supply depot is connected to a main supply depot."
How do you connect a "campaign supply depot" to a "main supply depot". What is a "campaign supply depot" ?
|
|
|
Post by [BMG]Neutro on Aug 10, 2021 16:14:51 GMT 1
Nothing against Calvin but his english is sometimes really confusing in this guide.. Maybe he talking about that the function tests: IS a "Field depot" connected with a "Warehouse" but this is only a speculation.. IF you only set "Field depots" on a map without any "Warehouse" for a Party/Player they do not work correctly this means trucks will not automatically drive to the "Field depots" to resupply. (When a truck is empty, it just stays in that place forever.)
(If "Field depots" are not connected to a "Warehouse" they have a little grey icon above them (ingame not editor))
|
|
|
Post by Quintaxel on Aug 10, 2021 19:53:34 GMT 1
Thanks [BMG]Neutro , this is helpfull. I'll check it out. EDIT: The function IsWarehouseConnected (iScript_StorageID) just checks if a warehouse or field depot belongs to the player party. So for a warehouse with ScriptId , IsWarehouseConnected (n) returns the following results: Party of n Returned value0 1 1 02 1
|
|
|
Post by [BMG]Neutro on Aug 11, 2021 18:31:08 GMT 1
Maybe i dont get it but if party (not player) 0 and 2 use the same returned value this could be leading to conflicts or not?
Its only checking the Party not the players right? (Players could be max. 16 and Partys max. 3)
|
|
|
Post by Quintaxel on Aug 12, 2021 14:29:21 GMT 1
Well I was only able to test the function in a single player mode. The only information you get is wether or not a certain depot is connected to (belongs to) the AI. This information could be used to in a script to trigger an action. Other than that I see no use here.
I have never seen the function in a script so I don't really know it' practical use.
|
|
|
Post by Quintaxel on Sept 6, 2021 12:47:54 GMT 1
The AI in BK does not react on player scouts/snipers. So if you kill a artillery team the AI will just keep on replenishing the lost units for the next round of a turkey shoot. As I see it there are 2 options here;
1) mod a scout so he's unarmed. 2) Make the AI react when under attack of a sniper.
The first option is easy enough to do but the second option would need scripting.
I made a script a couple of years ago that triggered the AI everytime a sniper took a shot at an artillery crew. The script worked but it was quite complex. The script required that all player sniper units and all AI artillery had a unique iScriptId.
The moment a sniper fired a shot there was a change of getting deteted by the AI. This change of getting deteted increased with each shot fired. The distance between the sniper and the target was also taken into account when calculating the odds of getting detected. The idea was that the AI tries to determine de direction of the shot.
Once the sniper was detected the AI sends in units to deal with the sniper. These units move in the direction from where the shots were fired. If they find the sniper then the deal with him.
Now I was thinking of using dogs (Stalingrad Germansheppard) to find snipers. The idea is that AI dogs 'find' a sniper and then AI units follow the dogs to kill the sniper. This means that a dog unit should be placed close to an artillery unit as a reinforcement. When the Player's Sout fires teh the dog would have to spawn on the map and start searching for the sniper.
I do not know if it would work but I just would like to know what you guys tnhink about the idea.
|
|
|
Post by Mascarenhas2 on Sept 7, 2021 4:47:39 GMT 1
I think this is a very interesting idea, for the sniper will have to deal with the dog before disabling the artillery, But be careful not to spawn too many dogs.
|
|
|
Post by Quintaxel on Sept 7, 2021 11:39:45 GMT 1
The number of dogs can be controlled. The script can check if there are watchdogs on the map. If no, then dogs can be place on the map as reinforcements. If the threat of a sniper is gone then the watchdogs could be removed from the map.
The first challenge is triggering the function. This could be done by storing the ammount of ammo of the sniper in a global variable. Then check the current ammount of ammo against the value stored in the global variable. When the ammo decreases then this means that teh sniper fired a shot.
Next step would be to check the distance between the sniper that fired a shot and and the AI's artillery units. When close enough (hearing distance) the dogs could be put on the map and start looking for the sniper. Then the units that will hunt the sniper should also be put on the map and follow the dogs.
Probably sounds more complicated than it is but I think it can be done
|
|
|
Post by Quintaxel on Sept 13, 2021 11:12:32 GMT 1
I was hoping to use the function, GetNAmmo (iSciptId) to check if a sniper has fired a shot. Unfortunately this function does not work for a Squad unit. I see no other way to detect if an artillery unit is under attack of a sniper. If anyone has a bright idea, just let me know.
|
|
|
Post by Stanenberg on Sept 13, 2021 11:34:02 GMT 1
With (GetUnitState(ID) == 21) you can check if a unit is attacking something.
|
|