Jump to content

BG1 AttackedBy() Trigger - Typo or my Misunderstanding?


OtisTDog

Recommended Posts

Hello,

 

I was trying to poke around with modding some scripts for the first time today, using BG1:TotSC (no Tutu). The very excellent IEDSP pages give a great overview of the various actions and triggers, but I am having trouble understanding the correct way to use the AttackedBy() trigger.

 

In the triggers description page at iedsp.gibberlings3.net/scripting/triggers/bg1triggers.htm, it says the function call for AttackedBy is:

 

0x0002 AttackedBy(O:Object*,I:Style*AStyles)

 

If I'm reading this correctly, that means the first argument must be something from OBJECT.IDS, and the second argument must be something from ASTYLES.IDS. However, on the actions description page at iedsp.gibberlings3.net/scripting/actions/bg1actions.htm, there are several example uses of the AttackedBy trigger that seem to have form:

 

AttackedBy(I:Allegiance*EA,O:Object*)

 

such as the example for action 10 Enemy(), which shows a trigger condition:

 

AttackedBy([GOODCUTOFF],Myself)

 

Is this an error in the actions example or in the trigger description? Or is it neither, and I just don't understand what I'm reading so far?

 

I would appreciate any clarification.

 

--Otis

Link to comment

It's not an error in the actions example. It is that way in the game. The triggers.ids file lists what is in the IESDP. Why the difference, I do not know.

 

Try one block that follows the pattern as described and another with the way it is used in the example. Use a DisplayString to show text in the window so you know which block was actually triggered. If you never get one of them to trigger then use the pattern that works. And of course, let us know what you find out.

 

Example of what I'm saying:

IF
AttackedBy([GOODCUTOFF],Myself)
THEN
RESPONSE #100
DisplayString(Myself,XXXX) //where XXXX is a strref of your choice
END
IF
AttackedBy(NearestEnemyOf(Myself),DEFAULT)
THEN
RESPONSE #100
DisplayString(Myself,YYYY) //where YYYY is a different strref of your choice
END

But on a side note... Anything in the EA file can be used as an object. So if you are looking for enemy but don't need to be particular See([ENEMY]) works great. If you are scripting a shout and you want your party members to hear but you don't know which party member will shout, the EA file comes to your rescue. Heard([PC]) lets you listen for fellow party members because they all have the same allegiance.

Link to comment

The examples in IESDP are totally bogus. AttackedBy() returns true if the caller is "threatened" by an object matching the first parameter; IIRC, the second parameter (attack style) is nonfunctional.

 

As plainab notes, O:Object is any AI object, which can be referred to by an Object.ids reference, an object spec ([Ea.General.Race.Class.Specific.Gender.Alignmen]), or a script name.

Link to comment

Archived

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

×
×
  • Create New...