Call of Duty 5: World at War => Downloadable Items for Mappers => Custom Maps, Mods & Tools => Scripts => Topic started by: death_reaper0 on September 13, 2015, 03:57:38 am
Title: weapon storage locker (carries on between games) v1.2
Post by: death_reaper0 on September 13, 2015, 03:57:38 am
this is my script for a weapon locker like in black ops 2 TranZit, die rise and buried. if you don't know what that is, then basically its a place to store a weapon and keep it between games!. it will keep track of your stored weapons ammo in reserve and in clip and can be modified to not accept certain weapons.
v1.2 update players can now take the weapon if they have a free weapon slot, without it placing your current weapon in
is there a way to make that happen? if so that would be amazing
First off, you'd need to get an array of weapons and a free or unsused stat slot. In this example, I'll use 3005. (for those who don't know, stats store an int which can persist on a player profile permamently in a mod unless the player removes mod's respective mpdata000 file) level.zombie_weapons is the array which keeps all the weapons. So, here, I'm going to find the weapon that player wants to put in (player being the player entity): This will set the weapon's index to 3005 slot. Now, you probably are wondering, how do you know what is the weapon that the player has put in? Well, there's GetStat And that's how you can use stats for the weapon cabinet :) Forgive me if I wasn't clear enough, I'm really tired today but I hope it helped you. You can use 3006 and 3007 for storing weapon ammo info. Also, I would recommend using 3008 for storing info if there is a weapon in the cabinet :)
Title: Re: weapon storage locker (like bo2)
Post by: Harry Bo21 on December 10, 2015, 09:33:41 pm
First off, you'd need to get an array of weapons and a free or unsused stat slot. In this example, I'll use 3005. (for those who don't know, stats store an int which can persist on a player profile permamently in a mod unless the player removes mod's respective mpdata000 file) level.zombie_weapons is the array which keeps all the weapons. So, here, I'm going to find the weapon that player wants to put in (player being the player entity): This will set the weapon's index to 3005 slot. Now, you probably are wondering, how do you know what is the weapon that the player has put in? Well, there's GetStat And that's how you can use stats for the weapon cabinet :) Forgive me if I wasn't clear enough, I'm really tired today but I hope it helped you. You can use 3006 and 3007 for storing weapon ammo info. Also, I would recommend using 3008 for storing info if there is a weapon in the cabinet :)
plenty clear, sounds very useful. Surprised it isnt used more
Title: Re: weapon storage locker (like bo2)
Post by: death_reaper0 on December 10, 2015, 10:33:56 pm
First off, you'd need to get an array of weapons and a free or unsused stat slot. In this example, I'll use 3005. (for those who don't know, stats store an int which can persist on a player profile permamently in a mod unless the player removes mod's respective mpdata000 file) level.zombie_weapons is the array which keeps all the weapons. So, here, I'm going to find the weapon that player wants to put in (player being the player entity): This will set the weapon's index to 3005 slot. Now, you probably are wondering, how do you know what is the weapon that the player has put in? Well, there's GetStat And that's how you can use stats for the weapon cabinet :) Forgive me if I wasn't clear enough, I'm really tired today but I hope it helped you. You can use 3006 and 3007 for storing weapon ammo info. Also, I would recommend using 3008 for storing info if there is a weapon in the cabinet :)
well i dont understand 100% but i'll test out this later on and see if i can get this working. but i wanna know, would this carry it on between maps? cause if so i'd probably wouldn't use this since most maps would have different guns. it could work for a bo2 style bank though
Title: Re: weapon storage locker (like bo2)
Post by: DeletedUser on December 10, 2015, 10:34:57 pm
well i dont understand 100% but i'll test out this later on and see if i can get this working. but i wanna know, would this carry it on between maps? cause if so i'd probably wouldn't use this since most maps would have different guns. it could work for a bo2 style bank though
It will be only within the same mod.
Title: Re: weapon storage locker (like bo2)
Post by: death_reaper0 on December 10, 2015, 10:38:27 pm
i managed to get a bank working with this, weapon locker though is still nonworking. i'll keep trying though
this might be because you followed what Ray1235 told you to do, which was use level.zombie_weapons. level.zombie_weapons is not an array of integers, remember the array keys are all of the weapon names. That means if u use an integer to get something in that array like he told you to do, it will come up undefined. My best recommendation would be to list out all the weapons in an array of integers separately and use that. But if you want something easier, this *MIGHT work.
Title: Re: weapon storage locker (like bo2)
Post by: death_reaper0 on December 12, 2015, 06:45:04 pm
this might be because you followed what Ray1235 told you to do, which was use level.zombie_weapons. level.zombie_weapons is not an array of integers, remember the array keys are all of the weapon names. That means if u use an integer to get something in that array like he told you to do, it will come up undefined. My best recommendation would be to list out all the weapons in an array of integers separately and use that. But if you want something easier, this *MIGHT work.
i'll try it out soon, thank you
Title: Re: weapon storage locker (like bo2)
Post by: DeletedUser on December 12, 2015, 06:47:25 pm
level.zombie_weapons is an array of structs, so you can't just compare with a weapon name :P You have to do
Title: Re: weapon storage locker (like bo2)
Post by: Harry Bo21 on December 12, 2015, 06:59:21 pm
i got it to work using alaurenc9's method, im just gonna do a few tests, then i'll update the script
Nice ;) the only thing I was worried about with that method was if GetArrayKeys would return the weapons in the same order every time. I'm pretty sure it does though so no worries there. I think it orders the keys from like last defined to first defined, meaning it isn't random, so yes the system I posted should work 100%, and I'm glad as you say, it did.
A question for Ray1235, how would I find unused stat slots? 3005, 3006, 3007, and 3008 are unused? And until I make any edits to these, they will return 0?
Title: Re: weapon storage locker (like bo2)
Post by: Soy-Yo on December 12, 2015, 07:20:11 pm
I think if we start making things with setStat, we all should save the number of the stat in a global variable, like: So we can easily change them to avoid overwriting other things. Because if I wanted to add this and the bank to my map, I would have to find every line where setStat or getStat is written to change the number, but maybe someone with no idea in scripting wouldn't know that. Just my opinion.
Title: Re: weapon storage locker (like bo2)
Post by: alaurenc9 on December 12, 2015, 07:23:19 pm
I think if we start making things with setStat, we all should save the number of the stat in a global variable, like: So we can easily change them to avoid overwriting other things. Because if I wanted to add this and the bank to my map, I would have to find every line where setStat or getStat is written to change the number, but maybe someone with no idea in scripting wouldn't know that. Just my opinion.
Well, for now, atleast death_reaper0 could you just change the bank one to use a different stat slot? So people would not get confused?
Title: Re: weapon storage locker (like bo2)
Post by: death_reaper0 on December 12, 2015, 07:26:21 pm
I think if we start making things with setStat, we all should save the number of the stat in a global variable, like: So we can easily change them to avoid overwriting other things. Because if I wanted to add this and the bank to my map, I would have to find every line where setStat or getStat is written to change the number, but maybe someone with no idea in scripting wouldn't know that. Just my opinion.
dont worry, the bank uses 3005 and this uses 3006-3009. it should only need to be changed if your using one of those for something else
anyway, its been updated, thank you everyone who helped!
Title: Re: weapon storage locker (like bo2)
Post by: Soy-Yo on December 12, 2015, 07:33:01 pm
dont worry, the bank uses 3005 and this uses 3006-3009. it should only need to be changed if your using one of those for something else
Oh. Ok. Thought you were using 3005 for both. And yeah, for now there's no problem, but maybe more people start using this method and it would be nice to have everything organized at the top of the script so we'll know in one second which stats are in use. As I said, it's just my opinion, you don't have to do it if you don't want.
Title: Re: weapon storage locker (carries on between games) v1.1
Post by: alaurenc9 on December 12, 2015, 08:07:30 pm
I'm confused....
You defined literally every variable on the user. Only the stored information needs to be defined on the user. Everything else are just temporary variables that do not need to be this way. Here is how I would put the script together.
I also made it where if you are under the weapon limit, and you have a stored weapon, you can simply take it out without trading your current weapon and have no stored weapon in the locker. Otherwise it will store your current weapon, and if you had a stored weapon, it will give you it. Of course if you feel that it is now more of my script than your script, you don't have to use it. But I don't mind you taking this script and calling it yours and using it etc. as long as credit is given.
Title: Re: weapon storage locker (carries on between games) v1.1
Post by: death_reaper0 on December 12, 2015, 08:18:15 pm
You defined literally every variable on the user. Only the stored information needs to be defined on the user. Everything else are just temporary variables that do not need to be this way. Here is how I would put the script together.
I also made it where if you are under the weapon limit, and you have a stored weapon, you can simply take it out without trading your current weapon and have no stored weapon in the locker. Otherwise it will store your current weapon, and if you had a stored weapon, it will give you it. Of course if you feel that it is now more of my script than your script, you don't have to use it. But I don't mind you taking this script and calling it yours and using it etc. as long as credit is given.
i used varriables cause i was just adapting my original script, its also a little chuncky, i'll probably make a better one later, and i didnt make it ake the weapon if you have a free slot since the bo2 one didnt (at least i dont think it did)
Title: Re: weapon storage locker (carries on between games) v1.1
Post by: alaurenc9 on December 12, 2015, 08:22:41 pm
i used varriables cause i was just adapting my original script, its also a little chuncky, i'll probably make a better one later, and i didnt make it ake the weapon if you have a free slot since the bo2 one didnt (at least i dont think it did)
According to the bo2 script, yes you can take the weapon if you have a free slot and it clears the weapon locker data. So my script is accurate completely to bo2. Anyways let me know if you are going to use my script. If you aren't could you at least do me a favor and test it for me? Because if you don't use it, I want to release it in my own post, and I'll credit you for original script. Would you mind if I did that?
Title: Re: weapon storage locker (carries on between games) v1.1
Post by: death_reaper0 on December 12, 2015, 08:26:44 pm
According to the bo2 script, yes you can take the weapon if you have a free slot and it clears the weapon locker data. So my script is accurate completely to bo2. Anyways let me know if you are going to use my script. If you aren't could you at least do me a favor and test it for me? Because if you don't use it, I want to release it in my own post, and I'll credit you for original script. Would you mind if I did that?
i just looked it up yeah it does use free slots like you said. i'll probably make an update later, im kinda a little busy to test right now so maybe in a few hours from now, i'll pm if it works, or what didnt work
Title: Re: weapon storage locker (carries on between games) v1.2
Post by: RichGaming on April 03, 2016, 02:48:32 pm
Dont know if anyone has pointed this out but if you buy a wall weapon, store it in the fridge then try and rebuy the same wall weapon it will charge you for the weapon but not give it to you. Same happens if you try to take the weapon out of the box.
Title: Re: weapon storage locker (carries on between games) v1.2
Post by: death_reaper0 on April 08, 2016, 04:43:09 pm
its been pointed out to me that this is not compatible with Harry Bo21's perks, so dont use this if you are or plan to use those until i can get it fixed
Title: Re: weapon storage locker (carries on between games) v1.2
Post by: krimzon on May 06, 2016, 01:25:00 pm
I'm not claiming to know the solution, merely asking a question and making a suggestion given the context.
is it possible harry's perks are using a stat slot some where in the same range you are eg 3005?
If so maybe adapt numbers to follow after his?
Maybe it's something else you have an idea on?
I'd be willing to test in any case as my map is currently only using ugx script placer/ugx modtools patch and harry's bo1 perks and wunderfizz( havent updated to widows wine version yet although I hear it has who's who now, not that it's ever been useful to me lolz, but for continuity sake)
Would like to see this working properly as it is a great function that would go great with a multi map style mod (eg. Transit's Bus stop/town/farm inspired mod like Dawnville)
Title: Re: weapon storage locker (carries on between games) v1.2
Post by: Harry Bo21 on May 06, 2016, 01:32:19 pm
I already know what the issue is and it's nothing to do with set stat
I wrote a "give" weapon function to work with my inventory but not a "take" weapon
So when you put your gun in this fridge, player.inventory array still "thinks" you have that gun
Title: Re: weapon storage locker (carries on between games) v1.2
Post by: krimzon on May 09, 2016, 01:04:17 pm
Is it possible to add the take weapon function to your scripts from my end? With your permission of course. Or might that break some other function?
Title: Re: weapon storage locker (carries on between games) v1.2
Post by: RichGaming on May 09, 2016, 02:25:13 pm
Is it possible to add the give weapon function to your scripts from my end? With your permission of course. Or might that break some other function?
Just accept that this doesn't work with Harry's perks. Give Fear and Harry some time to come up with a solution and in the mean time don't include it in your map. Simples.
Title: Re: weapon storage locker (carries on between games) v1.2
Post by: krimzon on May 09, 2016, 02:37:20 pm
Just accept that this doesn't work with Harry's perks. Give Fear and Harry some time to come up with a solution and in the mean time don't include it in your map. Simples.
Can we at least give the man a chance to answer please? I don't feel that I'm out of line in requesting this with respect to his work. Also I'm not trying to rush him just merely offering my assistance in testing and brain storming. Trying to be progressive and active in the community sir.
Title: Re: weapon storage locker (carries on between games) v1.2
Post by: Harry Bo21 on May 09, 2016, 03:03:23 pm
All you need to do is set that array index back to "none"
Prob loop through the array to get the right index
Title: Re: weapon storage locker (carries on between games) v1.2
Post by: krimzon on May 09, 2016, 04:15:36 pm
Would you be willing to assist me on this in a pm when you get a chance sir? I'm in no particular rush as I lead a busy life as well with a home studio,full time job and committed relationship. But I usually have a few hours every morning to put in on my map, taking my time and paying attention to detail on it.
I still have to repurchase bo1&2 on pc (own on console but just recently built new rig capable of modern gaming) so I can port the guns I want in.
Plus I'm producing some custom sounds for ambient,ee song, ee confirm sound as well as building some textures from scratch using source photo's of my own. All of which I intend to release when the map does, as well as any non basic prefabs I have made.
Title: Re: weapon storage locker (carries on between games) v1.2
Post by: Harry Bo21 on May 09, 2016, 05:16:41 pm
Wrote that on my phone so forgive any syntax errors
Title: Re: weapon storage locker (carries on between games) v1.2
Post by: krimzon on May 10, 2016, 11:58:49 am
Haven't tested above script yet but I'm not having the specific wall weapon error mentioned above.
Using ugx mod tools patch v1.0.6 Harrys perks v2.0.4 And reapers current script on front page.
No other edits that would affect inventory
Perks version I have had the array index already set to "none"
I did get a few other inventory oddities.
Noticed
somewhere it's not checking for full weapon inventory gave 3 weapon glitch at some point buying wall weap with same weap in fridge and two gun in inventory
Also doesn't check for same weapon in inventory. When pulling g43 out of fridge and one in inventory it took my pistol and left me with one g43 upon hitting fridge again, got pistol back no issue, g43 in fridge still had g43 in inventory.
Another thing is hintstring stays the same whether you're trading or just putting one in but I also haven't got around to adding trems hintstring fix either, will follow up on that once it's implemented and tested.
I am aware though that these are old perk scripts so I will back up map at this point add update, sort through 50+ pages for error fixing and also add trems hintstring fix. Then I will test above changes thoroughly and report my finding
Should be able to sort syntax errors to as long as I make sure to get updated perks working first sonI know errors aren't coming from different places.
Thanks for taking the time harry as I read you've moved on from modding cod5. Still trying to catch up but I appreciate your patience and assistance very much sir.
Title: Re: weapon storage locker (carries on between games) v1.2
Post by: Harry Bo21 on May 10, 2016, 12:23:33 pm
Haven't tested above script yet but I'm not having the specific wall weapon error mentioned above.
Using ugx mod tools patch v1.0.6 Harrys perks v2.0.4 And reapers current script on front page.
No other edits that would affect inventory
Perks version I have had the array index already set to "none"
I did get a few other inventory oddities.
Noticed
somewhere it's not checking for full weapon inventory gave 3 weapon glitch at some point buying wall weap with same weap in fridge and two gun in inventory
Also doesn't check for same weapon in inventory. When pulling g43 out of fridge and one in inventory it took my pistol and left me with one g43 upon hitting fridge again, got pistol back no issue, g43 in fridge still had g43 in inventory.
Another thing is hintstring stays the same whether you're trading or just putting one in but I also haven't got around to adding trems hintstring fix either, will follow up on that once it's implemented and tested.
I am aware though that these are old perk scripts so I will back up map at this point add update, sort through 50+ pages for error fixing and also add trems hintstring fix. Then I will test above changes thoroughly and report my finding
Should be able to sort syntax errors to as long as I make sure to get updated perks working first sonI know errors aren't coming from different places.
Thanks for taking the time harry as I read you've moved on from modding cod5. Still trying to catch up but I appreciate your patience and assistance very much sir.
sigh...
This will mean you haven't changed the normal give weapon function to mine either
I don't get what's so complicated about this...
The game by default only let's you hold two and "does not" track the order
I had to make a custom function to imitate this behaviour which means you have to edit any scripts you get off this site
Seriously - where is the complication
I'm going to reiterate this one more time
Any - ANY reference to give or take weapon functions needs to be REPLACED with mine or my system will have no idea what you do or don't have. I made it as simple as swapping
Giveweapon
To.
Harrybo21_give_gun
Or something like that - it's in harrybo21_utilities
Seriously that's all it needs - and in this case you need a take gun function coz this script also TAKES your weapons
I gave Instructions on how to change the wall buys and mystery box in the video on page one of said 50 page post....
Title: Re: weapon storage locker (carries on between games) v1.2
Post by: alaurenc9 on May 10, 2016, 10:05:27 pm
Another thing is hintstring stays the same whether you're trading or just putting one in but I also haven't got around to adding trems hintstring fix either, will follow up on that once it's implemented and tested.
What is trem's hintstring fix got to do with anything?
Changing the hintstring depending on the trading or placing or whatever the hell else it says can only be accomplished by BO2's trigger-per-player system, where it spawns multiple triggers and makes them only visible to their specific players, that way different people can see different hinstrings.
Title: Re: weapon storage locker (carries on between games) v1.2
Post by: krimzon on May 11, 2016, 05:15:42 am
Merely missed that fact harry as I haven't updated to 4.0.2 perks yet. Hadn't had any troubles yet so it hadn't come up yet, pehaps because the perks were the only thing I had added. sometime ago as well so I may have just forgot that fact Just stating observations and what scripts I have. Not so much asking for help fixing the things I mentioned, considering I haven't updated perks yet, just stating that I wasn't able to recreate the issue with not receiving wall weapon.
About hintstrings, Again stating observations and that I didn't have trems hintsring update fix so I wasn't sure if that was why or not. Hadn't tested multiplayer yet either. I wasn't aware that was the way it worked alaurenc9 thank you for letting me know.
Might also mention again that I map in what little free time I have, I understand you guy's get alot of issues brought to you by people who need help with every little thing, I'm sorry if I seem like I should know these things but I don't have as much time invested in the forums as most so it's possible that I'll make mistakes but please forgive me, I'd like to be able to bring something to the table and not just be helpless.
Title: Re: weapon storage locker (carries on between games) v1.2
Post by: Harry Bo21 on May 11, 2016, 08:55:34 am
change the code in mapname.gsc to this instead :
they can change this :
to true or false if they need the fix with my perks or not
Title: Re: weapon storage locker (carries on between games) v1.2
Post by: death_reaper0 on May 11, 2016, 01:00:12 pm
to true or false if they need the fix with my perks or not
shall i put this in the original post?
Title: Re: weapon storage locker (carries on between games) v1.2
Post by: Harry Bo21 on May 11, 2016, 04:11:21 pm
can do
Title: Re: weapon storage locker (carries on between games) v1.2
Post by: krimzon on May 11, 2016, 04:40:43 pm
Thank you both for your work here. Good stuff all around.
Reaper, I have a pretty decently detailed modern style fridge prefab made up, can post screens of it. If you like it, You'd be more than welcome to add along side yours in dl.
Title: Re: weapon storage locker (carries on between games) v1.2
Post by: krimzon on May 13, 2016, 12:03:32 pm
Updated to perks 4.0.3
Getting this error with harry's above script
Title: Re: weapon storage locker (carries on between games) v1.2
Post by: Harry Bo21 on May 13, 2016, 02:09:23 pm
Change the text "gun" to
Name
I think
Title: Re: weapon storage locker (carries on between games) v1.2
Post by: krimzon on May 13, 2016, 04:01:01 pm
I realize that I may not have given enough info this is where it throws the error.
There are a lot of references to gun but if I change it to name on initial line I'll have to change it on all references related to that line but not sure which neeed changed and which need left as gun.
I know at least on the == " " instances but not sure if its needed elsewhere.
Edit: these are my assumptions on what is happening in function still learning so good chance I'm wrong entirely.
Title: Re: weapon storage locker (carries on between games) v1.2
Post by: Harry Bo21 on May 13, 2016, 05:38:22 pm
i misread, change
to
it was a missing "function" error
Title: Re: weapon storage locker (carries on between games) v1.2
Post by: krimzon on May 13, 2016, 05:56:50 pm
Thank you harry, +1 That got me past it and into the map. Will now continue testing of functions in game and report back anything i find although given your abilities I doubt I'll have many if any at all.
Double Post Merge: May 13, 2016, 06:02:02 pmWell I was too hasty and should have expected at least something to come up.
Instantly crashes with use of locker with any gun.
Error reads as follows: Attempted to overrun string in call to va()
Title: Re: weapon storage locker (carries on between games) v1.2
Post by: krimzon on May 14, 2016, 08:07:39 pm
Sorry for double post but I've obtained some info that might be of use.
The above error i mentioned is commonly attributed to servers and map rotations with too many maps which causes an overrun in the string because it has too many characters in the string causing it to hit the limit of char's that can be used in a string.
Now considering I'm hitting this on solo without a server mind you i'm not so sure that it's anything to do with server settings.
I also only get it once i hit the locker.
Somewhere it's hitting that character limit on a string once we trigger the storage function.
I make a lot of backups of my mod especially any time i go to add a new feature and this is with only me using harry's perks and his locker fix code provided by him here.
I understand some of what's happening but harry you might know better than i would about what might be causing the string character limit here to be hit.
Taking a look at the script you provided I wonder if it has to do with the way the non storable guns are set up but this is purely my speculation.
Anybody have any ideas on this? I'd be more than happy to learn about the inner workings of the engine and what could be causing this overrun.
Edit: I've also read that a long dvar string can cause this as well which seems more likely, at this juncture, than the server related cause of this error.
Edit 2: Tested setting To false>compiled mod>pulled gun out of locker>closed game>set fix to true>compiled mod> Was able to place gun in locker but it also kept it in inventory and on attempt to trade gun, whether same gun is in inventory or not, it throws the overrun error again.
Title: Re: weapon storage locker (carries on between games) v1.2
Post by: Fancygamer1738 on March 25, 2018, 07:49:15 pm
Pretty nice script. Can't wait to put it into my map.