UGX-Mods Login

or login with an authentication provider below
Sign In with Google
Sign In with Twitter
Sign In with Discord
Sign In with Steam
Sign In with Facebook
Sign In with Twitch

Using 1 animation for 3 Entitys?

broken avatar :(
Created 7 years ago
by kamalam
0 Members and 1 Guest are viewing this topic.
1,965 views
broken avatar :(
×
broken avatar :(
Location: de
Date Registered: 14 October 2016
Last active: 7 years ago
Posts
7
Respect
Forum Rank
Legless Crawler
Primary Group
Member
×
kamalam's Groups
kamalam's Contact & Social Links
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.

Here is my script:

Code Snippet
Plaintext
soul_chest_area_1 = getent( "soulchest_area_mystic_1" , "targetname") ;
if(self IsTouching( soul_chest_area_1 ) && !level.boxfinished_1){
soulbox_mystic_1 = GetEnt( "soulbox_mystic_1" , "targetname");
soul_chest_area_1 playSound("zombie_soulbox_kill");
level.kills_1 += 1;
if(level.kills_1 == 1 && !level.boxopen_1){
soulbox_mystic_1 useanimtree(#animtree);
soulbox_mystic_1 AnimScripted("soulbox_open", soulbox_mystic_1.origin, soulbox_mystic_1.angles, level.scr_anim["o_zombie_dlc4_challenge_box_open"]);
level.boxopen_1 = true;
soulbox_mystic_1 playSound("zombie_soulbox_open");
}
else if(level.kills_1 >= level.neededkills && level.boxopen_1){
level.boxopen_1 = true;
level.boxfinished_1 = true;
soulbox_mystic_1 useanimtree(#animtree);
soulbox_mystic_1 AnimScripted("soulbox_close", soulbox_mystic_1.origin, soulbox_mystic_1.angles, level.scr_anim["o_zombie_dlc4_challenge_box_close"]);
players = GetPlayers();
for(i = 0; i < players.size; i++){
players[i].score += level.reward;
}
soulbox_mystic_1 playSound("zombie_soulbox_finished");
checkboxes();
}

}

This is inside a function that checks if a zombie is inside a trigger-radius! PLS HELP ME
This topic contains a post which is marked as the Best Answer. Click here to view it.
broken avatar :(
×
broken avatar :(
Location: it
Date Registered: 5 September 2014
Last active: 3 years ago
Posts
282
Respect
Forum Rank
Mr. Elemental
Primary Group
Member
My Contact & Social Links
More
Personal Quote
I belive purple is getting me...
×
IperBreach86's Groups
IperBreach86's Contact & Social LinksIperBreach86
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.

Here is my script:

Code Snippet
Plaintext
soul_chest_area_1 = getent( "soulchest_area_mystic_1" , "targetname") ;
if(self IsTouching( soul_chest_area_1 ) && !level.boxfinished_1){
soulbox_mystic_1 = GetEnt( "soulbox_mystic_1" , "targetname");
soul_chest_area_1 playSound("zombie_soulbox_kill");
level.kills_1 += 1;
if(level.kills_1 == 1 && !level.boxopen_1){
soulbox_mystic_1 useanimtree(#animtree);
soulbox_mystic_1 AnimScripted("soulbox_open", soulbox_mystic_1.origin, soulbox_mystic_1.angles, level.scr_anim["o_zombie_dlc4_challenge_box_open"]);
level.boxopen_1 = true;
soulbox_mystic_1 playSound("zombie_soulbox_open");
}
else if(level.kills_1 >= level.neededkills && level.boxopen_1){
level.boxopen_1 = true;
level.boxfinished_1 = true;
soulbox_mystic_1 useanimtree(#animtree);
soulbox_mystic_1 AnimScripted("soulbox_close", soulbox_mystic_1.origin, soulbox_mystic_1.angles, level.scr_anim["o_zombie_dlc4_challenge_box_close"]);
players = GetPlayers();
for(i = 0; i < players.size; i++){
players[i].score += level.reward;
}
soulbox_mystic_1 playSound("zombie_soulbox_finished");
checkboxes();
}

}

This is inside a function that checks if a zombie is inside a trigger-radius! PLS HELP ME
You could get an array for the boxes(getentarray) and then thread the function on each one using "for"
broken avatar :(
×
broken avatar :(
Location: de
Date Registered: 14 October 2016
Last active: 7 years ago
Posts
7
Respect
Forum Rank
Legless Crawler
Primary Group
Member
×
kamalam's Groups
kamalam's Contact & Social Links
You could get an array for the boxes(getentarray) and then thread the function on each one using "for"
Tried that. didnt worked
Marked as best answer by kamalam 7 years ago
broken avatar :(
×
broken avatar :(
Location: us
Date Registered: 14 September 2013
Last active: 4 years ago
Posts
1,895
Respect
Forum Rank
Zombie Destroyer
Primary Group
Community Scripter
My Groups
More
My Contact & Social Links
More
Personal Quote
BE ORIGINAL
Signature
×
MakeCents's Groups
Community Mapper Has released one or more maps to the UGX-Mods community which have been added to the UGX Map Manager.
Community Scripter Has shown effort and knowledge in the area of scripting while being a part of the UGX-Mods community.
BO3 Modtools Alpha
BO3 Modtools Alpha
This user has access to the Black Ops 3 Modtools Alpha
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

 
Loading ...