Hi all. As the title says. I seem to not find it, or does nothing like that exist?
If this requires some short of loop, some help on that would be also needed since I don't get looping scripts
. At all.
Hi all. As the title says. I seem to not find it, or does nothing like that exist?
If this requires some short of loop, some help on that would be also needed since I don't get looping scripts
. At all.
Alright, right after I saw this I found the SetWeaponVisibility function. I guess that should do. But how can I Get all creatures in area?
object oCreature = GetNearestObject(OBJECT_TYPE_CREATURE, OBJECT_SELF, 1); SetWeaponVisibility(oCreature, 0, 0); oCreature = GetNearestObject(OBJECT_TYPE_CREATURE, OBJECT_SELF, 2); SetWeaponVisibility(oCreature, 0, 0); oCreature = GetNearestObject(OBJECT_TYPE_CREATURE, OBJECT_SELF, 3); SetWeaponVisibility(oCreature, 0, 0);the only thing that changes is the iterator. Using a loop:
int i = 1;
object oCreature = GetNearestObject(OBJECT_TYPE_CREATURE, OBJECT_SELF, i);
while (GetIsObjectValid(oCreature))
{
SetWeaponVisibility(oCreature, 0, 0);
i++;
oCreature = GetNearestObject(OBJECT_TYPE_CREATURE, OBJECT_SELF, i);
}
object oCreature = GetFirstObjectInArea();
while (GetIsObjectValid(oCreature))
{
if (GetObjectType(oCreature) == OBJECT_TYPE_CREATURE)
{
SetWeaponVisibility(oCreature, 0, 0);
}
oCreature = GetNextObjectInArea();
}
I see. This makes things a bit more clear, thanks KevL. One question about loops, why do we need this while line at the beginning? I mean, what would happen if it wasn't there but the rest of the script were as it is now?
The 'while' function *is* the loop. Without that, things would only happen once (which is the antithesis of a loop).
Oh for the good old days of Basic programming, with its gotos and gosubs...
with its gotos and gosubs...
I see. This makes things a bit more clear, thanks KevL. One question about loops, why do we need this while line at the beginning? I mean, what would happen if it wasn't there but the rest of the script were as it is now?
It makes sense now. It's a good thing to know, these loops
. And I guess any function which uses a GetNext*** can be used like that?