Difference between revisions of "CreateBlob"

From King Arthur's Gold Wiki
Jump to: navigation, search
 
(6 intermediate revisions by the same user not shown)
Line 1: Line 1:
 
<onlyinclude>
 
<onlyinclude>
CreateBlob will create a [[CBlob]] with the given factory and the given path to a config file defining the [[CBlob]].
+
Creates a [[CBlob]] with the given factory and the given path to a config file defining the [[CBlob]].
It will return a reference to the [[CBlob]].
+
 
 +
Returns a reference to the created [[CBlob]].
 
</onlyinclude>
 
</onlyinclude>
 +
 
For factoryName, either pass genericitem or genericblock. Use genericblock if the block needs to settle on the map grid, otherwise use genericitem.
 
For factoryName, either pass genericitem or genericblock. Use genericblock if the block needs to settle on the map grid, otherwise use genericitem.
  
 
There are two variants, one of which will also accept a team number and position vector.
 
There are two variants, one of which will also accept a team number and position vector.
  
<pre>[[CBlob]]@ CreateBlob( const string &factoryName, const string &configFilename )
+
<syntaxhighlight lang="cpp">CBlob@ CreateBlob( const string &factoryName, const string &configFilename )
[[CBlob]]@ CreateBlob( const string &factoryName, const string &configFilename, u16 team, Vec2f Position )</pre>
+
CBlob@ CreateBlob( const string &factoryName, const string &configFilename, u16 team, Vec2f Position )</syntaxhighlight>
  
  
 
Example from Entities/Characters/Scripts/ArcherLogic.as:
 
Example from Entities/Characters/Scripts/ArcherLogic.as:
<pre>[[CBlob]]@ arrow = CreateBlob( "genericitem", "Entities/Items/Arrow.cfg" );</pre>
+
<syntaxhighlight lang="cpp">CBlob@ arrow = CreateBlob( "genericitem", "Entities/Items/Arrow.cfg" );</syntaxhighlight>
  
  
 
Example from Entities/Workshops/WorkshopTasks.as:
 
Example from Entities/Workshops/WorkshopTasks.as:
<pre>[[CBlob]] @shopBlob = CreateBlob( "genericblock", "Entities/Workshops/Base/WorkshopWAR.cfg", 0, this.getBlob().getPosition() );</pre>
+
<syntaxhighlight lang="cpp">CBlob@ shopBlob = CreateBlob( "genericblock", "Entities/Workshops/Base/WorkshopWAR.cfg", 0, this.getBlob().getPosition() );</syntaxhighlight>
  
 
[[Category:Scripting]]
 
[[Category:Scripting]]
 
[[Category:Global Functions]]
 
[[Category:Global Functions]]

Latest revision as of 15:25, 17 August 2012

Creates a CBlob with the given factory and the given path to a config file defining the CBlob.

Returns a reference to the created CBlob.


For factoryName, either pass genericitem or genericblock. Use genericblock if the block needs to settle on the map grid, otherwise use genericitem.

There are two variants, one of which will also accept a team number and position vector.

CBlob@ CreateBlob( const string &factoryName, const string &configFilename )
CBlob@ CreateBlob( const string &factoryName, const string &configFilename, u16 team, Vec2f Position )


Example from Entities/Characters/Scripts/ArcherLogic.as:

CBlob@ arrow = CreateBlob( "genericitem", "Entities/Items/Arrow.cfg" );


Example from Entities/Workshops/WorkshopTasks.as:

CBlob@ shopBlob = CreateBlob( "genericblock", "Entities/Workshops/Base/WorkshopWAR.cfg", 0, this.getBlob().getPosition() );