Creating Non-Aggressive Enemies
#1
Posté 11 juillet 2011 - 11:28
I'm trying to create some enemies that don't attack until attacked. To use WoW as an example, this would be your yellow-named creature as opposed to a red-named hostile. Here are some issues I've encountered during my trial and error:
- If I set the creatures as neutral, it isn't possible to begin combat with a spell. It seems the only way to initiate combat with a neutral is through a physical attack or applying a faction change with OnConversation. I'm aware that I can change .2das to allow casting on neutrals, but I'd rather not go through the headache!
- If I use a script to change faction from neutral to hostile either through PhysicalAttack or OnConversation, nearby creatures of the same type switch to hostile as well. This is when referencing OBJECT_SELF for faction switch.
- Ideally I'd like to have the creatures set to 0 with players so casters can begin combat with a spell, however I've tried everything from removing the shout lines in OnPhysicalAttack to removing the OnPerception script. The creatures still attack as soon as my character spawns in.
If anyone could help me solve this, it'd be greatly appreciated!
#2
Posté 12 juillet 2011 - 12:12
There is a UsesPersonalReputations option in the campaign options that should do the same/similar thing as the function, but I've had problems with turning it to True - though maybe I did something else wrong.
Modifié par _Knightmare_, 12 juillet 2011 - 12:15 .
#3
Posté 12 juillet 2011 - 12:29
I've also tried toying with the UsesPersonalReputations setting, but that comes back down to the issue of all nearby enemies of the same type assisting even when not set as allies. This is with the AdjustReputation function.
#4
Posté 12 juillet 2011 - 03:09
The snake only becomes truly hostile (via a custom OnDamaged script) if you damage it with a weapon. That way you have the option of backing off and waiting for it to turn and flee, if you'd rather not kill an innocent animal (or just don't want to tangle with a level 3 poisonous animal if you're at level 1).
Any neutral creature that attacks a party member will trigger a melee counter-attack from the party member in question (which, if successful in my case, causes the snake to become truly hostile). However you still can't target them with a hostile spell while they're neutral. You can however attack them with a ranged weapon, then fire off a spell after it becomes hostile and before it reaches you.
Modifié par DannJ, 12 juillet 2011 - 03:17 .
#5
Posté 12 juillet 2011 - 03:10
AstralPhenomenon wrote...
Ack, probably should've mentioned trying that one too >.< I've attempted to use SetIsTemporaryEnemy in both the OnPhysicalAttack and OnConversation scripts to no avail, the creatures refuse to acknowledge the attacker as an enemy.
I've also tried toying with the UsesPersonalReputations setting, but that comes back down to the issue of all nearby enemies of the same type assisting even when not set as allies. This is with the AdjustReputation function.
AdjustReputation is for changing how the object--the PC, for example--is viewed by the subject's group--the potential enemies, in this case. If you make the potential enemy and its group all suddenly hate the player, then yes, they'll all jump in.
I think a better approach would be to change the faction of the enemy from potential enemy to actual enemy when they're attacked. This would probably mean using a custom faction grid.
#6
Posté 12 juillet 2011 - 01:56
If you use the GUI approach, you can look at Lance Botelle's GUI tutorial on the vault. It will proabably be a good place to start.
If you use the conversation approach, it will probably be easier. Make sure you set the conversation to ignore start distance so that the PC does not walk up to the character and just starts the convo from where they are. Also, make sure the convo is set to NWN1 style to avoid the beginning of the cutscene.
From within the convo, you can just use the ga_faction_join script to make the NPC hostile if the PC chooses that option.
#7
Posté 12 juillet 2011 - 03:18
It's not a practical solution, but I figured I'd toss it out there.
#8
Posté 12 juillet 2011 - 04:17
I managed to get SetIsTemporaryEnemy working, seems it required the use of Personal Reputation, but the issue of all nearby copies of the enemy assisting still persists. This is with the enemies all set to a custom faction, viewing itself as neutral.
Edit: Current script is as follows
#include "hench_i0_monsho"
#include "ginc_behavior"
void main()
{
object oTarget = GetLastSpeaker();
object oSource = OBJECT_SELF;
SetIsTemporaryEnemy(oTarget, oSource, FALSE);
DetermineCombatRound();
}
Modifié par AstralPhenomenon, 12 juillet 2011 - 04:23 .
#9
Posté 15 juillet 2011 - 07:47
M. Rieder wrote...
Casting hostile spells on neutral opponents is a problem that no one has solved yet to my knowledge. There are some work-aroudnds, though. You can use either a dialogue or GUI interface to allow the player to turn the enemy hostile, allowing you to attack it or cast hostile spells on it. With careful use of the pause button, this is almost as good as just being able to attack it.
If you use the GUI approach, you can look at Lance Botelle's GUI tutorial on the vault. It will proabably be a good place to start.
Creating a GUI to control the attack is what I did. (Thanks for the plug Matt.)
Here is my blog explaining the GUI: http://worldofalthea...n-neutrals.html
The blog also points out some other details you may want to be aware of, like ensuring "plot" PCs cannot be changed to an "enemy of the PC".
Lance.





Retour en haut






