Donut Team is a labor of love, built and maintained by a small group of passionate developers. We invest our own time and resources to offer our tools, mods, and web services completely free of charge.

We don't run ads, and we will never sell your data - period.

If you've enjoyed anything we've created, please consider supporting our work with a one-time or monthly donation via our Ko-fi page . Every contribution helps us continue building great experiences for the community.

Dismiss
  • Games
  • Radical Entertainment
  • The Simpsons: Hit & Run
  • Scripting
  • Console Commands
  • MFK Commands
  • Mission Initialisation
  • Stages
  • Objectives

SetTalkToTarget

Sets what NPC must be talked to in a talkto objective.

Scope

This command should be called between calls to AddObjective and CloseObjective in a mission's initialisation script.

Syntax

MFK
Lua
SetTalkToTarget( npc, [icon, icon_y_offset, trigger_radius] );
Game.SetTalkToTarget( npc, [icon, icon_y_offset, trigger_radius] )
  • npc: The name of the NPC that must be talked to.
  • icon: The type of 3D icon to show above the NPC's head.
    • 0: Show the exclamation icon.
    • 1: Show the gift icon.
      • Note: The base game has no such composite drawable, but this will work if one is loaded by a mod.
    • 2: Show the interior_icon icon.
      • Note: The base game has no such composite drawable, but this will work if one is loaded by a mod.
    • Optional, defaults to 0.
  • icon_y_offset: An offset for the Y position of the 3D icon.
    • Optional, defaults to 0.0.
  • trigger_Radius: The radius of the trigger used to actually talk to the NPC.
    • Optional, defaults to 1.3.

Examples

MFK
Lua
AddObjective("talkto");
	AddNPC("ned", "m2_ned_sd");
	SetTalkToTarget("ned", 0, 0);
CloseObjective();
Game.AddObjective("talkto")
	Game.AddNPC("ned", "m2_ned_sd")
	Game.SetTalkToTarget("ned", 0, 0)
Game.CloseObjective()