Custom Script List Copy To Blox Local List

(Bata Laki) #1

Greetings everyone.

I am working for some time now on skill(abilities) filtering logic, but i always run into some kind of barrier.
So i have come onto one idea about creating Custom script which will retrieve skill based on its METADATA. it looks like this:
(pseudo code for less typing)
FOREACH(Skill a in Actor.KnownSkills){

     if(a.metadata == "Passive"){
     else if(a.metadata == "Active") {    activeList.add(a)} ETC....

Next step was to copy this script to local blox List in order to have list of skills which this particular Blox function would execute based on their names. So one Fuction UseSkill Based on Skill Screen Name.

So problem was… while i can retrieve all data needed in order this to work, i have problem copping List into a blox List. I can not access it as well with GetProperty Value Blox nor in any other way.
My Last try was this image.

unfortunately my copy of the list is always empty regardless my custom List have 2 items.
This is after effect image(After Function is executed)

Is there anyone who succeed in similar attempts? Em i doing something wrong? Probably i DO. :slight_smile:
I would appreciate any pointer in which direction should i go… or even better solution if u have it :smiley:

Cheers everyone.

(Leslie Young) #2

Are you using the plyBLox List to create the initial lists you are copying from? plyBlox lists are not the same as List<T> so the name you use in the the Copy block does not refer to the field/property name you have that list.

It refers to a specific thing inside of plyBlox.

If you goal is to create a plyBlox list via code and then access it via plyBlox then simply work with that kind of list form the start. This way you do not have to make any copy either since it is already a plyBlox list. It looks to me like you want to set up a list/array in the inspector of PassiveSkillsList component. During its Start you can then create the plyBlox list from that data,

Note that plyBlox Lists are bound to a Blox so first you need to know what Blox you want to create the list in. Since you have a Blox on the same object as your SkillsList component I will assume ti is where you want it.

plyBlox targetBlox = GetComponent<plyBlox>();

Now you can make calls into that Blox to set up the list.

To addyou do for example…

targetBlox.AddToList("name_of_list", some_value);

for example, duing Start you can do this…

foreach(Skill s in tempList) { targetBlox.AddToList("Passive", s); }

(Bata Laki) #3

Hey Leslie… Thanks for a reply.
I have retrieved list successfully following your steps. Decided to go bit further and write some of the blox on my own.
I made some blocks which can retrieve types like objects and strings(for tags etc)…
But alas… again problem with lists… :slight_smile:

I have made script that gives back all an List of a object in radius from another object variable, with tag filter(LayerMask),
but i dont know how to return a value from that blox. Unlike working with FLOAT_VALUE or OBJECT VALUE where i can give value = SOMETHING of same type, in same manner i can not access return value of list.

here is how blox looks like:

and this is an error in returning a value of type

i have tried to derive my class from List_Copy_plyBlock and List_Add_plyBlock as well from Plyblox and plyblox(set return type as well), in order to find out how to return value in Action block but still did not found it. Most likely like always i am missing logic all over the place. :slight_smile:

Can u please provide me with some guide how to return list from plyBlox?

Anyway, thanks a lot and if anyone can throw me some advice i would be grateful.
Cheers all.

(Leslie Young) #4

Maybe this will help. The source for the List Blocks. (7.8 KB)

The 1st error (0…-1) means the list you tried to access is empty. The “-1” gives you the clue since that should be the max value of the index, which obviously could not be -1.

Maybe your “Get Objects” Block did not work correctly or did not find anything?

(Bata Laki) #5

Hey leslie. Thanks. This zipp solved it.
i did point the list toward its container so it could not copy my list since it could most likely not find it.
This 2 lines of code ware missing.
first assigning the ref. and second getting the list itself from plyblock(self or some other).
i added this last line of code before getting the copy of the list.
plyBlox bloxOF = targeted == null ? owningBlox : targeta.RunAndGetplyBlox();
List aa = bloxOf.GetList(listOfSkills.RunAndGetString());

some more code in between but nwm. It worked. Got it as variable and Action. This is very helpfull in conugation with spells… All AOE spells can be done using jsut few blox in OnSkillActivate event. I will test this more, along with other blox and put the food ones here so taht ppl can use them… with ur permission of course… if u are ok with that.

Thank you once more.
Have good one.

(Bata Laki) #6

Here is a quick demonstration.


effect of it.