NWNX:EE  8193.37.15
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;
92  int iToHitRoll;
94 };
95 
99 {
101  int iPierce;
102  int iSlash;
103  int iMagical;
104  int iAcid;
105  int iCold;
106  int iDivine;
108  int iFire;
109  int iNegative;
110  int iPositive;
111  int iSonic;
112  int iCustom1;
113  int iCustom2;
114  int iCustom3;
115  int iCustom4;
116  int iCustom5;
117  int iCustom6;
118  int iCustom7;
119  int iCustom8;
120  int iCustom9;
121  int iCustom10;
122  int iCustom11;
123  int iCustom12;
124  int iCustom13;
125  int iCustom14;
126  int iCustom15;
127  int iCustom16;
128  int iCustom17;
129  int iCustom18;
130  int iCustom19;
131  int iPower;
132 };
133 
137 void NWNX_Damage_SetDamageEventScript(string sScript, object oOwner = OBJECT_INVALID);
138 
143 
148 
152 void NWNX_Damage_SetAttackEventScript(string sScript, object oOwner = OBJECT_INVALID);
153 
158 
164 
171 void NWNX_Damage_DealDamage(struct NWNX_Damage_DamageData data, object oTarget, object oSource = OBJECT_SELF, int iRanged = FALSE);
172 
174 
175 void NWNX_Damage_SetDamageEventScript(string sScript, object oOwner=OBJECT_INVALID)
176 {
177  NWNXPushObject(oOwner);
178  NWNXPushString(sScript);
179  NWNXPushString("DAMAGE");
180  NWNXCall(NWNX_Damage, "SetEventScript");
181 }
182 
184 {
185  struct NWNX_Damage_DamageEventData data;
186  NWNXCall(NWNX_Damage, "GetDamageEventData");
187  data.oDamager = NWNXPopObject();
188  data.iBludgeoning = NWNXPopInt();
189  data.iPierce = NWNXPopInt();
190  data.iSlash = NWNXPopInt();
191  data.iMagical = NWNXPopInt();
192  data.iAcid = NWNXPopInt();
193  data.iCold = NWNXPopInt();
194  data.iDivine = NWNXPopInt();
195  data.iElectrical = NWNXPopInt();
196  data.iFire = NWNXPopInt();
197  data.iNegative = NWNXPopInt();
198  data.iPositive = NWNXPopInt();
199  data.iSonic = NWNXPopInt();
200  data.iBase = NWNXPopInt();
201  data.iCustom1 = NWNXPopInt();
202  data.iCustom2 = NWNXPopInt();
203  data.iCustom3 = NWNXPopInt();
204  data.iCustom4 = NWNXPopInt();
205  data.iCustom5 = NWNXPopInt();
206  data.iCustom6 = NWNXPopInt();
207  data.iCustom7 = NWNXPopInt();
208  data.iCustom8 = NWNXPopInt();
209  data.iCustom9 = NWNXPopInt();
210  data.iCustom10 = NWNXPopInt();
211  data.iCustom11 = NWNXPopInt();
212  data.iCustom12 = NWNXPopInt();
213  data.iCustom13 = NWNXPopInt();
214  data.iCustom14 = NWNXPopInt();
215  data.iCustom15 = NWNXPopInt();
216  data.iCustom16 = NWNXPopInt();
217  data.iCustom17 = NWNXPopInt();
218  data.iCustom18 = NWNXPopInt();
219  data.iCustom19 = NWNXPopInt();
220  data.iSpellId = NWNXPopInt();
221  return data;
222 }
223 
225 {
226  NWNXPushInt(data.iCustom19);
227  NWNXPushInt(data.iCustom18);
228  NWNXPushInt(data.iCustom17);
229  NWNXPushInt(data.iCustom16);
230  NWNXPushInt(data.iCustom15);
231  NWNXPushInt(data.iCustom14);
232  NWNXPushInt(data.iCustom13);
233  NWNXPushInt(data.iCustom12);
234  NWNXPushInt(data.iCustom11);
235  NWNXPushInt(data.iCustom10);
236  NWNXPushInt(data.iCustom9);
237  NWNXPushInt(data.iCustom8);
238  NWNXPushInt(data.iCustom7);
239  NWNXPushInt(data.iCustom6);
240  NWNXPushInt(data.iCustom5);
241  NWNXPushInt(data.iCustom4);
242  NWNXPushInt(data.iCustom3);
243  NWNXPushInt(data.iCustom2);
244  NWNXPushInt(data.iCustom1);
245  NWNXPushInt(data.iBase);
246  NWNXPushInt(data.iSonic);
247  NWNXPushInt(data.iPositive);
248  NWNXPushInt(data.iNegative);
249  NWNXPushInt(data.iFire);
250  NWNXPushInt(data.iElectrical);
251  NWNXPushInt(data.iDivine);
252  NWNXPushInt(data.iCold);
253  NWNXPushInt(data.iAcid);
254  NWNXPushInt(data.iMagical);
255  NWNXPushInt(data.iSlash);
256  NWNXPushInt(data.iPierce);
257  NWNXPushInt(data.iBludgeoning);
258 
259  NWNXCall(NWNX_Damage, "SetDamageEventData");
260 }
261 
262 void NWNX_Damage_SetAttackEventScript(string sScript, object oOwner=OBJECT_INVALID)
263 {
264  NWNXPushObject(oOwner);
265  NWNXPushString(sScript);
266  NWNXPushString("ATTACK");
267  NWNXCall(NWNX_Damage, "SetEventScript");
268 }
269 
271 {
272  struct NWNX_Damage_AttackEventData data;
273  NWNXCall(NWNX_Damage, "GetAttackEventData");
274  data.oTarget = NWNXPopObject();
275  data.iBludgeoning = NWNXPopInt();
276  data.iPierce = NWNXPopInt();
277  data.iSlash = NWNXPopInt();
278  data.iMagical = NWNXPopInt();
279  data.iAcid = NWNXPopInt();
280  data.iCold = NWNXPopInt();
281  data.iDivine = NWNXPopInt();
282  data.iElectrical = NWNXPopInt();
283  data.iFire = NWNXPopInt();
284  data.iNegative = NWNXPopInt();
285  data.iPositive = NWNXPopInt();
286  data.iSonic = NWNXPopInt();
287  data.iBase = NWNXPopInt();
288  data.iCustom1 = NWNXPopInt();
289  data.iCustom2 = NWNXPopInt();
290  data.iCustom3 = NWNXPopInt();
291  data.iCustom4 = NWNXPopInt();
292  data.iCustom5 = NWNXPopInt();
293  data.iCustom6 = NWNXPopInt();
294  data.iCustom7 = NWNXPopInt();
295  data.iCustom8 = NWNXPopInt();
296  data.iCustom9 = NWNXPopInt();
297  data.iCustom10 = NWNXPopInt();
298  data.iCustom11 = NWNXPopInt();
299  data.iCustom12 = NWNXPopInt();
300  data.iCustom13 = NWNXPopInt();
301  data.iCustom14 = NWNXPopInt();
302  data.iCustom15 = NWNXPopInt();
303  data.iCustom16 = NWNXPopInt();
304  data.iCustom17 = NWNXPopInt();
305  data.iCustom18 = NWNXPopInt();
306  data.iCustom19 = NWNXPopInt();
307  data.iAttackNumber = NWNXPopInt();
308  data.iAttackResult = NWNXPopInt();
309  data.iWeaponAttackType = NWNXPopInt();
310  data.iSneakAttack = NWNXPopInt();
311  data.bKillingBlow = NWNXPopInt();
312  data.iAttackType = NWNXPopInt();
313  data.iToHitRoll = NWNXPopInt();
314  data.iToHitModifier = NWNXPopInt();
315  data.bRangedAttack = NWNXPopInt();
316  return data;
317 }
318 
320 {
321  NWNXPushInt(data.iSneakAttack);
322  NWNXPushInt(data.iAttackResult);
323  NWNXPushInt(data.iCustom19);
324  NWNXPushInt(data.iCustom18);
325  NWNXPushInt(data.iCustom17);
326  NWNXPushInt(data.iCustom16);
327  NWNXPushInt(data.iCustom15);
328  NWNXPushInt(data.iCustom14);
329  NWNXPushInt(data.iCustom13);
330  NWNXPushInt(data.iCustom12);
331  NWNXPushInt(data.iCustom11);
332  NWNXPushInt(data.iCustom10);
333  NWNXPushInt(data.iCustom9);
334  NWNXPushInt(data.iCustom8);
335  NWNXPushInt(data.iCustom7);
336  NWNXPushInt(data.iCustom6);
337  NWNXPushInt(data.iCustom5);
338  NWNXPushInt(data.iCustom4);
339  NWNXPushInt(data.iCustom3);
340  NWNXPushInt(data.iCustom2);
341  NWNXPushInt(data.iCustom1);
342  NWNXPushInt(data.iBase);
343  NWNXPushInt(data.iSonic);
344  NWNXPushInt(data.iPositive);
345  NWNXPushInt(data.iNegative);
346  NWNXPushInt(data.iFire);
347  NWNXPushInt(data.iElectrical);
348  NWNXPushInt(data.iDivine);
349  NWNXPushInt(data.iCold);
350  NWNXPushInt(data.iAcid);
351  NWNXPushInt(data.iMagical);
352  NWNXPushInt(data.iSlash);
353  NWNXPushInt(data.iPierce);
354  NWNXPushInt(data.iBludgeoning);
355  NWNXCall(NWNX_Damage, "SetAttackEventData");
356 }
357 
358 void NWNX_Damage_DealDamage(struct NWNX_Damage_DamageData data, object oTarget, object oSource, int iRanged = FALSE)
359 {
360  NWNXPushInt(iRanged);
361  NWNXPushInt(data.iPower);
362  NWNXPushInt(data.iCustom19);
363  NWNXPushInt(data.iCustom18);
364  NWNXPushInt(data.iCustom17);
365  NWNXPushInt(data.iCustom16);
366  NWNXPushInt(data.iCustom15);
367  NWNXPushInt(data.iCustom14);
368  NWNXPushInt(data.iCustom13);
369  NWNXPushInt(data.iCustom12);
370  NWNXPushInt(data.iCustom11);
371  NWNXPushInt(data.iCustom10);
372  NWNXPushInt(data.iCustom9);
373  NWNXPushInt(data.iCustom8);
374  NWNXPushInt(data.iCustom7);
375  NWNXPushInt(data.iCustom6);
376  NWNXPushInt(data.iCustom5);
377  NWNXPushInt(data.iCustom4);
378  NWNXPushInt(data.iCustom3);
379  NWNXPushInt(data.iCustom2);
380  NWNXPushInt(data.iCustom1);
381  NWNXPushInt(0);// Padding for Base Damage
382  NWNXPushInt(data.iSonic);
383  NWNXPushInt(data.iPositive);
384  NWNXPushInt(data.iNegative);
385  NWNXPushInt(data.iFire);
386  NWNXPushInt(data.iElectrical);
387  NWNXPushInt(data.iDivine);
388  NWNXPushInt(data.iCold);
389  NWNXPushInt(data.iAcid);
390  NWNXPushInt(data.iMagical);
391  NWNXPushInt(data.iSlash);
392  NWNXPushInt(data.iPierce);
393  NWNXPushInt(data.iBludgeoning);
394  NWNXPushObject(oTarget);
395  NWNXPushObject(oSource);
396  NWNXCall(NWNX_Damage, "DealDamage");
397 }
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:91
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:92
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 it is a ranged attack.
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:93
Used for DealDamage.
Definition: nwnx_damage.nss:99
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.
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