Jump to content

IWDEE: Scripting Triggers


CamDawg

Recommended Posts

New actions and triggers; some of these were introduced prior:

 

0x40DC AreaCheckAllegiance(I:Allegience*EA)

This trigger will check if any creatures of the specified allegiance are present in the current area. Allegiance values are taken from EA.IDS.

Sample use:

AreaCheckAllegiance(ENEMY)

will return true if at least one creature with the ENEMY allegiance is present in the area.

0x40DD IsTouchGUI()

This trigger returns true only if the current device has touch screen capability.

Sample use:

IsTouchGUI()

will return true on an iPad.

 

0x40DE HasDLC(S:DLCName*)

Returns true if the DLC specified by the DLCName parameter has been purchased. Note: Returns true on PC/Mac/Linux as all DLCs are automatically available.

Sample use:

HasDLC("Neera")

will return true if the player has the Neera DLC installed.

 

0x40DF BeenInParty(S:Name*)

Returns true if the specified creature has been in the party at any point. The creature doesn't have to be in the party at the moment when the check is made.

Sample use:

BeenInParty("Imoen")

will return true if the player had Imoen in his party at any point.

 

0x40E0 NextTriggerObject(O:Object*)

Defines the object that the next trigger will be evaluated in reference to. This trigger does not evaluate and does not count as a trigger in an OR block. If the object cannot be found, the next trigger will evaluate to false.

Sample use:

NextTriggerObject(NearestEnemyOf(Myself))  
Range([PC],20)  

will return true if a party member is within 20 range units of the nearest enemy.

 

0x40e1 ExtendedStateCheck(O:Object*,I:State*extstate)

Returns true only if the specified object is in the state specified (uses EXTSTATE.IDS).

Sample use:

ExtendedStateCheck(Myself,STATE_DEAFENED)  

will return true if the creature running the script has been deafened.

 

0x40e2 CheckSpellState(O:Object*,I:State*splstate)

Returns true only if the specified object is in the state specified (uses SPELLSTATE.IDS).

Sample use:

CheckSpellState(Myself,38)  

will return true if the creature running the script has been deafened.

 

0x40e3 NearLocation(O:Object*,I:PointX*,I:PointY*,I:Range*)

Returns true if the specified object is within the range of the specified point. Works similar to Range, but with a point instead of an object.

Sample use:

NearLocation(Myself,1000,500,20)

will return true if the creature running the script is within 20 range units of coordinates x=1000 y=500.

 

0x40e4 NearSavedLocation(O:Object*,S:Global*,I:Range*)

Returns true if the object is near its home location (in case the specified variable doesn't exist) or near a point marked by a variable. The default home location for creatures is equal to their default position in the ARE file.

Sample use:

NearSavedLocation(Myself,"OH_TEST",20)

will return true if the creature running the script is within 20 range units of the saved location OH_TEST.

 

0x40e5 Switch(S:Global*,S:Area*)

The switch trigger can be used to change how the RESPONSE # sections are evaluated.

Without the switch, the RESPONSE #'s are used to generate a random distribution.

ex: Lets try to kill Anomen or Minsc 50% of the time

IF      
  True()  
THEN      
  RESPONSE #50          
    Kill("Anomen")      
  RESPONSE #50          
    Kill("Minsc")  
END  

Here is an example of using the switch.

IF      
  Switch("GLOBAL","PLAYER_TO_KILL")  
THEN      
  RESPONSE #1          
    Kill("Anomen")      
RESPONSE #2          
    Kill("Minsc")  
END  

0x40e6 IsWeaponRanged(O:Object*)

Returns true if a ranged weapon (i.e. bow or thrown axe) is currently equipped and selected on the specified object.

Sample use:

IsWeaponRanged(Myself)

will return true if the creature running the script has a ranged weapon equipped.

 

0x40E7 ButtonDisabled(I:Button*BUTTON)

Returns true if an interface button is disabled. Button values are taken from BUTTON.IDS.

Sample use:

!ButtonDisabled(BUTTON_STEALTH)

will return true if the creature running the script has its stealth button disabled (i.e. a Ranger wearing a Plate Mail)

 

0x40E9 NightmareModeOn()

Returns true if the Nightmare Mode is enabled. This mode is called Heart of Fury in IWD:EE.

Sample use:

NightmareModeOn()

will return true if the Nightmare Mode is currently turned on.

Link to comment

Is Switch() something for which the compiler needs to (de)construct concatenated scope and variable-name strings?

 

I think Switch works with current Weidu (237). It uses 2 strings. (Not concatenated).

You could build in some sanity checks like warning for 2 identical response #'s if you wish.

Link to comment

The value of the global says which Response # is executed. In the example, if the value is 1, then Anomen dies. If it is 2 then Minsc. Nothing happens if it is something else.

Btw, in the above example, the params of switch were swapped accidentally.

 

Another example:

IF
Allegiance(Myself,NEUTRAL)
Delay(10)
Range([pc],20)
Switch("var","LOCALS")
THEN
RESPONSE #0
DisplayStringHead(Myself,41314)
IncrementGlobal("var","locals",1)
RESPONSE #1
DisplayStringHead(Myself,41315)
IncrementGlobal("var","locals",1)
RESPONSE #2
DisplayStringHead(Myself,41316)
IncrementGlobal("var","locals",1)
RESPONSE #3
DisplayStringHead(Myself,41317)
IncrementGlobal("var","locals",1)
RESPONSE #4
DisplayStringHead(Myself,41318)
IncrementGlobal("var","locals",1)
RESPONSE #5
DisplayStringHead(Myself,41319)
SetGlobal("var","locals",0)
END

 

Link to comment

Archived

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

×
×
  • Create New...