add_hp_down_trigger - ryzom/ryzomcore GitHub Wiki
title: Add HP Down Trigger description: published: true date: 2023-03-12T14:04:40.301Z tags: editor: markdown dateCreated: 2023-03-12T14:04:37.134Z
The addHpDownTrigger native AI script function registers a trigger on HP decreases. Whenever the HP level of a bot downcrosses the threshold, it triggers the specified user event or script function. Several triggers can be registered on the same group, even with the same threshold and event.
()addHpDownTrigger(threshold: f, user_event_n: f) // addHpDownTrigger_ff_
()addHpDownTrigger(threshold: f, callback: s) // addHpDownTrigger_fs_
- threshold (float): The HP threshold that triggers the event or function.
- user_event_n (float): The user event number to trigger.
- callback (string): The name of the script function to call.
()addHpDownTrigger(0.5, 5);
This example code registers a trigger that will trigger user event 5 when the HP level of a bot downcrosses 0.5.
()addHpDownTrigger(0.5, "onHPDecrease");
This example code registers a trigger that will call the "onHPDecrease" script function when the HP level of a bot downcrosses 0.5.