-
Notifications
You must be signed in to change notification settings - Fork 0
/
apprentice_ud.nss
78 lines (70 loc) · 2.66 KB
/
apprentice_ud.nss
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
//::///////////////////////////////////////////////
//:: Custom User Defined Event
//:: FileName
//:: Copyright (c) 2001 Bioware Corp.
//:://////////////////////////////////////////////
/*
*/
//:://////////////////////////////////////////////
//:: Created By: nereng
//:: Created On: 28/04 06
//:://////////////////////////////////////////////
#include "x0_i0_anims"
void main()
{
int nUser = GetUserDefinedEventNumber();
if(nUser == 1001) //HEARTBEAT
{
}
else if(nUser == 1002) // PERCEIVE
{
object oPerceive = GetLastPerceived();
if (GetIsPC(oPerceive) == TRUE)
{
DelayCommand(0.2, ExecuteScript("x0_d1_g2_hello", OBJECT_SELF));
SetSpawnInCondition(NW_FLAG_PERCIEVE_EVENT, FALSE);
}
}
else if(nUser == 1004) // ON DIALOGUE
{
int iListen = GetListenPatternNumber();
string sHeard;
if (iListen = 101)
{
object oSpeaker = GetLastSpeaker();
object oPC = GetNearestCreature (CREATURE_TYPE_PERCEPTION, PERCEPTION_HEARD, OBJECT_SELF,1,
CREATURE_TYPE_PLAYER_CHAR, PLAYER_CHAR_IS_PC);
object oWorkbench = GetNearestObjectByTag("N_Workbench");
object oWP = GetWaypointByTag("APPRENTICE_WP");
sHeard = GetMatchedSubstring(0);
if (GetIsPC(oSpeaker) == TRUE)
{
if (oWorkbench != OBJECT_INVALID)
{
object oItem = GetFirstItemInInventory(oWorkbench);
object oNext = GetNextItemInInventory(oWorkbench);
if (oNext != OBJECT_INVALID)
{
SpeakString("Too many items on the table!");
return;
}
if (oItem != OBJECT_INVALID && sHeard != "")
{
SetLocalLocation(OBJECT_SELF, "ls_stored_loc", GetLocation(OBJECT_SELF));
location lTarget;
lTarget = GetLocalLocation(OBJECT_SELF, "ls_stored_loc");
/////////////////////////////////
ActionMoveToObject(oWorkbench, TRUE);
ActionPlayAnimation(ANIMATION_LOOPING_GET_MID, 1.0, 3.0);
ActionDoCommand(SetName(oItem, sHeard));
ActionSpeakString("Finished!");
ActionWait(1.0);
ActionMoveToLocation(lTarget, FALSE);
SetSpawnInCondition(NW_FLAG_ON_DIALOGUE_EVENT, FALSE);
return;
}
}
}
}
}
}