Jump to content

AttackedBy


Sofus

Recommended Posts

I can't get it to work:

 

"Returns true only if the active CRE was attacked in the style specified (not necessarily hit)".

IF																						 
AttackedBy([ANYONE],DEFAULT) // works fine
THEN
 ...
END

IF																						 
AttackedBy([ANYONE],MELEE)  // no reaction at all, not even when hit
THEN
  ...
END

IF																						 
AttackedBy([ANYONE],RANGED) // no reaction at all, not even when hit
THEN
...
END

So is the IESDP wrong here, is the trigger broken or am I missing something ? Was hoping to use it for scripting some defense spells, but it seems I have to resort to HitBy() instead.

Link to comment
I can't get it to work:

 

"Returns true only if the active CRE was attacked in the style specified (not necessarily hit)".

IF																						 
AttackedBy([ANYONE],DEFAULT) // works fine
THEN
 ...
END

IF																						 
AttackedBy([ANYONE],MELEE)  // no reaction at all, not even when hit
THEN
  ...
END

IF																						 
AttackedBy([ANYONE],RANGED) // no reaction at all, not even when hit
THEN
...
END

So is the IESDP wrong here, is the trigger broken or am I missing something ? Was hoping to use it for scripting some defense spells, but it seems I have to resort to HitBy() instead.

 

Sofus,

 

To my knowledge, the attackstyles (there is an ids file for them, something like attackstyles.ids), RANGED and MELEE have never worked.

Link to comment

Lol...that's just funny. How the .... did they manage to screw that one up. Seems like a pretty vital check for a lot of spells in the game. Guess that's why your Protection from Melee/Missile and similiar in Eseries is based on range checks. Was hoping to outsmart you in my scripts :mad:

 

If there is any way to fix this, I think it is something that Fixpack should adress. Maybe add a stat to the melee/missile weapons that is actually detectable..I'm new a this so I don't know what can be done. But from a scripting view being able to detect whether the enemy is hurling missiles at you or whacking you with a sword, prior to actually being hit, is pretty important.

 

Thanks for the reply.

Link to comment

The IDS file is ASTYLES.IDS in BG2.

 

To my knowledge, Bioware never uses anything but DEFAULT with AttackedBy. Usually they use HitBy instead, with its associated DAMAGES.IDS. Attacks don't always succeed, but a hit indicates a successful attack, so that may be why they put more work into HitBy.

Link to comment

Guess I will have to go with Hitby(). Maybe combined with a Globalshout , when anyone in the party is hit by missile, I could get the same effect. Want to avoid the PC having to take damage before protecting itself against it. Too bad AttackedBy() doesn't work better.

Link to comment
Guess I will have to go with Hitby(). Maybe combined with a Globalshout , when anyone in the party is hit by missile, I could get the same effect. Want to avoid the PC having to take damage before protecting itself against it. Too bad AttackedBy() doesn't work better.

 

FYI on HitBy - Crushing actually includes all damage types. That is why in a lot of scripts..

 

IF

HitBy([ANYONE],CRUSHING) // if hit by anything

 

And if you can come up with anything to outsmart what is already in the eSeries, let me have permission to steal it :mad:

 

Thanks,

Eric

Link to comment

I decided to skip the GlobalShout idea and use a GlobalTimer instead - Shouts' duration is too short.

 

Here's my solution, nothing fancy but at least there is a good chance of triggering the right defense buff when missiles are used:

// Goes in all scripts 
IF
!GlobalTimerNotExpired("HitByMissile","GLOBAL")// If timer isn't running or was never set
HitBy([ANYTHING],MISSILE)// And I was hit by a missile weapon 
HPPercentGT(LastTrigger,10)// And the attacker isn't near death
NumInPartAliveGT(1)// And I'm not alone
THEN
 RESPONSE #100
   SetGlobalTimer("HitByMissile","GLOBAL",12)// Set timer
END

// Followed by the buffs in the individual scripts
IF
!GlobalTimerNotExpired("CastAttack","LOCALS")
HaveSpell(....)
OR(2)
 GlobalTimerNotExpired("HitByMissile","GLOBAL")// And the timer is running
 HitBy([ANYTHING],MISSILE)// Or I was hit by a missile weapon 
!CheckStat(Myself,1,....) // And I'm not already using "...."
// + the various other checks of course (spellfailure, silence etc)
THEN
  RESPONSE #100
	SetGlobalTimer("CastAttack","LOCALS",6)
	Spell(Myself,....)
END

 

I could have used a Continue() at the first block when setting the timer, but I avoid those whenever possible, so it is not a mistake. I don't need to continue() since the action will only be done by 1 PC every 2 rounds max.

 

It is not perfect I know, someone still has to get hit, but I wont be wasting time casting anti missile buffs unless there is a need to. Guess it could be done the same way with melee, but I think I'll stick with range checks for that.

 

Btw. I read about crushing having value "0", that is just plain dumb imo. Why they decided that crushing didnt need to be detectable on it's own, but slashing or piercing does, makes no sense.

Link to comment

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...