Here, I shall give an example of triggeraction.
NPC Code:
if (playertouchsme) toweapons Freezing-Weapon;
if (weaponfired) {
triggeraction playerx+1.5+vecx(playerdir)*2,
playery+2+vecy(playerdir)*2,hurt,;
}
if (actionhurt) {
setani hurt,;
setplayerprop #c,Ugh;
}
Okay, I will take you through it step by step. NPC Code:
if (weaponfired) {
triggeraction playerx+1.5+vecx(playerdir)*2,
playery+2+vecy(playerdir)*2,hurt,;
}
This part sets the action at the specified location. NPC Code:
playerx+1.5+vecx(playerdir)*2,
playery+2+vecy(playerdir)*2,
The equation states that the action will be conducted in front of the player. This equation will always make the action be conducted in the direction of the player.
The rest is self-explainatory.