NWNX:EE  8193.36.12
nwnx_encounter.nss
Go to the documentation of this file.
1 #include "nwnx"
6 
7 const string NWNX_Encounter = "NWNX_Encounter";
8 
11 {
12  string resref;
14  int unique;
15  int alreadyUsed; //< Creature has already been used.
16 };
17 
20 void NWNX_Encounter_Destroy(object encounter);
21 
26 
32 
37 void NWNX_Encounter_SetEncounterCreatureByIndex(object encounter, int index, struct NWNX_Encounter_CreatureListEntry creatureEntry);
38 
42 int NWNX_Encounter_GetFactionId(object encounter);
43 
47 void NWNX_Encounter_SetFactionId(object encounter, int factionId);
48 
52 int NWNX_Encounter_GetPlayerTriggeredOnly(object encounter);
53 
57 void NWNX_Encounter_SetPlayerTriggeredOnly(object encounter, int playerTriggeredOnly);
58 
62 int NWNX_Encounter_GetCanReset(object encounter);
63 
67 void NWNX_Encounter_SetCanReset(object encounter, int reset);
68 
72 int NWNX_Encounter_GetResetTime(object encounter);
73 
77 void NWNX_Encounter_SetResetTime(object encounter, int resetTime);
78 
82 int NWNX_Encounter_GetNumberOfSpawnPoints(object encounter);
83 
88 location NWNX_Encounter_GetSpawnPointByIndex(object encounter, int index);
89 
93 int NWNX_Encounter_GetMinNumSpawned(object encounter);
94 
98 int NWNX_Encounter_GetMaxNumSpawned(object encounter);
99 
103 int NWNX_Encounter_GetCurrentNumSpawned(object encounter);
104 
108 string NWNX_Encounter_GetGeometry(object oEncounter);
109 
119 void NWNX_Encounter_SetGeometry(object oTrigger, string sGeometry);
120 
122 
123 void NWNX_Encounter_Destroy(object encounter)
124 {
125  string sFunc = "Destroy";
126 
127  NWNX_PushArgumentObject(encounter);
128  NWNX_CallFunction(NWNX_Encounter, sFunc);
129 }
130 
132 {
133  string sFunc = "GetNumberOfCreaturesInEncounterList";
134 
135  NWNX_PushArgumentObject(encounter);
136  NWNX_CallFunction(NWNX_Encounter, sFunc);
137 
138  return NWNX_GetReturnValueInt();
139 }
140 
142 {
143  string sFunc = "GetEncounterCreatureByIndex";
144  struct NWNX_Encounter_CreatureListEntry creatureEntry;
145 
146  NWNX_PushArgumentInt(index);
147  NWNX_PushArgumentObject(encounter);
148 
149  NWNX_CallFunction(NWNX_Encounter, sFunc);
150 
151  creatureEntry.alreadyUsed = NWNX_GetReturnValueInt();
152  creatureEntry.unique = NWNX_GetReturnValueInt();
153  creatureEntry.challengeRating = NWNX_GetReturnValueFloat();
154  creatureEntry.resref = NWNX_GetReturnValueString();
155 
156  return creatureEntry;
157 }
158 
159 void NWNX_Encounter_SetEncounterCreatureByIndex(object encounter, int index, struct NWNX_Encounter_CreatureListEntry creatureEntry)
160 {
161  string sFunc = "SetEncounterCreatureByIndex";
162 
163  NWNX_PushArgumentInt(creatureEntry.alreadyUsed);
164  NWNX_PushArgumentInt(creatureEntry.unique);
166  NWNX_PushArgumentString(creatureEntry.resref);
167  NWNX_PushArgumentInt(index);
168  NWNX_PushArgumentObject(encounter);
169 
170  NWNX_CallFunction(NWNX_Encounter, sFunc);
171 }
172 
173 int NWNX_Encounter_GetFactionId(object encounter)
174 {
175  string sFunc = "GetFactionId";
176 
177  NWNX_PushArgumentObject(encounter);
178  NWNX_CallFunction(NWNX_Encounter, sFunc);
179 
180  return NWNX_GetReturnValueInt();
181 }
182 
183 void NWNX_Encounter_SetFactionId(object encounter, int factionId)
184 {
185  string sFunc = "SetFactionId";
186 
187  NWNX_PushArgumentInt(factionId);
188  NWNX_PushArgumentObject(encounter);
189 
190  NWNX_CallFunction(NWNX_Encounter, sFunc);
191 }
192 
194 {
195  string sFunc = "GetPlayerTriggeredOnly";
196 
197  NWNX_PushArgumentObject(encounter);
198  NWNX_CallFunction(NWNX_Encounter, sFunc);
199 
200  return NWNX_GetReturnValueInt();
201 }
202 
203 void NWNX_Encounter_SetPlayerTriggeredOnly(object encounter, int playerTriggeredOnly)
204 {
205  string sFunc = "SetPlayerTriggeredOnly";
206 
207  NWNX_PushArgumentInt(playerTriggeredOnly);
208  NWNX_PushArgumentObject(encounter);
209 
210  NWNX_CallFunction(NWNX_Encounter, sFunc);
211 }
212 
213 int NWNX_Encounter_GetCanReset(object encounter)
214 {
215  string sFunc = "GetCanReset";
216 
217  NWNX_PushArgumentObject(encounter);
218  NWNX_CallFunction(NWNX_Encounter, sFunc);
219 
220  return NWNX_GetReturnValueInt();
221 }
222 
223 void NWNX_Encounter_SetCanReset(object encounter, int reset)
224 {
225  string sFunc = "SetCanReset";
226 
227  NWNX_PushArgumentInt(reset);
228  NWNX_PushArgumentObject(encounter);
229 
230  NWNX_CallFunction(NWNX_Encounter, sFunc);
231 }
232 
233 int NWNX_Encounter_GetResetTime(object encounter)
234 {
235  string sFunc = "GetResetTime";
236 
237  NWNX_PushArgumentObject(encounter);
238  NWNX_CallFunction(NWNX_Encounter, sFunc);
239 
240  return NWNX_GetReturnValueInt();
241 }
242 
243 void NWNX_Encounter_SetResetTime(object encounter, int resetTime)
244 {
245  string sFunc = "SetResetTime";
246 
247  NWNX_PushArgumentInt(resetTime);
248  NWNX_PushArgumentObject(encounter);
249 
250  NWNX_CallFunction(NWNX_Encounter, sFunc);
251 }
252 
254 {
255  string sFunc = "GetNumberOfSpawnPoints";
256 
257  NWNX_PushArgumentObject(encounter);
258  NWNX_CallFunction(NWNX_Encounter, sFunc);
259 
260  return NWNX_GetReturnValueInt();
261 }
262 
263 location NWNX_Encounter_GetSpawnPointByIndex(object encounter, int index)
264 {
265  string sFunc = "GetSpawnPointByIndex";
266 
267  NWNX_PushArgumentInt(index);
268  NWNX_PushArgumentObject(encounter);
269  NWNX_CallFunction(NWNX_Encounter, sFunc);
270 
271  float o = NWNX_GetReturnValueFloat();
272  float z = NWNX_GetReturnValueFloat();
273  float y = NWNX_GetReturnValueFloat();
274  float x = NWNX_GetReturnValueFloat();
275 
276  return Location(GetArea(encounter), Vector(x, y, z), o);
277 }
278 
279 int NWNX_Encounter_GetMinNumSpawned(object encounter)
280 {
281  string sFunc = "GetMinNumSpawned";
282 
283  NWNX_PushArgumentObject(encounter);
284  NWNX_CallFunction(NWNX_Encounter, sFunc);
285 
286  return NWNX_GetReturnValueInt();
287 }
288 
289 int NWNX_Encounter_GetMaxNumSpawned(object encounter)
290 {
291  string sFunc = "GetMaxNumSpawned";
292 
293  NWNX_PushArgumentObject(encounter);
294  NWNX_CallFunction(NWNX_Encounter, sFunc);
295 
296  return NWNX_GetReturnValueInt();
297 }
298 
300 {
301  string sFunc = "GetCurrentNumSpawned";
302 
303  NWNX_PushArgumentObject(encounter);
304  NWNX_CallFunction(NWNX_Encounter, sFunc);
305 
306  return NWNX_GetReturnValueInt();
307 }
308 
309 string NWNX_Encounter_GetGeometry(object oEncounter)
310 {
311  string sFunc = "GetGeometry";
312 
313  NWNX_PushArgumentObject(oEncounter);
314  NWNX_CallFunction(NWNX_Encounter, sFunc);
315 
316  return NWNX_GetReturnValueString();
317 }
318 
319 void NWNX_Encounter_SetGeometry(object oEncounter, string sGeometry)
320 {
321  string sFunc = "SetGeometry";
322 
323  NWNX_PushArgumentString(sGeometry);
324  NWNX_PushArgumentObject(oEncounter);
325  NWNX_CallFunction(NWNX_Encounter, sFunc);
326 }
NWNX_Encounter_GetEncounterCreatureByIndex
struct NWNX_Encounter_CreatureListEntry NWNX_Encounter_GetEncounterCreatureByIndex(object encounter, int index)
Gets the encounter creature list entry at the specified index.
Definition: nwnx_encounter.nss:141
NWNX_Encounter_GetNumberOfSpawnPoints
int NWNX_Encounter_GetNumberOfSpawnPoints(object encounter)
Get the number of spawn points of encounter.
Definition: nwnx_encounter.nss:253
NWNX_Encounter_SetGeometry
void NWNX_Encounter_SetGeometry(object oTrigger, string sGeometry)
Set the geometry of an encounter with a list of vertex positions.
Definition: nwnx_encounter.nss:319
NWNX_GetReturnValueInt
int NWNX_GetReturnValueInt()
Returns the specified type from the c++ side.
Definition: nwnx.nss:94
NWNX_Encounter_SetResetTime
void NWNX_Encounter_SetResetTime(object encounter, int resetTime)
Set the reset time of encounter.
Definition: nwnx_encounter.nss:243
NWNX_Encounter_SetPlayerTriggeredOnly
void NWNX_Encounter_SetPlayerTriggeredOnly(object encounter, int playerTriggeredOnly)
Set if encounter is player triggered only.
Definition: nwnx_encounter.nss:203
NWNX_Encounter_GetFactionId
int NWNX_Encounter_GetFactionId(object encounter)
Get the faction id of encounter.
Definition: nwnx_encounter.nss:173
NWNX_Encounter_GetPlayerTriggeredOnly
int NWNX_Encounter_GetPlayerTriggeredOnly(object encounter)
Get if encounter is player triggered only.
Definition: nwnx_encounter.nss:193
NWNX_Encounter_CreatureListEntry
A creature list entry for an encounter.
Definition: nwnx_encounter.nss:10
NWNX_Encounter_GetCurrentNumSpawned
int NWNX_Encounter_GetCurrentNumSpawned(object encounter)
Get the current number of creatures that are spawned and alive.
Definition: nwnx_encounter.nss:299
NWNX_GetReturnValueFloat
float NWNX_GetReturnValueFloat()
Returns the specified type from the c++ side.
Definition: nwnx.nss:99
NWNX_CallFunction
void NWNX_CallFunction(string pluginName, string functionName)
Scripting interface to NWNX.
Definition: nwnx.nss:54
NWNX_Encounter_GetResetTime
int NWNX_Encounter_GetResetTime(object encounter)
Get the reset time of encounter.
Definition: nwnx_encounter.nss:233
NWNX_GetReturnValueString
string NWNX_GetReturnValueString()
Returns the specified type from the c++ side.
Definition: nwnx.nss:109
NWNX_PushArgumentString
void NWNX_PushArgumentString(string value)
Pushes the specified type to the c++ side.
Definition: nwnx.nss:74
NWNX_Encounter_GetNumberOfCreaturesInEncounterList
int NWNX_Encounter_GetNumberOfCreaturesInEncounterList(object encounter)
Get the number of creatures in the encounter list.
Definition: nwnx_encounter.nss:131
NWNX_Encounter_GetCanReset
int NWNX_Encounter_GetCanReset(object encounter)
Get if the encounter respawns or not.
Definition: nwnx_encounter.nss:213
NWNX_PushArgumentObject
void NWNX_PushArgumentObject(object value)
Pushes the specified type to the c++ side.
Definition: nwnx.nss:69
NWNX_Encounter_Destroy
void NWNX_Encounter_Destroy(object encounter)
Immediately destroys the specified encounter object.
Definition: nwnx_encounter.nss:123
NWNX_PushArgumentInt
void NWNX_PushArgumentInt(int value)
Pushes the specified type to the c++ side.
Definition: nwnx.nss:59
NWNX_Encounter_CreatureListEntry::challengeRating
float challengeRating
The challenge rating.
Definition: nwnx_encounter.nss:13
NWNX_Encounter_SetEncounterCreatureByIndex
void NWNX_Encounter_SetEncounterCreatureByIndex(object encounter, int index, struct NWNX_Encounter_CreatureListEntry creatureEntry)
Set the encounter creature list entry at the specified index.
Definition: nwnx_encounter.nss:159
NWNX_Encounter_CreatureListEntry::unique
int unique
Creature will be unique to the encounter.
Definition: nwnx_encounter.nss:14
NWNX_Encounter_CreatureListEntry::resref
string resref
The resref.
Definition: nwnx_encounter.nss:12
NWNX_Encounter_CreatureListEntry::alreadyUsed
int alreadyUsed
Definition: nwnx_encounter.nss:15
NWNX_Encounter_GetSpawnPointByIndex
location NWNX_Encounter_GetSpawnPointByIndex(object encounter, int index)
Gets the spawn point list entry at the specified index.
Definition: nwnx_encounter.nss:263
NWNX_Encounter_SetFactionId
void NWNX_Encounter_SetFactionId(object encounter, int factionId)
Set the faction id of encounter.
Definition: nwnx_encounter.nss:183
NWNX_PushArgumentFloat
void NWNX_PushArgumentFloat(float value)
Pushes the specified type to the c++ side.
Definition: nwnx.nss:64
NWNX_Encounter_GetMinNumSpawned
int NWNX_Encounter_GetMinNumSpawned(object encounter)
Get the minimum amount of creatures that encounter will spawn.
Definition: nwnx_encounter.nss:279
NWNX_Encounter_GetGeometry
string NWNX_Encounter_GetGeometry(object oEncounter)
Get the geometry of an encounter.
Definition: nwnx_encounter.nss:309
NWNX_Encounter_GetMaxNumSpawned
int NWNX_Encounter_GetMaxNumSpawned(object encounter)
Get the maximum amount of creatures that encounter will spawn.
Definition: nwnx_encounter.nss:289
NWNX_Encounter_SetCanReset
void NWNX_Encounter_SetCanReset(object encounter, int reset)
Set if the encounter respawns or not.
Definition: nwnx_encounter.nss:223