Difference between revisions of "CreatePool"

From Dragon Age Toolset Wiki
Jump to: navigation, search
(trying out the dafunction formatting)
m (looks okay, removing tag)
 
(8 intermediate revisions by 2 users not shown)
Line 1: Line 1:
Reserves a block of memory for a fixed number of a particular type of creature
+
{{dafunction
 
+
|name=CreatePool
<div style="background:#DDDDDD;">
+
|brief=Create a pool of creatures while loading an area. It should be used under EVENT_TYPE_AREALOAD_PRELOADEXIT. When creatures die or are set inactive they will automatically return to the pool.
[[int]] CreatePool (
+
|param1type=resource
:: [[resource]] rTemplate,
+
|param1name=rTemplate
:: [[int]] nPoolSize
+
|param1desc=The template to use
:)
+
|param2type=int
</div>
+
|param2name=nPoolSize
 
+
|param2desc=Number of creatures of this type to create
<dl>
+
|returntype=int
<dt>Parameters:
+
|returndesc=TRUE if successful
<dd>
+
|sourcefile=script.ldf
<dl>
+
|sourcemodule=
<dt>rTemplate<dd>The template to use
+
}}
<dt>nPoolSize<dd>Number of creatures of this type to create
+
</dl>
+
<dt>Returns:
+
<dd>TRUE if successful
+
<dt>Source:
+
<dd>[[scripts.ldf]]
+
</dl>
+
  
 
== Description ==
 
== Description ==
 +
<!-- This section contains the full description from the functions comments. Do not change unless you are confident these are incomplete or incorrect. -->
  
 
Creatures of this type that are spawned with the CreateObject function in this area will use this block of memory, and when creatures of this type die or are set inactive their memory space will automatically be returned to the pool.
 
Creatures of this type that are spawned with the CreateObject function in this area will use this block of memory, and when creatures of this type die or are set inactive their memory space will automatically be returned to the pool.
Line 32: Line 26:
  
 
Pool size should be at least twice the number of enemies from that will ever be active simultaneously.
 
Pool size should be at least twice the number of enemies from that will ever be active simultaneously.
 +
 +
<!-- == Remarks == -->
 +
<!-- This section contains additional comments, observations and known issues. -->
  
 
<!-- == Examples == -->
 
<!-- == Examples == -->
 +
<!-- This section contains examples transcluded from the snippet library. -->
  
<!-- == Known bugs == -->
+
== See also ==
 
+
<!-- This section contains links to articles, functions or constant groups. -->
<!-- == See also == -->
+
[[CreateObject]], [[SetObjectActive]]
 
+
[[Category: Object functions]]
[[Category:Scripts]]
+

Latest revision as of 21:25, 24 February 2010

Create a pool of creatures while loading an area. It should be used under EVENT_TYPE_AREALOAD_PRELOADEXIT. When creatures die or are set inactive they will automatically return to the pool.

int CreatePool(
resource rTemplate,
int nPoolSize
);
Parameters:
rTemplate
The template to use
nPoolSize
Number of creatures of this type to create
Returns:

TRUE if successful

Source:

script.ldf

Description

Creatures of this type that are spawned with the CreateObject function in this area will use this block of memory, and when creatures of this type die or are set inactive their memory space will automatically be returned to the pool.

The purpose of this function is to allow for endlessly respawning monsters, or similar situations.

It should be used under EVENT_TYPE_AREALOAD_PRELOADEXIT. When creatures die or are set inactive they will automatically return to the pool.

Note that pool creatures should have "no permanent death" enabled, otherwise certain effects (such as decapitation) will remain on them when they respawn.

Pool size should be at least twice the number of enemies from that will ever be active simultaneously.


See also

CreateObject, SetObjectActive