lfnetwork.com mark read register faq members calendar

Thread: spawning many placeables once
Thread Tools Display Modes
Post a new thread. Add a reply to this thread. Indicate all threads in this forum as read. Subscribe to this forum. RSS feed: this forum RSS feed: all forums
Old 02-02-2012, 12:05 PM   #1
newbiemodder
Gentleman Modder
 
newbiemodder's Avatar
 
Join Date: Feb 2009
Location: Chicago
Posts: 706
Veteran Modder 
spawning many placeables once

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

Code:
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.


Who's more foolish, the fool or the fool that follows?

Just exactly what is a head-piece to the Staff of Ra?

http://www.lucasforums.com/showthread.php?t=206819

http://www.lucasforums.com/showthread.php?t=206541

http://www.lucasforums.com/showthrea...t=newbiemodder
newbiemodder is offline   you may: quote & reply,
Old 02-02-2012, 03:28 PM   #2
Qui-Gon Glenn
Necessary Roughneck
 
Qui-Gon Glenn's Avatar
 
Join Date: May 2007
Location: Thessia
Posts: 1,465
Current Game: ME3MP, Arkham Origins
Folder extraordinaire Helpful! Forum Veteran Veteran Modder 
Code:
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


Want to play a game of ME3MP?
Qui-Gon_Glenn on the software of which we shall not name.... add me and the enemy shall fall in chunks of crimson salsa

Last edited by Qui-Gon Glenn; 02-02-2012 at 04:27 PM. Reason: lContainer2 and 3 references missing in CreateObject() call
Qui-Gon Glenn is offline   you may: quote & reply,
Old 02-02-2012, 04:13 PM   #3
newbiemodder
Gentleman Modder
 
newbiemodder's Avatar
 
Join Date: Feb 2009
Location: Chicago
Posts: 706
Veteran Modder 
I'll give it a try

Seems to work great, Thanks!!


Who's more foolish, the fool or the fool that follows?

Just exactly what is a head-piece to the Staff of Ra?

http://www.lucasforums.com/showthread.php?t=206819

http://www.lucasforums.com/showthread.php?t=206541

http://www.lucasforums.com/showthrea...t=newbiemodder

Last edited by newbiemodder; 02-02-2012 at 04:32 PM.
newbiemodder is offline   you may: quote & reply,
Old 02-02-2012, 04:45 PM   #4
Qui-Gon Glenn
Necessary Roughneck
 
Qui-Gon Glenn's Avatar
 
Join Date: May 2007
Location: Thessia
Posts: 1,465
Current Game: ME3MP, Arkham Origins
Folder extraordinaire Helpful! Forum Veteran Veteran Modder 


Glad to help... I guess from the time stamp of your edit that you either used my edited code or figured out my little error yourself


Want to play a game of ME3MP?
Qui-Gon_Glenn on the software of which we shall not name.... add me and the enemy shall fall in chunks of crimson salsa
Qui-Gon Glenn is offline   you may: quote & reply,
Post a new thread. Add a reply to this thread. Indicate all threads in this forum as read. Subscribe to this forum. RSS feed: this forum RSS feed: all forums
Go Back   LucasForums > Network > Knights of the Old Republic > Editing / Modding > Holowan Laboratories > spawning many placeables once

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -4. The time now is 08:43 AM.

LFNetwork, LLC ©2002-2011 - All rights reserved.
Powered by vBulletin®
Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.