Aller au contenu

Photo

Demons and Devils hostile to each other - Onperception


  • Veuillez vous connecter pour répondre
10 réponses à ce sujet

#1
BartjeD

BartjeD
  • Members
  • 249 messages
An onPerception script could be used to switch demons and devils into becoming hostile towards each other by altering their personal reputation towards the creature seen?
It would check race and if Outsider check tag to see if the creature is a demon / devil and if the perceiving creature is a demon or devil.
If so ---> Switch tempenemy towards the seen creature
Result: All Demons and Devils will fight each other.

Als included a check for "Protect from Evil" in order to make these outsiders neutral if you are and hostile if you aren't. Even if you summoned one...  :twisted:


Here's the link to the prototype: http://www.megaupload.com/?d=21IDNBYD


The problem:
It works almost completely. Demons and Devils attack every creature that isn't either protected from Evil and also any creature isn't one of their own kind. (demons don't attack demons and the same for devils)

The bug is that the player won't see them to be hostile after using the function Temporary Enemy (on the demon  / devil and PC). Sometimes its hostile for a few seconds and then its neutral again??? This happens over and over!


If anyone has an idea that would be hot  :D

Thanks in advance!

Modifié par BartjeD, 21 juillet 2011 - 04:12 .


#2
kamal_

kamal_
  • Members
  • 5 259 messages
Is there a reason you're not just using custom factions?

#3
MasterChanger

MasterChanger
  • Members
  • 686 messages

kamal_ wrote...

Is there a reason you're not just using custom factions?


+1. This way they'll just fight each other as well as PCs. Then you can build AI that makes them prefer demon-devil enemies over PC enemies or vice versa.

#4
BartjeD

BartjeD
  • Members
  • 249 messages
I need the TemporaryHostile function because I want the Demons and Devils to be hostile to anyone that isn't protected from Evil as well. (not just other faction enemies)

It doesn't look like I need to use custom factions to get this to work - I just need to prevent the creature hostility from being reset for some strange reason. The Demons and Devils are already attacking each other and the player - they just don't show as hostile towards the player. (making it hard to attack them back)


Shouldn't it work anyhow when I set it to TemporaryHostile for the appropriate creatures?

Modifié par BartjeD, 21 juillet 2011 - 04:13 .


#5
_Knightmare_

_Knightmare_
  • Members
  • 643 messages
You need to set the TempHostile both ways, make the demon/devil hostile towards the PC and make the PC TempHostile towards the demon/devil, so it requires two SetIsTemporaryEnemy calls with the parameters reversed in the second call.

SetIsTemporaryEnemy(oDevil, oPC); // Make oDevil hostile towards oPC
SetIsTemporaryEnemy(oPC, oDevil); // Make oPC hostile towards oDevil

Modifié par _Knightmare_, 21 juillet 2011 - 05:03 .


#6
kamal_

kamal_
  • Members
  • 5 259 messages
Really, a custom faction for each and you're done in 5 minutes. Or you can build an ai that simply does what the custom factions do.

Faction devil: hostile to all except faction devil. And faction demon the same. Set all other factions to be hostil to both these factions. And you're done. Try it.

#7
MasterChanger

MasterChanger
  • Members
  • 686 messages
 And then Protection from Evil (as the name implies) unsets the hostility. The implication is that they're hostile by default, they just are prevented from being hostile by the spell, not that having the spell is the default condition.

Of course, if it's simpler for you to just build the whole interaction with scripts rather than using factions, go for it. Really, all that matters to the end user is that it works.

#8
BartjeD

BartjeD
  • Members
  • 249 messages

_Knightmare_ wrote...

You need to set the TempHostile both ways, make the demon/devil hostile towards the PC and make the PC TempHostile towards the demon/devil, so it requires two SetIsTemporaryEnemy calls with the parameters reversed in the second call.

SetIsTemporaryEnemy(oDevil, oPC); // Make oDevil hostile towards oPC
SetIsTemporaryEnemy(oPC, oDevil); // Make oPC hostile towards oDevil


Hey, This I did in the prototype script so that should be working.
It's boggling my mind that it doesn't! 

It shows hostile for a few seconds and then goes neutral again and repeats itself! Image IPB

Modifié par BartjeD, 21 juillet 2011 - 06:01 .


#9
BartjeD

BartjeD
  • Members
  • 249 messages
Should I first do the PC and then the Demon / Devil perhaps??? Hadn't tried that.
Surely that can't be it?

Thanks for the replies so far guys :)
I hope someone can help fix this!

#10
BartjeD

BartjeD
  • Members
  • 249 messages
For some very obscure and strange reason switching the order in which the creatures are made hostile to each other worked.

Make the PC hostile to the NPC first, The NPC to PC after that.
The other way around doesn't work.


Image IPB

How weird is that?

Modifié par BartjeD, 22 juillet 2011 - 08:26 .


#11
kevL

kevL
  • Members
  • 4 074 messages
typical! lol