View Single Post
Old 04-09-2013, 01:26 AM   #2
VarsityPuppet
Master of Puppets
 
VarsityPuppet's Avatar
 
Join Date: May 2009
Location: MN
Posts: 1,223
Current Game: Chrono Trigger
Contest winner - Modding Forum Veteran Veteran Modder Helpful! 
Quote:
Originally Posted by Vindikorr View Post
Hi everyone, I have a quick question about scripting.

I'm trying to make a script that finds all the objects in a module with a specific tag, unfortunately there seems to be no function to do this. Anyone got any ideas?

BTW, This is for KotOR 1.

Code:
void main(){
    // Loop all objects in us, an area
    object oArea = GetArea(GetFirstPC());
    object oObject = GetFirstObjectInArea(oArea);
    string sTag = "taghere";

    while(GetIsObjectValid(oObject)){
         // Destroy any objects tagged "DESTROY"
         if(GetTag(oObject) == sTag){
             //Do stuff here
         }
         oObject = GetNextObjectInArea(oArea);
    }
}

VarsityPuppet is online now   you may: quote & reply,