I have a placeable that when you examine it (right click on it) there is a text like: “There’s nothing unusual with this object”. I would like to run a script when that happens. How do you do that? Maybe it’s not possible? I mean, there’s the OnUsed, OnLeftClick, OnInventoryDisturbed etc. on the object but none that says OnRightClick or OnExamine. Could you use OnDefinedEvent for this thing?
The Description?
“Localized Description” vs “Localized Description (when identified)”… Unless I don’t understand what you want to do.
Yes, under Localized Description there’s the text that is shown ingame. But you can’t put a script there…right? (There’s no “Localized Description(when identified)” as far as I can see at least).
Ok, it’s for a placeable object not an player item.
It is possible to do this if you place a variable “on the placeable” and that your script use it afterward. The script must be place “On Used” or if it has an inventory for example, “On Inventory Disturbed Script” (or any others actions obviously).
Eh, ok. Right now I have another script put OnUsed of this placeable that teleports the PC to a waypoint (when the PC left clicks on the placeable). So I would like to run this script specifically when the PC uses the Examine (right click and then choose examine which then brings up the text under Localized Description).
Looking at Functions on Script Assist I can’t find anything that would let me check if the placeable has been examined so…I guess there’s no way to do this…
This is the script I use (goes in OnUsed) in NwN 1 -
void main()
{
object oPC = GetLastUsedBy();
if(GetIsPC(oPC))
{
object oMe = OBJECT_SELF; // Necessary in order to work as expected
AssignCommand(oPC, ActionExamine(oMe));
}
}
TR
// Maybe on using “On Click”. However, I think it’s not the result you want exactly.
void main()
{
object oPC = GetClickingObject();
if (!GetIsPC(oPC)) return;
FloatingTextStringOnCreature(“Your Text OverHere”, oPC);
}
Thanks everyone for trying to help! @Tarot_Redhand Yeah, there’s a template similar to that in NWN2’s script assist, but that still doesn’t solve anything because you can right click and left click, and I only want the script to fire when they have right clicked and examined the placeable.
I think I’ll have to work around the problem. I’ll test by using something like you’ve both described here on the OnUsed. If the PC still examines the placeable nothing will happen, but instead of teleporting directly when clicking on the object, I will run the FloatingTextStringOnCreature and then when the PC left clicks again the teleporting will fire. I guess there’s no other way to do it.