Hi guys,
I just started learning how to script and I'm trying to create one where the owner of the chest/door/locket/etc. will run to the player and start a conversation with him/her if him/her open the flagged chest/door/locket/etc.
This work just fine:
//Put this script OnOpen
void main()
{
object oPC = GetLastOpenedBy();
if (!GetIsPC(oPC)) return;
SetLocalInt(oPC, "tenta", 1);
object oTarget;
oTarget = GetObjectByTag("c_elf");
AssignCommand(oTarget, ActionStartConversation(oPC, "peguei"));
}
All good, but this means that the owner will run to the player even if he/she is not seeing the PC stealing. I tried something with GetLastPerceived(), but even if the script works and compiles (I know this because the dialog is set to the localInt "tenta" 1 as intended), the owner never runs to the player and starts the dialog.
How can I write this so the owner of the chest/door/locket/etc. will only run if he/she sees the PC trying to steal his/her stuff? Thanks!





Retour en haut






