Larian Studios
Posted By: Rhidian Scripting- Identifying a Hostile Enemy? - 11/10/14 02:12 AM
I have come up with a certain script for fun, but it would be infinitely better if I could pick out the hostile enemies for any given encounter when combat starts.

What I have right now is something like this:
Code
INIT Section
DB_ProtectedCharacters(CHARACTER_HOM_Astarte);
DB_ProtectedCharacters(CHARACTER_HOM_Astarte_SecondFight);
DB_ProtectedCharacters(CHARACTER_HIB_Leandra);


KB Section
IF
CharacterEnteredCombat(_Char, _ID)
AND
NOT _Char.isPlayer()
AND
NOT DB_ProtectedCharacters(_Char)
THEN
CharacterSetHitpointsPercentage(_Char, 0);


I imagine that I would use something like CharacterGetRelationToCharacter, but I'm not sure which value would be necessary.
Posted By: ALF Re: Scripting- Identifying a Hostile Enemy? - 13/10/14 06:31 AM
You can use CharacterGetRelationToCharacter and check for a value less than 25 (so < 25).
Note that this will only work for Global characters. Local characters in your combat won't be handled by it.
Posted By: Zoltan Re: Scripting- Identifying a Hostile Enemy? - 17/10/14 07:56 PM
There are some databases maintained by the main story scripts that could be helpful.
EvilDude - contains all 'Evil' characters. These are defined at game initialization by those with a relation to Arhu of < 25. It can be added to at anytime.
IsStoryNPC - is a database containing what I think are protected characters (uses call CharacterMakeStoryNpc)
The query CharacterGetAttitudeTowardsPlayer might also be useful, not sure its difference to CharacterGetRelationToCharacter but they are different
© Larian Studios forums