QUESTION 1 I SEZ
Y'know, there's an AI prone chance in Allied Assault, often used on majorly indoor levels to ensure that the AI won't go prone and look stupid, as laying on a floor in a building DOES look pretty stupid.
Is there a cover chance of sorts? As in, the chance the AI will want to take cover behind walls or crates or whatever they can take cover behind? I'd like to make AI hide behind stuff as much as possible, just because it looks cool and they don't seem quite as stupid as standing out in the open.
It's especially cool to see friendlies take cover and shoot over crates, though I'm not sure why I like that so much. Makes me feel like I'm actually in a squad, I guess.
QUESTION 2 HERE IZ
Everyone knows I've been modifying the stock single player maps of Allied Assault, because I never shut up about it. It's such a long, laborious process, going through each level to ensure maximum difficulty and fun.
ANYWAY, is it possible to change the models of friendlies through scripts? All friendlies in the original Allied Assault are placed before-hand (rather than spawning), so I can't specify their model, as far as I can tell.
Y'know, I'm thinking something along the lines of "level.friendly1.model =" or something weird like that. It may not even be possible, though I won't kill myself over it if it isn't.
And here are the quick, vague versions of the above questions!
QUESTION 1
Is there such thing as a cover or hide chance?
QUESTION 2
Is there a way to change the models of pre-placed characters using scripts?
2 questions: Cover Chance and Script Model Changing
Moderator: Moderators
I'll start with Question 2 because it's the shorter one to answer
Yes, in theory it's possible to chance an AI's model with the .model = ... line, but since part of the AI initialization is in the models in practice there may be unexpected side effects. Possible problems:
// store useful info
local.origin = $someai.origin
local.angles = $someai.angles
local.targetname = $someai.targetname // obviously 'someai'
local.type_attack = $someai.type_attack
// etc..
$someai remove
local.newai = spawn < the new model >
local.newai.origin = local.origin
local.newai.angles = local.angles
local.newai.targetname = local.targetname
local.newai.type_attack = local.type_attack
// etc..
This could ofcourse be combined into a method so you only have to make it once and then you can clone any AI
Note that also scripts need to be rerun.
local.newai thread global/friendly.scr::friendlythink
// etc.
Now Question 1, which I actually think is a more interesting question
AI prone behaviour is in anim/attack.scr, this is the basic condition:
anim/attack.scr, 943
You can see that friendlies never prone, panzerschreck guys prefer to crouch instead of prone and AI only prones if the enemy is sufficiently far away.
self.pronedistance = 850 // anim/attack.scr, 20
This is roughly 17 m.
Additionally, AttackCheckProne (anim/attack.scr, 1529) makes sure the AI isn't more than 160 units above the player, and has a direct line of sight from his proned position to the player.
The distance check usually makes sure AI doesn't prone in a building.
Now regarding the cover bit, if type_attack is set to cover AI will always attempt to go into cover as soon as an enemy is detected. However, it is not always possible to go into cover. Each AI will only consider cover nodes inside its leash, satisfying the min and max dist constraints, and not within the interval of another AI (they want to keep a minimum separation). If cover is not available the AI will go into basic attack mode (anim/attack.scr) or toss grenades.
Yes, in theory it's possible to chance an AI's model with the .model = ... line, but since part of the AI initialization is in the models in practice there may be unexpected side effects. Possible problems:
- Heads disappearing (I kid you not
) - Weapon change
// store useful info
local.origin = $someai.origin
local.angles = $someai.angles
local.targetname = $someai.targetname // obviously 'someai'
local.type_attack = $someai.type_attack
// etc..
$someai remove
local.newai = spawn < the new model >
local.newai.origin = local.origin
local.newai.angles = local.angles
local.newai.targetname = local.targetname
local.newai.type_attack = local.type_attack
// etc..
This could ofcourse be combined into a method so you only have to make it once and then you can clone any AI
Note that also scripts need to be rerun.
local.newai thread global/friendly.scr::friendlythink
// etc.
Now Question 1, which I actually think is a more interesting question
AI prone behaviour is in anim/attack.scr, this is the basic condition:
anim/attack.scr, 943
Code: Select all
if (local.distance >= self.pronedistance && self.weapongroup != bazooka && self.team == german)self.pronedistance = 850 // anim/attack.scr, 20
This is roughly 17 m.
Additionally, AttackCheckProne (anim/attack.scr, 1529) makes sure the AI isn't more than 160 units above the player, and has a direct line of sight from his proned position to the player.
The distance check usually makes sure AI doesn't prone in a building.
Now regarding the cover bit, if type_attack is set to cover AI will always attempt to go into cover as soon as an enemy is detected. However, it is not always possible to go into cover. Each AI will only consider cover nodes inside its leash, satisfying the min and max dist constraints, and not within the interval of another AI (they want to keep a minimum separation). If cover is not available the AI will go into basic attack mode (anim/attack.scr) or toss grenades.
What's with all that stuff about going prone? I didn't ask about that, you know. Could have saved yourself some trouble, but thanks, I guess.
It turns out the AI prone chance is in Spearhead, anyway.
There's actually a large array of "chance" variables in the Spearhead attack.scr, so I replaced the Allied Assault attack.scr with the Spearhead attack.scr. Not that it makes much of a difference, because there's no cover chance, which you already explained why.
It turns out the AI prone chance is in Spearhead, anyway.
as quoted from the first level.level.aipronechance = 0
There's actually a large array of "chance" variables in the Spearhead attack.scr, so I replaced the Allied Assault attack.scr with the Spearhead attack.scr. Not that it makes much of a difference, because there's no cover chance, which you already explained why.
