kaoz
General
inter faesces et urinam nascimur
Posts: 1,112
|
Post by kaoz on Oct 1, 2010 0:29:50 GMT 1
For a particular map, i'd like to have certain area's that the enemy/AI can see constantly. I thought i could get it done with the ViewZone function, but it seems i cannot adress it to the AI.
ViewZone(strScriptAreaName, iParam)
Does somebody know any way to get the AI seeing these area's on a constant basis?
|
|
|
Post by Major Pain on Oct 1, 2010 3:14:26 GMT 1
What are you trying to do?
If you want the AI to see Player Units, you can do the following:
GetNUnitsInArea(0, SeeHere)
This will detect any units that belong to Player in the Location named "SeeHere"
You can build it with "If" conditions.
Example:
If GetNUnitsInArea(0, SeeHere) >= 0 then
"Do this"
end
Lets say you want the artillery to deliver supressive fire at that location:
Cmd(16, 3000, GetScriptAreaParams(SeeHere))
16 = the suppressive fire command 3000 = the script ID for the artillery
GetScriptAreaParams(SeeHere) = give the x,y coordinates of the location, (the center)
So your script might look like this:
function BigGunsFire()
If GetNUnitsInArea(0, SeeHere) >= 0 then
Cmd(16, 3000, GetScriptAreaParams(SeeHere));
Suicide();
End;
End;
There are many ways to write this type of script. You can even include a timer so the suppressive fire ends after several minutes, or end if there are no Player Units present in the Location.
|
|
kaoz
General
inter faesces et urinam nascimur
Posts: 1,112
|
Post by kaoz on Oct 1, 2010 15:59:02 GMT 1
thx MP
yeah, i've seen your method in some other maps, so it's probably the main and only way. i guess i want something impossible here, altho' it would be great that AI could really see the whole area just as the player can with the ViewZone function.
the idea is a castle upon a mountain with artillery. the whole valley should be a no go zone, so i have like 6 or 7 area's created over the valley. so i'll be having 7 SeeHere's...
|
|
|
Post by danzig70 on Oct 1, 2010 16:23:23 GMT 1
You could position snipers as "forward observers". I think the AI can only see what its units see.
|
|
kaoz
General
inter faesces et urinam nascimur
Posts: 1,112
|
Post by kaoz on Oct 1, 2010 22:08:36 GMT 1
yeah, which is a shame... i was like: oh, i'm gonna set the ViewZone for player 1 and it will work out fine... until cold shower came...
but, i've seen indeed the suppresive fire scripts before... will have to work with that!
|
|
|
Post by Major Pain on Oct 2, 2010 0:46:57 GMT 1
kaoz: Be sure to have specific gun(s) assigned to a Script ID that are tied to a specific location. If your try to have them look at too much, they will spend too much time repositioning, rotating, etc.
I assuume you will want a pretty quick reaction if player enters the locations.
The only other way you could have the AI constantly looking at the area would be with a sniper. But these can be eliminated with another sniper or officer. That would make the AI blind in that area. If you are trying to simulate height over a lowland, the script I posted is the best way.
You can also use the same script to command units to respond to that location by simply changing the cmd number.
0 = move to - moves to location in current formation 1 = attack unit - attacks unit at location 3 = swarm to - moves toward lcation, but attacks all enemy in route.
You could also have the script identify specific types of units. All you have to do is look for specific Script IDs:
GetNScriptUnitsInArea(1000, SeeHere) : ---> Looks at how many Script ID#1000 units are in location "SeeHere".
Armor = Script ID #1000 Squads = Script ID #1100 Trucks = Script ID#1200
The script might be set to allow squads to enter without firing the guns, but then open fire on armor. Or it could be set to allow a number of units to enter the location, then once a set number are present, open fire. This has the effect of giving a false sense of security to the player as he moves forward. The scouts pass through unmollested, but as the main force moves into the location, the guns open up.
Just some suggestion to enhance the player's pleasure, .... or grief.
|
|