why it:
Code: Select all
for (local.a=1;local.a<=35;local.a++)
{
self.target[local.a] = NULL
}
Moderator: Moderators
Code: Select all
for (local.a=1;local.a<=35;local.a++)
{
self.target[local.a] = NULL
}
Code: Select all
self.target[local.a]Code: Select all
=Code: Select all
bad lvalue
Code: Select all
$(self + ".target" + local.a) =
Self is not a targetname, self is a predefined object. And local.a is a variable which (in this case) needs to be used in an array, so it needs to be between [ ].$(self + ".target" + local.a)
My bad, i mean self.targetanme .... nvm, BUT self.target[local.a] dont worked too... but i fix'd the problem another way..$oldier Of Ra wrote:Self is not a targetname, self is a predefined object. And local.a is a variable which (in this case) needs to be used in an array, so it needs to be between [ ].$(self + ".target" + local.a)![]()
This will not work. You must use self.target[local.a] like in your first post.
Huh? I didnt understand it at all, but i fixed my problem yesterday using a laaaaaaaaaaarge switch.$oldier Of Ra wrote:Ah, .target1 isn't an array![]()
The easiest way would be to make turn your sum of targets (eg .target1, .target2, .target3...) into an array (eg .target[1], .target[2]...) When you do that, your script (in your first post) will work.
Then you can make your script even more dynamic, you can replace that 35 integer by self.target.size
Code: Select all
for (local.i = 1; local.i <= $player.size; local.i++)
{
$player[local.i] iprint "hello"
}I know...$oldier Of Ra wrote: There is no $player1, $player2... Only $player[1] and $player[2]... this is probably what confused you when you made that first post.
Code: Select all
for (local.a=1;local.a<=35;local.a++)
{
self.target[local.a] = NULL
}
Code: Select all
for (local.a=1;local.a<=35;local.a++)
{
self.target[local.a] = NULL
}