Author Topic: OnModuleLoad  (Read 5064 times)

Offline Daniel1975

  • Full Member
  • ***
  • Posts: 170
    • View Profile
    • http://
    • Email
OnModuleLoad
« on: January 10, 2005, 05:35:21 AM »
I wanted to give some objects in our mod visual effects and set certain properties to them.
Therefore I made a script and placed it in -> module properties -> OnModuleLoad

effects and/or LocalInts are set like this:

object oThroneGwydion = GetObjectByTag("Throne_Gwydion");
SetLocalInt(oThroneGwydion, "NoKilling", 1);

These two lines stick a LocalInt to only one object that
has the tag "Throne_Gwydion"

so far so good but I have lots of objects that need such a LocalInt and I don't assume I have to give every object another single tag.
How do I have to change the lines if I want to set that LocalInt to every object
that has a certain tag?  :blink:   :blink:
G[/span][span style=\'color:orange\']w[/span][span style=\'color:yellow\']y[/span][span style=\'color:green\']d[/span][span style=\'color:blue\']i[/span][span style=\'color:purple\']on[/span] - Slann [span style=\'color:red\']Lord[/span] of the [span style=\'color:green\']Antediluvians

Offline Tea-cup

  • Hero Member
  • *****
  • Posts: 916
    • View Profile
OnModuleLoad
« Reply #1 on: January 10, 2005, 12:04:36 PM »
Quote
I wanted to give some objects in our mod visual effects and set certain properties to them.
Therefore I made a script and placed it in -> module properties -> OnModuleLoad

effects and/or LocalInts are set like this:

object oThroneGwydion = GetObjectByTag("Throne_Gwydion");
SetLocalInt(oThroneGwydion, "NoKilling", 1);

These two lines stick a LocalInt to only one object that
has the tag "Throne_Gwydion"

so far so good but I have lots of objects that need such a LocalInt and I don't assume I have to give every object another single tag.
How do I have to change the lines if I want to set that LocalInt to every object
that has a certain tag?  :blink:   :blink:
[snapback]15212[/snapback]
As this only has to run onload, you can use a loop that scans for the tags on the area's you want. For example a execute script on the area's you want, with the loop in the scipt you execute. (you can re-use that script then instead of writing 1 for each area)

If you have much objects in your area's and/or much items with tags to do an effect on it, the script may be quite heavy. So make sure it only runs onload (no onbeat or something), otherwise you'll eat away free power on you machine you could use for something better.

-Mel

Offline Daniel1975

  • Full Member
  • ***
  • Posts: 170
    • View Profile
    • http://
    • Email
OnModuleLoad
« Reply #2 on: January 11, 2005, 04:55:38 PM »
okay I think I get it...but not 100% yet.

I changed it into smt like this:

 object oVIT = GetObjectByTag("VIT"); // VIT = Very Important Thing
 while(GetIsObjectValid(oVIT))
  {
   SetLocalInt(oVIT, "NoKilling", 1);
   oVIT = GetNextObjectInArea();
  }

all objects that are absolutely neccessary have the tag VIT.
But still not every object with the tag VIT in one area is affected by that script.
Is there smt wrong with this loop? May be it has smt to do with GetNextObjectInArea?
How can I get an area where objects with VIT-tag are in and run that loop for
that area as long as there are objects with that tag???  :blink:   :blink:
« Last Edit: January 11, 2005, 04:57:45 PM by Daniel1975 »
G[/span][span style=\'color:orange\']w[/span][span style=\'color:yellow\']y[/span][span style=\'color:green\']d[/span][span style=\'color:blue\']i[/span][span style=\'color:purple\']on[/span] - Slann [span style=\'color:red\']Lord[/span] of the [span style=\'color:green\']Antediluvians