Jump to content

Home

spawning many placeables once


newbiemodder

Recommended Posts

Hey all you scripters out there, I have a question. I have this script from the tutorials section on spawning placeables once, compliments of RedHawke I believe

 

void main() {

 object oContainer=GetObjectByTag("spawned_container_tag");
 if (oContainer==OBJECT_INVALID) {
   vector vContainer=Vector (0.0, 0.0, 0.0);
   location lContainer=Location(vContainer, 0.0);
   oContainer= CreateObject(OBJECT_TYPE_PLACEABLE, "container_template", lContainer);
   CreateItemOnObject("item_template", oContainer); 
 } 
}

 

If I wanted to expand this to spawning 3 different placeables one-time, how would I do it?

 

Thank you.

Link to comment
Share on other sites

void main() {

  object oContainer=GetObjectByTag("spawned_container_tag");
  object oContainer2=GetObjectByTag("spawned_container_tag2");
  object oContainer3=GetObjectByTag("spawned_container_tag3");

  vector vContainer1=Vector (0.0, 0.0, 0.0);
  vector vContainer2=Vector (0.0, 0.0, 0.0);
  vector vContainer3=Vector (0.0, 0.0, 0.0);

  location lContainer1=Location(vContainer1, 0.0);
  location lContainer2=Location(vContainer2, 0.0);
  location lContainer3=Location(vContainer3, 0.0);

  if (!GetIsObjectValid(oContainer) && (!GetIsObjectValid(oContainer2) && (!GetIsObjectValid(oContainer3) {
     oContainer = CreateObject(OBJECT_TYPE_PLACEABLE, "container_template", lContainer);
     oContainer2 = CreateObject(OBJECT_TYPE_PLACEABLE, "container_template", lContainer2);
     oContainer3 = CreateObject(OBJECT_TYPE_PLACEABLE, "container_template", lContainer3);
     CreateItemOnObject("item_template", oContainer); 
     CreateItemOnObject("item_template", oContainer2); 
     CreateItemOnObject("item_template", oContainer3); 
  } 
}

This is an equivalent template, I think, for multiple containers. Used !GetIsObjectValid() rather than checking against OBJECT_INVALID... they check the same thing

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...