Example #1
0
// Set callback function name to be called in game script when this AI is first encountered
// Callback function first parameter is (this) AI clonk, second parameter is player clonk.
// The callback should return true to be cleared and not called again. Otherwise, it will be called every time a new target is found.
func SetEncounterCB(object clonk, string cb_fn)
{
	var fx = GetEffect("S2AI", clonk);
	if (!fx || !clonk) return false;
	fx.encounter_cb = cb_fn;
	clonk->Call(fx.ai.UpdateDebugDisplay, fx);
	return true;
}
Example #2
0
// Set the guard range to the provided rectangle
func SetGuardRange(object clonk, int x, int y, int wdt, int hgt)
{
	var fx = GetEffect("S2AI", clonk);
	if (!fx || !clonk) return false;
	fx.guard_range = {x=x, y=y, wdt=wdt, hgt=hgt};
	clonk->Call(fx.ai.UpdateDebugDisplay, fx);
	return true;
}
Example #3
0
// Set range in which, on first encounter, allied AI Clonks get the same aggro target set
func SetAllyAlertRange(object clonk, int new_range)
{
	var fx = GetEffect("S2AI", clonk);
	if (!fx || !clonk) return false;
	fx.ally_alert_range = new_range;
	clonk->Call(fx.ai.UpdateDebugDisplay, fx);
	return true;
}
Example #4
0
// Set the current inventory to be removed when the clonk dies. Only works if clonk has an AI.
func BindInventory(object clonk)
{
	var fx = GetEffect("S2AI", clonk);
	if (!fx || !clonk) return false;
	var cnt = clonk->ContentsCount();
	fx.bound_weapons = CreateArray(cnt);
	for (var i=0; i<cnt; ++i) fx.bound_weapons[i] = clonk->Contents(i);
	clonk->Call(fx.ai.UpdateDebugDisplay, fx);
	return true;
}