OtisTDog Posted May 21, 2009 Posted May 21, 2009 Hello, all, My first script is coming along nicely, and I'm pretty happy with it. However, I'm trying to set it up so that if a particular person is fought with, the fight will be stopped if the PCs use piercing, slashing, or missile weapons. I set up a block in the BAF file that says: IF See([PC]) Global("ChallengeAccepted","LOCALS",1) HitBy(Myself,PIERCING) THEN RESPONSE #100 ChangeEnemyAlly(Myself,NEUTRAL) SetGlobal("RulesBroken","LOCALS",1) Dialogue([PC]) END plus two matching blocks that substitute HitBy(Myself,MISSILE) and HitBy(Myself,SLASHING). The idea is that the person being fought will stop fighting and start talking, at which point a weighted dialog block sensing the "RulesBroken" global will kick in. However, when the fight is going down, the person controlled by the script does not seem to trigger any of these blocks when hit with sling bullets, arrows, or swords. I am pretty sure the overall block structure is OK, since I have a very similar one that uses StateCheck() and which is working perfectly. My questions: 1) Is HitBy() the right trigger to be using here? 2) Am I using it correctly? 3) If yes to the above, any possible suggestions as to what I might be doing wrong? Thanks in advance for your help. --Otis
Mike1072 Posted May 21, 2009 Posted May 21, 2009 The first parameter to HitBy() should probably be [PC] instead of Myself.
Icendoan Posted May 21, 2009 Posted May 21, 2009 Yes, it should be the right trigger, but what you are asking is if you hit yourself with Piercing, Slashing or Missile damage. So, instead of using HitBy(Myself,X), try HitBy(LastHitterOf(Myself),X), which should work for whenever you are hit. (I am trying to use it to track stoneskins. ) Icen
OtisTDog Posted May 21, 2009 Author Posted May 21, 2009 Yes, it should be the right trigger, but what you are asking is if you hit yourself with Piercing, Slashing or Missile damage. Ooops. So what you are both saying is that the Object reference in the HitBy() function refers to the attacker that did the hitting, not the attackee that got hit. Is that correct? --Otis
OtisTDog Posted May 21, 2009 Author Posted May 21, 2009 So, instead of using HitBy(Myself,X), try HitBy(LastHitterOf(Myself),X), which should work for whenever you are hit. (I am trying to use it to track stoneskins. ) I used LastAttackerOf(Myself) instead of just Myself, and now it's working fine. Thanks to both of you. This is a very helpful forum, even to people who didn't read the IEDSP documentation as closely as they should have. --Otis
Recommended Posts
Archived
This topic is now archived and is closed to further replies.