NWNX:EE  8193.37.14
nwnx_damage.nss
Go to the documentation of this file.
1 
6 const string NWNX_Damage = "NWNX_Damage";
7 
11 {
12  object oDamager;
14  int iPierce;
15  int iSlash;
16  int iMagical;
17  int iAcid;
18  int iCold;
19  int iDivine;
21  int iFire;
22  int iNegative;
23  int iPositive;
24  int iSonic;
25  int iBase;
26  int iCustom1;
27  int iCustom2;
28  int iCustom3;
29  int iCustom4;
30  int iCustom5;
31  int iCustom6;
32  int iCustom7;
33  int iCustom8;
34  int iCustom9;
35  int iCustom10;
36  int iCustom11;
37  int iCustom12;
38  int iCustom13;
39  int iCustom14;
40  int iCustom15;
41  int iCustom16;
42  int iCustom17;
43  int iCustom18;
44  int iCustom19;
45  int iSpellId;
46 };
47 
51 {
52  object oTarget;
54  int iPierce;
55  int iSlash;
56  int iMagical;
57  int iAcid;
58  int iCold;
59  int iDivine;
61  int iFire;
62  int iNegative;
63  int iPositive;
64  int iSonic;
65  int iBase;
66  int iCustom1;
67  int iCustom2;
68  int iCustom3;
69  int iCustom4;
70  int iCustom5;
71  int iCustom6;
72  int iCustom7;
73  int iCustom8;
74  int iCustom9;
75  int iCustom10;
76  int iCustom11;
77  int iCustom12;
78  int iCustom13;
79  int iCustom14;
80  int iCustom15;
81  int iCustom16;
82  int iCustom17;
83  int iCustom18;
84  int iCustom19;
91  int iToHitRoll;
93 };
94 
98 {
100  int iPierce;
101  int iSlash;
102  int iMagical;
103  int iAcid;
104  int iCold;
105  int iDivine;
107  int iFire;
108  int iNegative;
109  int iPositive;
110  int iSonic;
111  int iCustom1;
112  int iCustom2;
113  int iCustom3;
114  int iCustom4;
115  int iCustom5;
116  int iCustom6;
117  int iCustom7;
118  int iCustom8;
119  int iCustom9;
120  int iCustom10;
121  int iCustom11;
122  int iCustom12;
123  int iCustom13;
124  int iCustom14;
125  int iCustom15;
126  int iCustom16;
127  int iCustom17;
128  int iCustom18;
129  int iCustom19;
130  int iPower;
131 };
132 
136 void NWNX_Damage_SetDamageEventScript(string sScript, object oOwner = OBJECT_INVALID);
137 
142 
147 
151 void NWNX_Damage_SetAttackEventScript(string sScript, object oOwner = OBJECT_INVALID);
152 
157 
163 
170 void NWNX_Damage_DealDamage(struct NWNX_Damage_DamageData data, object oTarget, object oSource = OBJECT_SELF, int iRanged = FALSE);
171 
173 
174 void NWNX_Damage_SetDamageEventScript(string sScript, object oOwner=OBJECT_INVALID)
175 {
176  NWNXPushObject(oOwner);
177  NWNXPushString(sScript);
178  NWNXPushString("DAMAGE");
179  NWNXCall(NWNX_Damage, "SetEventScript");
180 }
181 
183 {
184  struct NWNX_Damage_DamageEventData data;
185  NWNXCall(NWNX_Damage, "GetDamageEventData");
186  data.oDamager = NWNXPopObject();
187  data.iBludgeoning = NWNXPopInt();
188  data.iPierce = NWNXPopInt();
189  data.iSlash = NWNXPopInt();
190  data.iMagical = NWNXPopInt();
191  data.iAcid = NWNXPopInt();
192  data.iCold = NWNXPopInt();
193  data.iDivine = NWNXPopInt();
194  data.iElectrical = NWNXPopInt();
195  data.iFire = NWNXPopInt();
196  data.iNegative = NWNXPopInt();
197  data.iPositive = NWNXPopInt();
198  data.iSonic = NWNXPopInt();
199  data.iBase = NWNXPopInt();
200  data.iCustom1 = NWNXPopInt();
201  data.iCustom2 = NWNXPopInt();
202  data.iCustom3 = NWNXPopInt();
203  data.iCustom4 = NWNXPopInt();
204  data.iCustom5 = NWNXPopInt();
205  data.iCustom6 = NWNXPopInt();
206  data.iCustom7 = NWNXPopInt();
207  data.iCustom8 = NWNXPopInt();
208  data.iCustom9 = NWNXPopInt();
209  data.iCustom10 = NWNXPopInt();
210  data.iCustom11 = NWNXPopInt();
211  data.iCustom12 = NWNXPopInt();
212  data.iCustom13 = NWNXPopInt();
213  data.iCustom14 = NWNXPopInt();
214  data.iCustom15 = NWNXPopInt();
215  data.iCustom16 = NWNXPopInt();
216  data.iCustom17 = NWNXPopInt();
217  data.iCustom18 = NWNXPopInt();
218  data.iCustom19 = NWNXPopInt();
219  data.iSpellId = NWNXPopInt();
220  return data;
221 }
222 
224 {
225  NWNXPushInt(data.iCustom19);
226  NWNXPushInt(data.iCustom18);
227  NWNXPushInt(data.iCustom17);
228  NWNXPushInt(data.iCustom16);
229  NWNXPushInt(data.iCustom15);
230  NWNXPushInt(data.iCustom14);
231  NWNXPushInt(data.iCustom13);
232  NWNXPushInt(data.iCustom12);
233  NWNXPushInt(data.iCustom11);
234  NWNXPushInt(data.iCustom10);
235  NWNXPushInt(data.iCustom9);
236  NWNXPushInt(data.iCustom8);
237  NWNXPushInt(data.iCustom7);
238  NWNXPushInt(data.iCustom6);
239  NWNXPushInt(data.iCustom5);
240  NWNXPushInt(data.iCustom4);
241  NWNXPushInt(data.iCustom3);
242  NWNXPushInt(data.iCustom2);
243  NWNXPushInt(data.iCustom1);
244  NWNXPushInt(data.iBase);
245  NWNXPushInt(data.iSonic);
246  NWNXPushInt(data.iPositive);
247  NWNXPushInt(data.iNegative);
248  NWNXPushInt(data.iFire);
249  NWNXPushInt(data.iElectrical);
250  NWNXPushInt(data.iDivine);
251  NWNXPushInt(data.iCold);
252  NWNXPushInt(data.iAcid);
253  NWNXPushInt(data.iMagical);
254  NWNXPushInt(data.iSlash);
255  NWNXPushInt(data.iPierce);
256  NWNXPushInt(data.iBludgeoning);
257 
258  NWNXCall(NWNX_Damage, "SetDamageEventData");
259 }
260 
261 void NWNX_Damage_SetAttackEventScript(string sScript, object oOwner=OBJECT_INVALID)
262 {
263  NWNXPushObject(oOwner);
264  NWNXPushString(sScript);
265  NWNXPushString("ATTACK");
266  NWNXCall(NWNX_Damage, "SetEventScript");
267 }
268 
270 {
271  struct NWNX_Damage_AttackEventData data;
272  NWNXCall(NWNX_Damage, "GetAttackEventData");
273  data.oTarget = NWNXPopObject();
274  data.iBludgeoning = NWNXPopInt();
275  data.iPierce = NWNXPopInt();
276  data.iSlash = NWNXPopInt();
277  data.iMagical = NWNXPopInt();
278  data.iAcid = NWNXPopInt();
279  data.iCold = NWNXPopInt();
280  data.iDivine = NWNXPopInt();
281  data.iElectrical = NWNXPopInt();
282  data.iFire = NWNXPopInt();
283  data.iNegative = NWNXPopInt();
284  data.iPositive = NWNXPopInt();
285  data.iSonic = NWNXPopInt();
286  data.iBase = NWNXPopInt();
287  data.iCustom1 = NWNXPopInt();
288  data.iCustom2 = NWNXPopInt();
289  data.iCustom3 = NWNXPopInt();
290  data.iCustom4 = NWNXPopInt();
291  data.iCustom5 = NWNXPopInt();
292  data.iCustom6 = NWNXPopInt();
293  data.iCustom7 = NWNXPopInt();
294  data.iCustom8 = NWNXPopInt();
295  data.iCustom9 = NWNXPopInt();
296  data.iCustom10 = NWNXPopInt();
297  data.iCustom11 = NWNXPopInt();
298  data.iCustom12 = NWNXPopInt();
299  data.iCustom13 = NWNXPopInt();
300  data.iCustom14 = NWNXPopInt();
301  data.iCustom15 = NWNXPopInt();
302  data.iCustom16 = NWNXPopInt();
303  data.iCustom17 = NWNXPopInt();
304  data.iCustom18 = NWNXPopInt();
305  data.iCustom19 = NWNXPopInt();
306  data.iAttackNumber = NWNXPopInt();
307  data.iAttackResult = NWNXPopInt();
308  data.iWeaponAttackType = NWNXPopInt();
309  data.iSneakAttack = NWNXPopInt();
310  data.bKillingBlow = NWNXPopInt();
311  data.iAttackType = NWNXPopInt();
312  data.iToHitRoll = NWNXPopInt();
313  data.iToHitModifier = NWNXPopInt();
314  return data;
315 }
316 
318 {
319  NWNXPushInt(data.iSneakAttack);
320  NWNXPushInt(data.iAttackResult);
321  NWNXPushInt(data.iCustom19);
322  NWNXPushInt(data.iCustom18);
323  NWNXPushInt(data.iCustom17);
324  NWNXPushInt(data.iCustom16);
325  NWNXPushInt(data.iCustom15);
326  NWNXPushInt(data.iCustom14);
327  NWNXPushInt(data.iCustom13);
328  NWNXPushInt(data.iCustom12);
329  NWNXPushInt(data.iCustom11);
330  NWNXPushInt(data.iCustom10);
331  NWNXPushInt(data.iCustom9);
332  NWNXPushInt(data.iCustom8);
333  NWNXPushInt(data.iCustom7);
334  NWNXPushInt(data.iCustom6);
335  NWNXPushInt(data.iCustom5);
336  NWNXPushInt(data.iCustom4);
337  NWNXPushInt(data.iCustom3);
338  NWNXPushInt(data.iCustom2);
339  NWNXPushInt(data.iCustom1);
340  NWNXPushInt(data.iBase);
341  NWNXPushInt(data.iSonic);
342  NWNXPushInt(data.iPositive);
343  NWNXPushInt(data.iNegative);
344  NWNXPushInt(data.iFire);
345  NWNXPushInt(data.iElectrical);
346  NWNXPushInt(data.iDivine);
347  NWNXPushInt(data.iCold);
348  NWNXPushInt(data.iAcid);
349  NWNXPushInt(data.iMagical);
350  NWNXPushInt(data.iSlash);
351  NWNXPushInt(data.iPierce);
352  NWNXPushInt(data.iBludgeoning);
353  NWNXCall(NWNX_Damage, "SetAttackEventData");
354 }
355 
356 void NWNX_Damage_DealDamage(struct NWNX_Damage_DamageData data, object oTarget, object oSource, int iRanged = FALSE)
357 {
358  NWNXPushInt(iRanged);
359  NWNXPushInt(data.iPower);
360  NWNXPushInt(data.iCustom19);
361  NWNXPushInt(data.iCustom18);
362  NWNXPushInt(data.iCustom17);
363  NWNXPushInt(data.iCustom16);
364  NWNXPushInt(data.iCustom15);
365  NWNXPushInt(data.iCustom14);
366  NWNXPushInt(data.iCustom13);
367  NWNXPushInt(data.iCustom12);
368  NWNXPushInt(data.iCustom11);
369  NWNXPushInt(data.iCustom10);
370  NWNXPushInt(data.iCustom9);
371  NWNXPushInt(data.iCustom8);
372  NWNXPushInt(data.iCustom7);
373  NWNXPushInt(data.iCustom6);
374  NWNXPushInt(data.iCustom5);
375  NWNXPushInt(data.iCustom4);
376  NWNXPushInt(data.iCustom3);
377  NWNXPushInt(data.iCustom2);
378  NWNXPushInt(data.iCustom1);
379  NWNXPushInt(0);// Padding for Base Damage
380  NWNXPushInt(data.iSonic);
381  NWNXPushInt(data.iPositive);
382  NWNXPushInt(data.iNegative);
383  NWNXPushInt(data.iFire);
384  NWNXPushInt(data.iElectrical);
385  NWNXPushInt(data.iDivine);
386  NWNXPushInt(data.iCold);
387  NWNXPushInt(data.iAcid);
388  NWNXPushInt(data.iMagical);
389  NWNXPushInt(data.iSlash);
390  NWNXPushInt(data.iPierce);
391  NWNXPushInt(data.iBludgeoning);
392  NWNXPushObject(oTarget);
393  NWNXPushObject(oSource);
394  NWNXCall(NWNX_Damage, "DealDamage");
395 }
void NWNX_Damage_SetDamageEventData(struct NWNX_Damage_DamageEventData data)
Set Damage Event Data.
struct NWNX_Damage_AttackEventData NWNX_Damage_GetAttackEventData()
Get Attack Event Data.
struct NWNX_Damage_DamageEventData NWNX_Damage_GetDamageEventData()
Get Damage Event Data.
void NWNX_Damage_SetAttackEventScript(string sScript, object oOwner=OBJECT_INVALID)
Sets the script to run with an attack event.
void NWNX_Damage_DealDamage(struct NWNX_Damage_DamageData data, object oTarget, object oSource=OBJECT_SELF, int iRanged=FALSE)
Deal damage to a target.
void NWNX_Damage_SetAttackEventData(struct NWNX_Damage_AttackEventData data)
Set Attack Event Data.
void NWNX_Damage_SetDamageEventScript(string sScript, object oOwner=OBJECT_INVALID)
Sets the script to run with a damage event.
Attack Event Data.
Definition: nwnx_damage.nss:51
int iMagical
Magical damage.
Definition: nwnx_damage.nss:56
int iAttackType
65002=Attack of Opportunity, 65003=Riposte or a FeatID like KnockDown or some other special attack.
Definition: nwnx_damage.nss:89
int iCustom14
Custom14 damage.
Definition: nwnx_damage.nss:79
int iSneakAttack
0=neither, 1=sneak attack, 2=death attack, 3=both
Definition: nwnx_damage.nss:88
int iCustom5
Custom5 damage.
Definition: nwnx_damage.nss:70
int iToHitRoll
The to hit roll of the attack.
Definition: nwnx_damage.nss:91
int iCustom3
Custom3 damage.
Definition: nwnx_damage.nss:68
int iCustom11
Custom11 damage.
Definition: nwnx_damage.nss:76
int iAttackResult
1=hit, 2=parried, 3=critical hit, 4=miss, 5=resisted, 7=automatic hit, 8=concealed,...
Definition: nwnx_damage.nss:86
int iCustom6
Custom6 damage.
Definition: nwnx_damage.nss:71
int iCustom4
Custom4 damage.
Definition: nwnx_damage.nss:69
int iCustom10
Custom10 damage.
Definition: nwnx_damage.nss:75
int iSlash
Slashing damage.
Definition: nwnx_damage.nss:55
int iCustom7
Custom7 damage.
Definition: nwnx_damage.nss:72
int iCustom18
Custom18 damage.
Definition: nwnx_damage.nss:83
int iCustom8
Custom8 damage.
Definition: nwnx_damage.nss:73
int iPierce
Piercing damage.
Definition: nwnx_damage.nss:54
int iCustom2
Custom2 damage.
Definition: nwnx_damage.nss:67
int iCustom19
Custom19 damage.
Definition: nwnx_damage.nss:84
int bKillingBlow
TRUE if the hit is a killing blow.
Definition: nwnx_damage.nss:90
int iWeaponAttackType
1=main hand, 2=offhand, 3-5=creature, 6=extra(haste), 7=unarmed, 8=unarmed extra
Definition: nwnx_damage.nss:87
int iCustom15
Custom15 damage.
Definition: nwnx_damage.nss:80
int iAttackNumber
1-based index of the attack in current combat round
Definition: nwnx_damage.nss:85
int iDivine
Divine damage.
Definition: nwnx_damage.nss:59
int iCustom16
Custom16 damage.
Definition: nwnx_damage.nss:81
int iPositive
Positive damage.
Definition: nwnx_damage.nss:63
int iCustom12
Custom12 damage.
Definition: nwnx_damage.nss:77
int iCustom13
Custom13 damage.
Definition: nwnx_damage.nss:78
int iNegative
Negative damage.
Definition: nwnx_damage.nss:62
int iCustom1
Custom1 damage.
Definition: nwnx_damage.nss:66
int iBludgeoning
Bludgeoning damage.
Definition: nwnx_damage.nss:53
int iCustom9
Custom9 damage.
Definition: nwnx_damage.nss:74
int iElectrical
Electrical damage.
Definition: nwnx_damage.nss:60
int iCustom17
Custom17 damage.
Definition: nwnx_damage.nss:82
object oTarget
The target who took the damage.
Definition: nwnx_damage.nss:52
int iToHitModifier
The to hit modifier of the attack.
Definition: nwnx_damage.nss:92
Used for DealDamage.
Definition: nwnx_damage.nss:98
int iCold
Cold damage.
int iCustom7
Custom7 damage.
int iPower
For overcoming DR.
int iCustom15
Custom15 damage.
int iMagical
Magical damage.
int iCustom1
Custom1 damage.
int iCustom4
Custom4 damage.
int iCustom12
Custom12 damage.
int iDivine
Divine damage.
int iAcid
Acid damage.
int iCustom14
Custom14 damage.
int iElectrical
Electrical damage.
int iCustom18
Custom18 damage.
int iFire
Fire damage.
int iCustom17
Custom17 damage.
int iCustom10
Custom10 damage.
int iPositive
Positive damage.
int iNegative
Negative damage.
int iSonic
Sonic damage.
int iCustom16
Custom16 damage.
int iSlash
Slashing damage.
int iCustom19
Custom19 damage.
int iBludgeoning
Bludgeoning damage.
Definition: nwnx_damage.nss:99
int iCustom3
Custom3 damage.
int iCustom2
Custom2 damage.
int iCustom13
Custom13 damage.
int iCustom6
Custom6 damage.
int iPierce
Piercing damage.
int iCustom5
Custom5 damage.
int iCustom11
Custom11 damage.
int iCustom9
Custom9 damage.
int iCustom8
Custom8 damage.
Damage Event Data.
Definition: nwnx_damage.nss:11
int iCustom14
Custom14 damage.
Definition: nwnx_damage.nss:39
int iDivine
Divine damage.
Definition: nwnx_damage.nss:19
int iCustom11
Custom11 damage.
Definition: nwnx_damage.nss:36
int iCustom13
Custom13 damage.
Definition: nwnx_damage.nss:38
int iCustom15
Custom15 damage.
Definition: nwnx_damage.nss:40
int iBludgeoning
Bludgeoning damage.
Definition: nwnx_damage.nss:13
int iCustom2
Custom2 damage.
Definition: nwnx_damage.nss:27
int iMagical
Magical damage.
Definition: nwnx_damage.nss:16
int iCustom4
Custom4 damage.
Definition: nwnx_damage.nss:29
int iCustom9
Custom9 damage.
Definition: nwnx_damage.nss:34
int iCustom19
Custom19 damage.
Definition: nwnx_damage.nss:44
int iCustom5
Custom5 damage.
Definition: nwnx_damage.nss:30
int iPierce
Piercing damage.
Definition: nwnx_damage.nss:14
int iCustom18
Custom18 damage.
Definition: nwnx_damage.nss:43
int iCustom6
Custom6 damage.
Definition: nwnx_damage.nss:31
int iNegative
Negative damage.
Definition: nwnx_damage.nss:22
int iCustom7
Custom7 damage.
Definition: nwnx_damage.nss:32
int iSpellId
The spell id associated with the damage or -1 if not known.
Definition: nwnx_damage.nss:45
int iCustom16
Custom16 damage.
Definition: nwnx_damage.nss:41
int iElectrical
Electrical damage.
Definition: nwnx_damage.nss:20
int iCustom8
Custom8 damage.
Definition: nwnx_damage.nss:33
int iCustom10
Custom10 damage.
Definition: nwnx_damage.nss:35
int iCustom3
Custom3 damage.
Definition: nwnx_damage.nss:28
int iCustom17
Custom17 damage.
Definition: nwnx_damage.nss:42
object oDamager
The object that inflicted the damage.
Definition: nwnx_damage.nss:12
int iCustom12
Custom12 damage.
Definition: nwnx_damage.nss:37
int iSlash
Slashing damage.
Definition: nwnx_damage.nss:15
int iPositive
Positive damage.
Definition: nwnx_damage.nss:23
int iCustom1
Custom1 damage.
Definition: nwnx_damage.nss:26