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

Saving an Array?

broken avatar :(
Created 10 years ago
by omgitsbothscarab
0 Members and 1 Guest are viewing this topic.
2,349 views
broken avatar :(
×
broken avatar :(
Location: usJapan
Date Registered: 14 September 2013
Last active: 8 years ago
Posts
71
Respect
Forum Rank
Rotting Walker
Primary Group
Donator ♥
My Groups
More
My Contact & Social Links
More
Personal Quote
rdthdthth
×
omgitsbothscarab's Groups
Donator ♥ Benevolent Soul who has our eternal gratitude and exclusive access to betas and the donator section of the forum.
omgitsbothscarab's Contact & Social Linksbothscarab86LilyMu
I don't know if this will make sense, but is it possible to "save" (maybe archive, for lack of a better word) an array at a certain point in time so you can use the information stored in it as a variable?  Sorry, I'm a noob at scripting :(
This topic contains a post which is marked as the Best Answer. Click here to view it.
broken avatar :(
×
broken avatar :(
Location: tr
Date Registered: 1 March 2013
Last active: 11 hours ago
Posts
816
Respect
Forum Rank
The Decider
Primary Group
2015 Contest Winner
My Groups
More
My Contact & Social Links
More
Personal Quote
Caw caw caw
×
johndoe's Groups
Donator ♥ Benevolent Soul who has our eternal gratitude and exclusive access to betas and the donator section of the forum.
Community Mapper Has released one or more maps to the UGX-Mods community which have been added to the UGX Map Manager.
2015 Contest Winner
johndoe's Contact & Social Linksmyc153-johndoe
if you want to use an array in different functions, you can store them on level variables.

Code Snippet
Plaintext
level.arrayname = [];
broken avatar :(
×
broken avatar :(
[UGX] Documentation Writer & Programmer
Location: usLos Angeles, CA
Date Registered: 23 August 2013
Last active: 6 months ago
Posts
1,322
Respect
Forum Rank
Zombie Colossus
Primary Group
UGX Team Member
My Groups
More
My Contact & Social Links
More
Personal Quote
(ง º ω º )ง u wont sum m8y?
Signature
Do not take life too seriously. You will never get out of it alive.
×
DidUknowiPwn's Groups
UGX Team Member
Donator ♥ Benevolent Soul who has our eternal gratitude and exclusive access to betas and the donator section of the forum.
Community Scripter Elite Has shown excellence and experience in the area of custom scripting in the UGX-Mods community.
BO3 Modtools Alpha
BO3 Modtools Alpha
This user has access to the Black Ops 3 Modtools Alpha
To store throughout match you use entity.name = [];
To hold an array for only a function you can create a scoped variable which is basically a variable w/o an entity linked like something = [];
broken avatar :(
  • n123q45
  • Deleted Member
×
broken avatar :(
n123q45
This user is deleted :(
you can also send it to other functions via parameters. but i recommend using level.___________ or self._____________ depending on what the script is
broken avatar :(
×
broken avatar :(
Location: usJapan
Date Registered: 14 September 2013
Last active: 8 years ago
Posts
71
Respect
Forum Rank
Rotting Walker
Primary Group
Donator ♥
My Groups
More
My Contact & Social Links
More
Personal Quote
rdthdthth
×
omgitsbothscarab's Groups
Donator ♥ Benevolent Soul who has our eternal gratitude and exclusive access to betas and the donator section of the forum.
omgitsbothscarab's Contact & Social Linksbothscarab86LilyMu
It's for a perk haha. Thanks! Now with my limited knowledge of scripting, I shall attempt to figure out what that means! :D

Double Post Merge: August 31, 2014, 03:46:31 pm
And also (don't know if I made this clear or not?), I meant if it's possible to save an array at a certain point in time, and by that, I mean:

Say I had only Juggernog, but the array had all 4 stock perks indexed. I ended up getting downed and losing my perk. Is there a way that I could "archive" the perk(s) I had before I was downed and use it to give only Jugg back when I was revived? Sorry :(
Last Edit: August 31, 2014, 03:46:31 pm by omgitsbothscarab
broken avatar :(
  • n123q45
  • Deleted Member
×
broken avatar :(
n123q45
This user is deleted :(
why not just give jug back? you gave no reason to archive the rest, unless you used that as an example
broken avatar :(
×
broken avatar :(
[UGX] Documentation Writer & Programmer
Location: usLos Angeles, CA
Date Registered: 23 August 2013
Last active: 6 months ago
Posts
1,322
Respect
Forum Rank
Zombie Colossus
Primary Group
UGX Team Member
My Groups
More
My Contact & Social Links
More
Personal Quote
(ง º ω º )ง u wont sum m8y?
×
DidUknowiPwn's Groups
UGX Team Member
Donator ♥ Benevolent Soul who has our eternal gratitude and exclusive access to betas and the donator section of the forum.
Community Scripter Elite Has shown excellence and experience in the area of custom scripting in the UGX-Mods community.
BO3 Modtools Alpha
BO3 Modtools Alpha
This user has access to the Black Ops 3 Modtools Alpha
Code Snippet
Plaintext
if( !isDefined(self.perks) )
self.perks = [];

self.perks[self.perks.size] = "new_perk";
broken avatar :(
×
broken avatar :(
Location: usJapan
Date Registered: 14 September 2013
Last active: 8 years ago
Posts
71
Respect
Forum Rank
Rotting Walker
Primary Group
Donator ♥
My Groups
More
My Contact & Social Links
More
Personal Quote
rdthdthth
×
omgitsbothscarab's Groups
Donator ♥ Benevolent Soul who has our eternal gratitude and exclusive access to betas and the donator section of the forum.
omgitsbothscarab's Contact & Social Linksbothscarab86LilyMu
That was just an example, not a very good one at that. I meant if it's more than one perk, how would I save it.

Thank you, Pwn! :D
Marked as best answer by omgitsbothscarab 10 years ago
broken avatar :(
×
broken avatar :(
Location: nlApeldoorn
Date Registered: 17 December 2013
Last active: 1 year ago
Posts
1,187
Respect
1,404Add +1
Forum Rank
Zombie Colossus
Primary Group
Community Scripter Elite
My Groups
More
My Contact & Social Links
More
Personal Quote
It aint much, if it aint Dutch
Signature
×
BluntStuffy's Groups
Donator ♥ Benevolent Soul who has our eternal gratitude and exclusive access to betas and the donator section of the forum.
Community Scripter Elite Has shown excellence and experience in the area of custom scripting in the UGX-Mods community.
Oil Rig Beta Access
Oil Rig Beta Access
BluntStuffy's Contact & Social LinksBluntstuffy@BluntZombieBluntStuffyStuffyZombie
That was just an example, not a very good one at that. I meant if it's more than one perk, how would I save it.

Thank you, Pwn! :D

Code Snippet
Plaintext
if( !isDefined(self.perks) )
self.perks = [];

for(i=0;i<available_perks.size;i++)
{
   if( player hasperk( available_perks[i]) )
   {
       self.perks[self.perks.size] = available_perks[i];
   }
}



or just do something like:

Code Snippet
Plaintext
self.perks[self.perks.size] = "new_perk1";
self.perks[self.perks.size] = "new_perk2";

;)

 
Loading ...