My Script only plays the animations I referenced on the first Object. I already tried to change the objects names but it still only played the animation on soulbox_mystic_1. All Prefabs and entitys are perfect! Maybe I forgot something in the APE.
My Script only plays the animations I referenced on the first Object. I already tried to change the objects names but it still only played the animation on soulbox_mystic_1. All Prefabs and entitys are perfect! Maybe I forgot something in the APE.
If they are the same thing, and the same rules apply, then you want to use arrays, like said, and thread one function that handles them. Using different ones for each can get ugly and confusing. For example:
Code Snippet
Plaintext
function Test(){ boxes = GetEntArray("soulchest_area_mystic","targetname"); array::thread_all(boxes, &BoxMe); } function BoxMe(){ //put code here with each soulchest_area_mystic as self }
To further the easy and efficiency of your scripting and mapping and dynamic abilities of your system, you can make things the target of things using w. This will give you the ability to make one prefab and copy it around, applying the same functions to them all, without changing anything. For example, if you make the soulbox_mystic the autotarget of the area:
Code Snippet
Plaintext
function Test(){ boxes = GetEntArray("soulchest_area_mystic","targetname"); array::thread_all(boxes, &BoxMe); } function BoxMe(){ //put code here with each soulchest_area_mystic as self box = GetEnt(self.target,"targetname"); //above is when you select the area, then the box, and press w. (make sure the box doesn't have a targetname before you do that) }
From there you don't want to use level vars for this box, you want to use vars for the box itself, but probably put in the area object instead, since that is what started it all, and will allow you to thread more functions on it and check these vars then.
Code Snippet
Plaintext
function Test(){ boxes = GetEntArray("soulchest_area_mystic","targetname"); array::thread_all(boxes, &BoxMe); level.totalboxes = boxes.size;//added to track total } function BoxMe(){ self.kills = level.neededkills;//initlalize total of kills for this area //put code here with each soulchest_area_mystic as self box = GetEnt(self.target,"targetname"); //above is when you select the area, then the box, and press w. (make sure the box doesn't have a targetname before you do that) while(1){ //code that watches kills or whatever self.kills--;//when kill in this area subtract one
if(self.kills<=0){ IPrintLnBold("You killed enough");//check if all killed in this area break; } } level.totalboxes--;//subtract that this box is done //when you break up there, you continue here, where you can further check if all were combplete if(level.totalboxes<=0){ IPrintLnBold("Reward for getting all boxes"); } }
This may or may not be your approach but is an example of isolating your script to radiant relationship to reusing repeated actions.
Last Edit: November 03, 2016, 01:05:43 pm by MakeCents