Aller au contenu

Photo

Hostile/Non-hostile vs PCs with same appearance type


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

#1
Loki_999

Loki_999
  • Members
  • 430 messages

Thinking about messing with monster AI so that if a monster sees a PC that has the same appearance type it won't automatically be hostile to it.

 

Eg: A githyanki character goes to the Astral plane and bumps into some githyanki spawns, they will not attack on sight.  However, if the PC attacks they will attack back.

 

However, two things comes to mind here that are problematic.

 

1) Hooking into the OnPercieved event... this is one script that should have minimal content in it because when multiple creatures spawn together their perception events fire like crazy. Anyone running a PW who has messed with these scripts and found any performance issues?

 

2) I think i could do it by setting the monsters faction to a PC neutral one... but then they would be neutral to anyone else in the area.

 

3) As i understand, the PC faction is kind of a special case. The faction table treats all PCs as the same faction, but in reality, each PC is in their own faction unless partied, in which case they share the leader's PC faction. But then if i set the monsters to the same PC faction as the PC, then they would not be attackable, and additional problem of multiple PCs in the same area with same appearance as the monsters but not partied. Rare situation, but if both PCs were close, then it could cause monsters to flip-flip their factions, running back and forward trying to attack their new enemy, who may become their friend.



#2
AGhost_7

AGhost_7
  • Members
  • 62 messages

That's going to be pretty hard to pull off considering that the AI has several different ways to fetching its targets. You will want to change DetermineCombatRound(). I'd say just do a GetSubRace(OBJECT_SELF) == GetSubRace(oTarget) or maybe something along those lines.



#3
ColorsFade

ColorsFade
  • Members
  • 1 270 messages

You can create custom factions for this sort of stuff, and that is the road I'd go down. 

 

You can have two factions. Faction "A" - set on your default monsters (so create your own blueprint, and change the faction). Make this faction hostile to the PC, but non-hostile to Faction "B". 

 

Faction "B" is then non-hostile to the PC. 

 

Pretty sure this will work; I did some custom faction work long time ago to test this stuff out. I am not 100% certain, but I remember I could adjust the factions. You have a range, I believe; a sliding value from 1-100. Closer you are to one end the more hostile/non-hostile the target is. Just experiment and I bet you can find a solution this way. 

 

This sort of issue is what the factions were invented for. 



#4
andysks

andysks
  • Members
  • 1 651 messages

I think though he talks about PW. So you cannot say that a Githzerai will be hostile towards the PC... but not that other PC. PC faction is same for all players logged in. Or am I wrong?



#5
ColorsFade

ColorsFade
  • Members
  • 1 270 messages

I was under the impression the PC faction was same for all - it's Defender faction. But... again, I have never played in a PW, and there are some different issues there since they allow PvP. 

 

Any solution is going to have to be tested. But I would think with the flexibility inherit in the faction system, factions would be a viable solution. 



#6
AGhost_7

AGhost_7
  • Members
  • 62 messages

Regarding hooking into the on precept event; as long as you guard execution it should be fine. Limit it to GetLastPerceptionSeen(), for example.



#7
Jezla

Jezla
  • Members
  • 173 messages

I agree with AGhost_7.  Set up how ever many custom factions you need (one per creature group per area, or something if you don't want a group going hostile module-wide)  and use the OnPerceived event to check the race/subrace of the object seen and adjust the faction accordingly.  You could even script it so that if it has no enemies left when the combat round ends (the PCs leave the area or are killed) the faction reputation goes back to what it was.



#8
Loki_999

Loki_999
  • Members
  • 430 messages

Thanks for the replies guys.