add_hp_up_trigger - ryzom/ryzomcore GitHub Wiki
title: Add HP Up Trigger description: published: true date: 2023-03-16T23:04:50.828Z tags: editor: markdown dateCreated: 2023-03-16T22:20:49.101Z
The addHpUpTrigger native AI script function registers a trigger on HP increases. Whenever the HP level of a bot upcrosses 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.
()addHpUpTrigger(threshold: f, user_event_n: f) // addHpUpTrigger_ff_
()addHpUpTrigger(threshold: f, callback: s) // addHpUpTrigger_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.
()addHpUpTrigger(0.5, 4);
This example code registers a trigger that will trigger user event 4 when the HP level of a bot crosses 0.5.
()addHpUpTrigger(0.5, "onHPIncrease");
This example code registers a trigger that will call the "onHPIncrease" script function when the HP level of a bot crosses 0.5.