add_hp_up_trigger - ryzom/ryzomcore GitHub Wiki


title: Add HP Up Trigger description: published: true date: 2023-03-12T13:36:49.269Z tags: editor: markdown dateCreated: 2023-03-12T13:10:42.525Z

addHpUpTrigger

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.

Syntax

()addHpUpTrigger(threshold: f, user_event_n: f) // addHpUpTrigger_ff_
()addHpUpTrigger(threshold: f, callback: s) // addHpUpTrigger_fs_

Arguments

  • threshold (float): The HP threshold that triggers the event or function.

()addHpUpTrigger(f, f)

  • user_event_n (float): The user event number to trigger.

()addHpUpTrigger(f, s)

  • callback (string): The name of the script function to call.

Examples

Trigger user event

()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.

Call script function

()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.

⚠️ **GitHub.com Fallback** ⚠️