Hi!
Can you tell me when SWeaponFiredEvent and corresponding EventId are being signaled?
AI_Enemy and me gunning each over (in LOS), but no event comes. Isn't it a bug?
VBR,
SWeaponFiredEvent question
Moderators: hoijui, Moderators
Re: SWeaponFiredEvent question
have a look at rts/Sim/Units/CommandAI/CommandAI.cpp:1436
eoh sends stuff from the engine to AIs.
one event for each weapon fired would be bad for performance.
Code: Select all
void CCommandAI::WeaponFired(CWeapon* weapon)
{
if(weapon->weaponDef->manualfire && !weapon->weaponDef->dropped && !commandQue.empty()
&& (commandQue.front().id==CMD_ATTACK || commandQue.front().id==CMD_DGUN) && inCommand)
{
owner->AttackUnit(0,true);
eoh->WeaponFired(*owner, *(weapon->weaponDef));
FinishCommand();
}
}
one event for each weapon fired would be bad for performance.
Re: SWeaponFiredEvent question
Hi!
I've seen that part of the code.
But if so many constraints applied, isn't the Event useless then?
I've seen that part of the code.
But if so many constraints applied, isn't the Event useless then?
Re: SWeaponFiredEvent question
it is up to the AI dev to decide that. if it is useless for him, he can ignore it.
i extended documentation for the event now, will commit soon.
i am always happy if people do such stuff on a spring fork, i will merge it in then. some AI devs did that already.
i know that it is not nice to have to use an API which is not well documented. but keep in mind, that i did not write the API either (i just rewrote it). You already know how many functions there are in the AI callback, and then there are also events and commands. I already added a lot of docu, and some others helped too, but i will not go through all the functions, events and commands, and check all the code paths behind them and all stuff they depend on to find every little detail that could be of interest to an AI dev, and write it into nice comments. i guess you understand that
i do not use these functions myself, so i do not know which are unclear documented.
Whenever you investigate the inner functioning of a function, because it does not act according to its documentation, please document it right, and give it to me (as said, best through a git fork of spring).
so next time someone uses it, he does not have to go through the same process again.
also, besides the Lua interface maybe, this si already the most well documented part of the engine
i extended documentation for the event now, will commit soon.
i am always happy if people do such stuff on a spring fork, i will merge it in then. some AI devs did that already.
i know that it is not nice to have to use an API which is not well documented. but keep in mind, that i did not write the API either (i just rewrote it). You already know how many functions there are in the AI callback, and then there are also events and commands. I already added a lot of docu, and some others helped too, but i will not go through all the functions, events and commands, and check all the code paths behind them and all stuff they depend on to find every little detail that could be of interest to an AI dev, and write it into nice comments. i guess you understand that

i do not use these functions myself, so i do not know which are unclear documented.
Whenever you investigate the inner functioning of a function, because it does not act according to its documentation, please document it right, and give it to me (as said, best through a git fork of spring).
so next time someone uses it, he does not have to go through the same process again.
also, besides the Lua interface maybe, this si already the most well documented part of the engine

Re: SWeaponFiredEvent question
Looks like this event will only trigger if the weapon is commandfire=1 (like dgun in TA-based mods and some other 'superweapons'). Not sure how useful this is to AI, maybe it can be used to dodge dgun shots?