Posted By: jumpman
An entity having a Large Local Array in C-Script - 10/13/16 17:54
Hi friends!
Anyone have any clever way to get an entity to have a local array that only it can access and change? I could just make a bunch of global arrays and then assign each array to each entity, but I would like to see if I can get an entity to have its own array, an array with more than 3 values.
Posted By: Superku
Re: An entity having a Large Local Array in C-Script - 10/13/16 18:23
You could use the entity's skill array like this:
my.skill[10+i] = i;
At least I think it's like that in C-Script, too, with skill1,2,... just as defines of said array (this means skill1 = skill[0], skill2 = skill[1],...).
Alternatively, it should be possible to allocate memory dynamically in C-Script, right? You could do that for each entity and save the pointer in a skill.
Or, the worst option, you could make a big global array and use let's say 16 entries for each entity which they access via some ID-skill, like this:
my.skill10 = enemy_id;
enemy_id = enemy_id+1;
...
global_array[(my.skill10*16)+i] = i
Posted By: jumpman
Re: An entity having a Large Local Array in C-Script - 10/13/16 18:46
Hey Superku!
I dont think you can do this in C-script:
my.skill[10+i] = i;
What I'm looking for is to have each entity have a list of values, each value storing an entity ID number. However I would like to have each entity have around 300 values! Is that possible?
Are you using the bitwise stuff?
Posted By: Superku
Re: An entity having a Large Local Array in C-Script - 10/14/16 10:54
I dont think you can do this in C-script:
my.skill[10+i] = i;
Have you tried it at least?
Entities have 100 skills for quite a long time now, and I bet it's just a 100 var array named skill, too.
If you need more than 100 skills you probably need to take one of the other 2 options I've posted above. I don't have a C-Script manual anymore so I can't look it up sadly.
Posted By: jumpman
Re: An entity having a Large Local Array in C-Script - 10/14/16 16:33
Hwy Superku,
Yea Ive tried it, it doesnt work
I might just end up having to do seperate Arrays for each entity. Thanks for your help so far