Author Topic: Variable/Placeable Help  (Read 368 times)

Legacy_TSMDude

  • Hero Member
  • *****
  • Posts: 1515
  • Karma: +0/-0
Variable/Placeable Help
« on: June 11, 2011, 01:16:07 pm »


               Is there a way to add a variable to every placeable in an area without opening up every placeable or remaking the areas in question by using either OnModule Load or OnAreaEnter load?


The placeables in the area are already there I just cannot figure out how to make them have this int on them on load.

nFlammable int 1

Anyone have any suggestions?
               
               

               
            

Legacy_Failed.Bard

  • Hero Member
  • *****
  • Posts: 1409
  • Karma: +0/-0
Variable/Placeable Help
« Reply #1 on: June 11, 2011, 02:17:27 pm »


               The only way I could see something like that being able to be done, is with an external program that can parse the .git file for that area, and insert the variables directly there.
 That sort of thing would need an actual programmer to make, but it would be doable, since GFF Editor allows variables to be manually added into the placeables, albeit in a more time consuming than in toolset way.
               
               

               
            

Legacy_FunkySwerve

  • Hero Member
  • *****
  • Posts: 2325
  • Karma: +0/-0
Variable/Placeable Help
« Reply #2 on: June 11, 2011, 05:00:45 pm »


               Yes, we do stuff like this all the time with Moneo. Without it we'd have spent literally tens of thousands more hours developing (or more likely just not done all the stuff we wanted '<img'> ).

You can download it here:
Download

Quite simply, it allows you to use letoscript on files without the server having to be running.

Example Scripts:

Make all the static places in an area nonstatic and plot, and up their fort save to 100, in preparation for a 'fire burns trees' edit:

%git = 'temp0/canopy4.git';

for (/{'Placeable List'}) {
  if (/~/Static == 1) {
    /~/Static = 0;
    /~/Plot   = 1;
    /~/Fort   = 100;
    print /~/Tag, "\\n";
  }
}

%git = '>';
%close(%git);


For every area in the module whose resref is prefixed with 'ele_earth_', check all the triggers whose resref is 'newtransition', set their OnClick script to hg_area_trans, and set a CheckEnv int to value 3 on them.

%mod = 'Path of Ascension CEP Legends.mod';

for (%mod['ele_earth_*.git']) {
  for (/{'TriggerList'}) {
    if (/~/TemplateResRef eq 'newtransition') {
      /~/OnClick = 'hg_area_trans';
      add /~/VarTable, type => gffList unless /~/VarTable;
      add /~/VarTable/Name, type => gffString, value => "CheckEnv";
      add /~/VarTable/[_]/Type, type => gffDword, value => 1;
      add /~/VarTable/[_]/Value, type => gffInt, value => 3;

    }
  }
}

%mod = '>';
close(%mod);


Moneo is also extremely useful for data mining. This script prints out a list of all the item resrefs in the module that have the 'MissileResref' variable set on them.


%mod = 'Path of Ascension CEP Legends.mod';

for (%mod['*.uti']) {
  for (/VarTable) {
    if (/~/Name eq "MissileResref") {
        print /TemplateResRef, "    ", /~/Value, "\\n";
    }
  }
}


I have dozens upon dozens of example scripts like this for you to extrapolate from, if you want them. Having a gff viewer like Alia is extremely handy when doing this stuff, as it allows you to figure out what fields are name, and see what fields a given file has. You can find Alia here:
Download

If you'd like me to show you how to set Moneo up and use it, or just want the sample scripts, contact me via yahoo instant messenger - I'll pm you the username.

Funky
               
               

               


                     Modifié par FunkySwerve, 11 juin 2011 - 04:06 .
                     
                  


            

Legacy_Lightfoot8

  • Hero Member
  • *****
  • Posts: 4797
  • Karma: +0/-0
Variable/Placeable Help
« Reply #3 on: June 11, 2011, 05:31:46 pm »


               I see funky has a better answer then mine.  Oh well here is my answer any way.

 

1 - First make a back up of your module, Just incase.

2 - Then replace your module on load script with something like this.

void main()
{
 object oArea =  GetObjectByTag("TAG OF AREA");
 object oPlacable = GetFirstObjectInArea(oArea);

 while (GetIsObjectValid(oPlacable))
 {
   if (GetObjectType(oPlacable) == OBJECT_TYPE_PLACEABLE)
       SetLocalInt(oPlacable, "nFlammable", 1);
   oPlacable = GetNextObjectInArea(oArea);
 }
}


3 -  Run the module and save the game.** . 

4 - Open the Saved Game with the Toolset.

5 - Export the area. 

6 - Open the module and inport the Area.

7 - Change your OnModLoad back to its original script.

** It is a good Idea to make sure no PC/DM  enters the area you are going to export 
               
               

               


                     Modifié par Lightfoot8, 11 juin 2011 - 04:38 .
                     
                  


            

Legacy_TSMDude

  • Hero Member
  • *****
  • Posts: 1515
  • Karma: +0/-0
Variable/Placeable Help
« Reply #4 on: June 12, 2011, 01:06:36 am »


               

FunkySwerve wrote...
If you'd like me to show you how to set Moneo up and use it, or just want the sample scripts, contact me via yahoo instant messenger - I'll pm you the username.

Funky


Who would want help from a good scripter? Screw that noise I like fumbling around in the dark like a deaf man....

(pm sent)
               
               

               


                     Modifié par TSMDude, 12 juin 2011 - 12:07 .
                     
                  


            

Legacy_TSMDude

  • Hero Member
  • *****
  • Posts: 1515
  • Karma: +0/-0
Variable/Placeable Help
« Reply #5 on: June 12, 2011, 01:07:45 am »


               

Lightfoot8 wrote... 

1 - First make a back up of your module, Just incase.

2 - Then replace your module on load script with something like this.

void main()
{
 object oArea =  GetObjectByTag("TAG OF AREA");
 object oPlacable = GetFirstObjectInArea(oArea);

 while (GetIsObjectValid(oPlacable))
 {
   if (GetObjectType(oPlacable) == OBJECT_TYPE_PLACEABLE)
       SetLocalInt(oPlacable, "nFlammable", 1);
   oPlacable = GetNextObjectInArea(oArea);
 }
}


3 -  Run the module and save the game.** . 

4 - Open the Saved Game with the Toolset.

5 - Export the area. 

6 - Open the module and inport the Area.

7 - Change your OnModLoad back to its original script.

** It is a good Idea to make sure no PC/DM  enters the area you are going to export 

I will give ti a quick whirl and see if that works, LF.