On percieved scripts
#1
Posté 11 décembre 2011 - 10:02
He is guarding a corridor, if he sees you he sends you back If he does not see you nothing happens so you may sneak past him.
Functionaly, if he sees you, you are transported to a waypoint and a bark string appears over the guard with some warning message.
You may use sneak or invisibility to pass the guard
All of this works except it is not perfect, nor near perfect in fact.
The perception check seems to be on the heatbeat so once you are rebuked you then have an ample 6 seconds to walk past the guard and he does nothing. Also if he sees you coming back in the other direction I want his reaction to be more violent as you should not be behind him.
I can see this working better with two triggers. One before and one after the guard but I cannot see how to make a test on these triggers which tests if the guard can see you or not.
Would I be better to simply test to see if the character is in shadows or invisible and let them pass if they are? If so how do I test those scenarios?
You thoughts and help would be welcome.
PJ
#2
Posté 11 décembre 2011 - 10:09
#3
Posté 11 décembre 2011 - 10:38
If it were me, I'd create a custom Area of Effect (ie. an 'aura') and apply it to the guard, so that it fires custom OnEnter, Heartbeat and OnExit scripts. That way he will react when you first approach him and enter his aura (via the OnEnter script), he'll keep checking every six seconds (using a GetFirstObjectInShape/GetNextObjectIn Shape loop with the line-of-sight option as TRUE), and you can also script something to happen when you leave his custom 'aura' if you wanted.
The advantage of the custom AOE is that you can apply it to a wandering guard, and it's like they carry a mobile trigger around with them. Plus they run a second HB script.
I recently scripted a custom aura for a type of undead called a Quell, which has the power of intercession (it can block divine spells). Both the OnEnter and HB scripts for it check for divine spell casting classes and apply spell failure accordingly. I've found the custom AOE option to be an extremely powerful scripting tool.
Modifié par DannJ, 11 décembre 2011 - 10:42 .
#4
Posté 11 décembre 2011 - 10:49
For invisibility it gets a bit trickier: You have sanctuary, invisibility, improved invisibility, ethereal Jaunt, Walk Unseen, Retributive Invisibility, + others. It maybe a matter of picking a common effect that all these apply or checking GetEffectSpellId (which is much more in depth).
Once you determine if they are hidden you can do a PC vs Guard hide/spot or move silent/listen.
If the PC fails these checks or has no hidden status (sneaking, spell effect) then the guard does their thing. With the triggers you can fire the script and have an entering area and leaving area (sneaking back out) script or the triggers could just set the variables and the script can be fires some other way.
I would also suggest getting in touch with Kamal. I am sure he has situations like this in his thief campaign.
Modifié par Shaughn78, 11 décembre 2011 - 10:51 .
#5
Posté 11 décembre 2011 - 11:02
I don't know whether Sanctuary affects the function though. It might require a separate check.
Modifié par DannJ, 11 décembre 2011 - 11:03 .
#6
Posté 11 décembre 2011 - 11:21
I'm using onPerceived for disguise. Some npc's are hostile by default, but will turn neutral if the player is properly disguised. For instance, castle guards will be hostile to a player not wearing a guard outfit, but turn neutral if the player is. One problem is it's possible to a hostile npc to attack before onPerception turns them neutral. Not a big deal for melee creatures (they start to approach then go neutral right away), but ranged creatures can make a single attack (guards who should get multiple attacks a round based on their bab will fire a single arrow) before turning neutral.Shaughn78 wrote...
To test for stealth it is just quick check: GetActionMode
For invisibility it gets a bit trickier: You have sanctuary, invisibility, improved invisibility, ethereal Jaunt, Walk Unseen, Retributive Invisibility, + others. It maybe a matter of picking a common effect that all these apply or checking GetEffectSpellId (which is much more in depth).
Once you determine if they are hidden you can do a PC vs Guard hide/spot or move silent/listen.
If the PC fails these checks or has no hidden status (sneaking, spell effect) then the guard does their thing. With the triggers you can fire the script and have an entering area and leaving area (sneaking back out) script or the triggers could just set the variables and the script can be fires some other way.
I would also suggest getting in touch with Kamal. I am sure he has situations like this in his thief campaign.





Retour en haut






