-
Notifications
You must be signed in to change notification settings - Fork 1
/
DT2UndercoverWeapons.nut
167 lines (136 loc) · 4.24 KB
/
DT2UndercoverWeapons.nut
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
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
#############Undercover scripts##########
/*T2 ONLY! For DScript Version v0.24+ and the DImUndercoverScript
IF you ARE NOT using DImUndercover better DELETE this file. INCLUDE it in your map if you do.
It replaces the standard weapons scripts. Weapons will not behave diffrently though but I would recommend let the game use the standard ones.
NOTE:The real propblem is actually the bow, while sword and blackjack can be made suspicious just by adding the property (that's all the melee scripts here do)
the bow needs special handling.
There might be a work arround making the arm object suspicious. TODO: Think about it.
##########################################*/
if (GetDarkGame() == 2)
{
//These melee scripts can be deleted if the suspicious stuff is set in the editor on the objects itself or via NVNewWeapon+Metaproperty.
class BlackJack extends SqRootScript
{
// MESSAGES:
function OnFrobInvBegin()
{
if (message().Abort)
Weapon.FinishAttack(message().Frobber, message().SrcObjId);
else
Weapon.StartAttack(message().Frobber, message().SrcObjId);
}
function OnFrobInvEnd()
{
Weapon.FinishAttack(message().Frobber, message().SrcObjId);
}
function OnFrobToolBegin()
{
Weapon.StartAttack(message().Frobber, message().SrcObjId);
}
function OnFrobToolEnd()
{
Weapon.FinishAttack(message().Frobber, message().SrcObjId);
}
function OnInvSelect() //Added; this could also be put in a constructor but then would work on decorative swords as well. TODO Only works if contained.
{
Property.Add(self,"SuspObj")
Property.Set(self,"SuspObj","Is Suspicious",true)
Property.Set(self,"SuspObj","Suspicious Type","blood")
Weapon.Equip(self, eDarkWeaponType.kDWT_BlackJack);
}
function OnInvDeSelect()
{
Weapon.UnEquip(self);
}
}
class Sword extends SqRootScript
{
// MESSAGES:
function OnFrobInvBegin()
{
if (message().Abort)
Weapon.FinishAttack(message().Frobber, message().SrcObjId);
else
Weapon.StartAttack(message().Frobber, message().SrcObjId);
}
function OnFrobInvEnd()
{
Weapon.FinishAttack(message().Frobber, message().SrcObjId);
}
function OnFrobToolBegin()
{
Weapon.StartAttack(message().Frobber, message().SrcObjId);
}
function OnFrobToolEnd()
{
Weapon.FinishAttack(message().Frobber, message().SrcObjId);
}
function OnInvSelect() //Added; this could also be put in a constructor but then would work on decorative swords as well
{
Property.Add(self,"SuspObj")
Property.Set(self,"SuspObj","Is Suspicious",true)
Property.Set(self,"SuspObj","Suspicious Type","blood")
Weapon.Equip(self, eDarkWeaponType.kDWT_Sword);
DrkInv.AddSpeedControl("SwordEquip", 0.75, 0.8);
}
function OnInvDeSelect()
{
Weapon.UnEquip(self);
DrkInv.RemoveSpeedControl("SwordEquip");
}
}
class Arrow extends SqRootScript
{
// METHODS:
function UnEquipMe()
{
Property.Set("Player","SuspObj","Suspicious Type",GetData("Selected")) //If you used a custom SuspType for the player it want to restore it.
Bow.UnEquip();
DrkInv.RemoveSpeedControl("BowDraw");
}
// MESSAGES:
function OnBeginScript()
{
if ( !IsDataSet("Selected") )
SetData("Selected", FALSE);
}
function OnFrobInvBegin()
{
if (message().Abort)
{
Bow.AbortAttack();
DrkInv.RemoveSpeedControl("BowDraw");
}
else
{
Link.DestroyMany("~AISuspiciousLink","Player","@Creature") //New line. TODO: Read what Susp Links do again.
Property.Set("Player","SuspObj","Suspicious Type","blood") //New line, will instantly alert if seen.
Bow.StartAttack();
DrkInv.AddSpeedControl("BowDraw", 0.75, 1.0);
}
}
function OnFrobInvEnd()
{
local retval = Bow.FinishAttack();
DrkInv.RemoveSpeedControl("BowDraw");
Property.Set("Player","SuspObj","Suspicious Type",GetData("Selected")) //Restore the intial type.
Reply(retval);
}
function OnInvSelect()
{
SetData("Selected", Property.Get("Player", "SuspObj","Suspicious Type"))//Store the initial set SuspType on the player.
Bow.SetArrow(self);
Bow.Equip();
}
function OnInvDeSelect()
{
UnEquipMe();
SetData("Selected", FALSE);
}
function OnDestroy()
{
if ( GetData("Selected") )
UnEquipMe();
}
}
}