UGX-Mods

Call of Duty 5: World at War => Downloadable Items for Mappers => Custom Maps, Mods & Tools => Scripts => Topic started by: Scobalula on May 25, 2016, 08:14:09 am

Title: [Script] LSAT Ammo Counter (+ Usable for other weapons)
Post by: Scobalula on May 25, 2016, 08:14:09 am
This uses a hefty bit of FX, prepare yourself for sp00ki FX error m80.

(https://www.ugx-mods.com/forum/proxy.php?request=http%3A%2F%2Fi.imgur.com%2FXWdV2Is.jpg&hash=96890644cb55d2c1ab5f7801cf5c0c310724706a)

This will play FX based on how much ammo you have on the weapon. Make sure to download first from the bottom of this post. I have also included some info (probably not the best explained) on using another weapon, maybe from Titanfall, etc. as some of them have on weapon displays.


I have included the following:


It's pretty nice to have, and if you want you can modify this for many other things, including using it with other weapons.

https://i.gyazo.com/48964488f0c25c268432a55357435375.mp4 (https://i.gyazo.com/48964488f0c25c268432a55357435375.mp4)

Adding the Scripts


Make sure to copy the stuff from the IWD to the respective folders, root\mods\modname\clienscripts folder should go into your mods folder, and make sure to tick it. Ignore the rig folder for now.

First off, open your mapname.csc in root\mods\modname\clientscripts, if it's not there, copy it from root\raw\clientscripts.

Add this below the telsa line:

Code Snippet
Plaintext
thread clientscripts\_zombiemode_lsatammo::init();


In the same csc, mapname.csc, and mapname.gsc, there is a function called preCacheMyFX(), add these in there:


Code Snippet
Plaintext
 
level._effect["lsat_ammo"] = [];
level._effect["lsat_ammo"][0] = loadfx("scobalula/lsat_numbers/scoba_lsat_num_0");
level._effect["lsat_ammo"][1] = loadfx("scobalula/lsat_numbers/scoba_lsat_num_1");
level._effect["lsat_ammo"][2] = loadfx("scobalula/lsat_numbers/scoba_lsat_num_2");
level._effect["lsat_ammo"][3] = loadfx("scobalula/lsat_numbers/scoba_lsat_num_3");
level._effect["lsat_ammo"][4] = loadfx("scobalula/lsat_numbers/scoba_lsat_num_4");
level._effect["lsat_ammo"][5] = loadfx("scobalula/lsat_numbers/scoba_lsat_num_5");
level._effect["lsat_ammo"][6] = loadfx("scobalula/lsat_numbers/scoba_lsat_num_6");
level._effect["lsat_ammo"][7] = loadfx("scobalula/lsat_numbers/scoba_lsat_num_7");
level._effect["lsat_ammo"][8] = loadfx("scobalula/lsat_numbers/scoba_lsat_num_8");
level._effect["lsat_ammo"][9] = loadfx("scobalula/lsat_numbers/scoba_lsat_num_9");

Make sure to tick the CSC in Launcher. :)

Setting Up/Exporting the model.


Black Ops 2 probably has the engine handle this, so we need joints to play the fx on.

To make this easier, I have included a rig. You NEED to export the model, this is only a rig, I can't release the model.


I won't be answered Maya questions, sorry.  :(

Adding to CSV.


Add the following to any of your CSVs:

Code Snippet
Plaintext
fx,scobalula/lsat_numbers/scoba_lsat_num_9
fx,scobalula/lsat_numbers/scoba_lsat_num_8
fx,scobalula/lsat_numbers/scoba_lsat_num_7
fx,scobalula/lsat_numbers/scoba_lsat_num_6
fx,scobalula/lsat_numbers/scoba_lsat_num_5
fx,scobalula/lsat_numbers/scoba_lsat_num_4
fx,scobalula/lsat_numbers/scoba_lsat_num_3
fx,scobalula/lsat_numbers/scoba_lsat_num_2
fx,scobalula/lsat_numbers/scoba_lsat_num_1
fx,scobalula/lsat_numbers/scoba_lsat_num_0
material,gfx_lsat_ammo_count
material,gfx_lsat_ammo_count2

And that should be it. :) Let me know if you run into any issues with the FX or script. :) If I forgot to include something let me know, I probably did, lol.

For using with your own weapon read the README.h, open in program like Notepad++ for easier reading, I am not good at writing up tutorials like that so it's possibly not explained well, if you need assistance with it contact me.

Credits:
Lilrifa: Assistance with FX
HitmanVere: Assistance with FX
Soyo:
Number Splitting (http://ugx-mods.com/forum/index.php/topic,9215.msg101300.html#msg101300)

Spoiler: click to open...
If you want to claim I "stole" something belong to you do so via PM, I want full proof, and stealing an engine function isn't proof.

I know you're trying to help but please don't respond with "x should have done like y", I release this to help, not to be criticized, and it works, so that's all I care about.
Title: Re: [Script] LSAT Ammo
Post by: Tim Smith on May 25, 2016, 09:26:40 am
Good stuff man. 1+. Fun fact i was just Pm'ing Blunt about it. Matter of fact will this work with titanfall guns ?
Title: Re: [Script] LSAT Ammo
Post by: Scobalula on May 25, 2016, 09:36:25 am
Good stuff man. 1+. Fun fact i was just Pm'ing Blunt about it. Matter of fact will this work with titanfall guns ?

Thanks, it can modified to work with Titan fall weapons, depending on joint names.

Title: Re: [Script] LSAT Ammo
Post by: steviewonder87 on May 25, 2016, 09:55:41 am
You're getting good at this scripting lark Scoba ;)
Title: Re: [Script] LSAT Ammo
Post by: Harry Bo21 on May 25, 2016, 10:11:36 am
Good work scob
Title: Re: [Script] LSAT Ammo
Post by: DidUknowiPwn on May 25, 2016, 03:10:05 pm
You should delete the FX if they're not used.
Title: Re: [Script] LSAT Ammo Counter
Post by: FinalKill9175 on May 25, 2016, 03:28:06 pm
 :rainbow: :rainbow: will definitely do this! +1 thanks!
Title: Re: [Script] LSAT Ammo Counter
Post by: Scobalula on May 25, 2016, 04:15:38 pm
:rainbow: :rainbow: will definitely do this! +1 thanks!

No problem at all, happy to help. :)

Good work scob

You're getting good at this scripting lark Scoba ;)

Thanks. :D
Title: Re: [Script] LSAT Ammo Counter
Post by: Scobalula on May 25, 2016, 05:15:26 pm
Looks like NSZ weapons v1.4 will have an LSAT counter and new muzzles effects thanks to you and Stevie

Nice man, would be nice to see more maps with it. :D
Title: Re: [Script] LSAT Ammo Counter
Post by: FinalKill9175 on May 25, 2016, 10:01:15 pm
Nice man, would be nice to see more maps with it. :D
Hey, I can't find anything in the rigs folder  :-\
Title: Re: [Script] LSAT Ammo Counter
Post by: Scobalula on May 26, 2016, 05:46:23 am
Hey, I can't find anything in the rigs folder  :-\

Oops, fixed and re-uploaded. :)
Title: Re: [Script] LSAT Ammo Counter
Post by: Scobalula on May 28, 2016, 03:03:19 pm
I will be releasing an update today once I write up documentation that will allow people to include their own weapons, along with info on how to do it, set up tags, etc.

Here's an example of the LSAT and RE-45 at the same time with no issues.

(https://i.gyazo.com/f02510703723b794678377b8f423cfe7.gif)

Double Post Merge: May 28, 2016, 06:54:11 pm
Updated.
Title: Re: [Script] LSAT Ammo Counter (+ Usable for other weapons)
Post by: alaurenc9 on June 04, 2016, 01:43:09 pm
So I made my own version of this and it was very problematic, because I could not figure out how to get the timing correct, and the fx would double or flash and all this other shit, anyways I copied your gdt for my materials because that's the only thing different about yours and mine, because those setting somehow make the new fx replace the last fx or how does that even work? Anyways I copied it into my gdt and it looks pretty good now, except for one thing. The new fx played in the loop does replace the last number when it changes, but my fx are constantly like, doubled. And there is nothing different between my gdt or fx settings from yours. Have any idea what is wrong?

And yes, I'll credit you -_-
Title: Re: [Script] LSAT Ammo Counter (+ Usable for other weapons)
Post by: BluntStuffy on June 04, 2016, 01:56:27 pm
So I made my own version of this and it was very problematic, because I could not figure out how to get the timing correct, and the fx would double or flash and all this other shit, anyways I copied your gdt for my materials because that's the only thing different about yours and mine, because those setting somehow make the new fx replace the last fx or how does that even work? Anyways I copied it into my gdt and it looks pretty good now, except for one thing. The new fx played in the loop does replace the last number when it changes, but my fx are constantly like, doubled. And there is nothing different between my gdt or fx settings from yours. Have any idea what is wrong?

And yes, I'll credit you -_-

Like i told you in pm before, it's all about the timing. You're fx-life time is prob too long ( causing two fx' to show up, and it looking laggy when you move around quickly ) I use 15m miliseconds, so 0.015 as life-time in fx-ed. And loop the fx with a realwait(0.01). It's not to do with the materials, its just the timing..
Title: Re: [Script] LSAT Ammo Counter (+ Usable for other weapons)
Post by: HitmanVere on June 04, 2016, 04:55:58 pm
So I made my own version of this and it was very problematic, because I could not figure out how to get the timing correct, and the fx would double or flash and all this other shit, anyways I copied your gdt for my materials because that's the only thing different about yours and mine, because those setting somehow make the new fx replace the last fx or how does that even work? Anyways I copied it into my gdt and it looks pretty good now, except for one thing. The new fx played in the loop does replace the last number when it changes, but my fx are constantly like, doubled. And there is nothing different between my gdt or fx settings from yours. Have any idea what is wrong?

And yes, I'll credit you -_-

I helped Scoba with FX, since he had issue of it flickering. Turned out he had set FX count 0 to 1. Maybe you have added random value as well, so it shows doubled, for example, 1 to 1?
Title: Re: [Script] LSAT Ammo Counter (+ Usable for other weapons)
Post by: alaurenc9 on June 04, 2016, 05:25:15 pm
Like i told you in pm before, it's all about the timing. You're fx-life time is prob too long ( causing two fx' to show up, and it looking laggy when you move around quickly ) I use 15m miliseconds, so 0.015 as life-time in fx-ed. And loop the fx with a realwait(0.01). It's not to do with the materials, its just the timing..
Yes I have tried this but RealWait is too imperfect due to the fact that it waits as many frames as it can before the amount of time elapsed is over the amount of time you entered into it, and with small amounts of times, it is really hard for it to be accurate.
I helped Scoba with FX, since he had issue of it flickering. Turned out he had set FX count 0 to 1. Maybe you have added random value as well, so it shows doubled, for example, 1 to 1?
No mine is just 1. After copying the material settings though, the fx did improve in terms of how it works. Before it would show like, lets say a digit changed from 3 to 2, it would show the 3 over the 2, as the 2 fx was finishing up. Now after changing the material stuff, it actually cancels the 2 but some how the fx is still doubling. Let me look into it a bit more.

OK so I put realWait to 0.01 and the fx time to 15 again, and this time it actually looks solid most likely because of the material type changes. I'm pretty sure they made the difference. But yeah now it looks pretty solid, so thank you all for the help.
Title: Re: [Script] LSAT Ammo Counter (+ Usable for other weapons)
Post by: nikfar1 on July 16, 2016, 06:07:04 pm
hi all
I export lsat  from maya to cod,but when I get this weapon, the game is crashed and jumped out and this massage appear:
ERROR: dobj for xmodel ..causing the 128 bones exceeded
can anyone help me?

Title: Re: [Script] LSAT Ammo Counter (+ Usable for other weapons)
Post by: Scobalula on July 16, 2016, 06:37:37 pm
hi all
I export lsat  from maya to cod,but when I get this weapon, the game is crashed and jumped out and this massage appear:
ERROR: dobj for xmodel ..causing the 128 bones exceeded
can anyone help me?

Sounds like your character model has a lot of bones, I am using Player Models from Town (Suit and Hazmat) and haven't had this issue but I remember reading that the weapon model (viewmodel) + player model count towards this 128 Limit, what character models are you using?

EDIT: mean viewhands, not character model, lmao.
Title: Re: [Script] LSAT Ammo Counter (+ Usable for other weapons)
Post by: nikfar1 on July 16, 2016, 07:04:24 pm
Sounds like your character model has a lot of bones, I am using Player Models from Town (Suit and Hazmat) and haven't had this issue but I remember reading that the weapon model (viewmodel) + player model count towards this 128 Limit, what character models are you using?

EDIT: mean viewhands, not character model, lmao.
thanks for replying
I am using default character( char_polonsky)
Title: Re: [Script] LSAT Ammo Counter (+ Usable for other weapons)
Post by: Scobalula on July 16, 2016, 08:16:12 pm
thanks for replying
I am using default character( char_polonsky)

What about your viewhands?
Title: Re: [Script] LSAT Ammo Counter (+ Usable for other weapons)
Post by: nikfar1 on July 17, 2016, 02:23:29 pm
What about your viewhands?
my viewhands in game is default but in maya is viewmodel_usa_hazmat_arms
I rigged my model in maya that you said
I tried to delete some of joint of gun that not important and it worked but I have not good anim in reloading
maya:

(https://www.ugx-mods.com/forum/proxy.php?request=http%3A%2F%2Fkorgpa1x.persiangig.com%2Ftemp_ali%2Fff.JPG&hash=d2522c37c63fc934f1bef76b1f64ae498cac23b3)


in game:

(https://www.ugx-mods.com/forum/proxy.php?request=http%3A%2F%2Fkorgpa1x.persiangig.com%2Ftemp_ali%2Fbandicam%25202016-07-17%252018-48-22-712.jpg&hash=456bd354ac0e4fa63873c776ee4f05d3b291afba)
Title: Re: [Script] LSAT Ammo Counter (+ Usable for other weapons)
Post by: Scobalula on July 17, 2016, 02:50:33 pm
my viewhands in game is default but in maya is viewmodel_usa_hazmat_arms
I rigged my model in maya that you said
I tried to delete some of joint of gun that not important and it worked but I have not good anim in reloading
maya:

(http://korgpa1x.persiangig.com/temp_ali/ff.JPG)


in game:

(http://korgpa1x.persiangig.com/temp_ali/bandicam%202016-07-17%2018-48-22-712.jpg)

That's weird, with the rig included + hazmat for me it comes in at only 91 joints in the scene, far from the 128 limit:

(https://www.ugx-mods.com/forum/proxy.php?request=http%3A%2F%2Fimage.prntscr.com%2Fimage%2F5616a16bdef44770815a115eaae99633.jpeg&hash=06026f5ea470c63a506009a3cdd9ed7daebaa0a9)

Run this script that the bottom where it says "MEL" in Maya and see what joint count is:

Code Snippet
Plaintext
SelectAllJoints;
string $stuff[] = `ls -sl`;

int $numbjoints = `size($stuff)`;

print("Number of Joints in the scene: "+ $numbjoints +"\n");

(https://www.ugx-mods.com/forum/proxy.php?request=http%3A%2F%2Fimage.prntscr.com%2Fimage%2Fcaab431a50e94b85900e45f9d5b06032.jpeg&hash=11c4c366ab4a10ed81bc7daaf8449024b86edc54)
Title: Re: [Script] LSAT Ammo Counter (+ Usable for other weapons)
Post by: nikfar1 on July 17, 2016, 03:17:40 pm
That's weird, with the rig included + hazmat for me it comes in at only 91 joints in the scene, far from the 128 limit:

Run this script that the bottom where it says "MEL" in Maya and see what joint count is:

Code Snippet
Plaintext
SelectAllJoints;
string $stuff[] = `ls -sl`;

int $numbjoints = `size($stuff)`;

print("Number of Joints in the scene: "+ $numbjoints +"\n");

(http://image.prntscr.com/image/caab431a50e94b85900e45f9d5b06032.jpeg)
thanks for helping
Number of Joints in the scene: 91
yes,That's weird
Title: Re: [Script] LSAT Ammo Counter (+ Usable for other weapons)
Post by: nikfar1 on July 18, 2016, 07:45:16 pm
finally I found my problem and fix this  ;)
thanks
Title: Re: [Script] LSAT Ammo Counter (+ Usable for other weapons)
Post by: Scobalula on July 18, 2016, 11:09:27 pm
finally I found my problem and fix this  ;)
thanks

It would be great to know what you done to fix it in case others ran into the issue.
Title: Re: [Script] LSAT Ammo Counter (+ Usable for other weapons)
Post by: nikfar1 on July 19, 2016, 02:49:00 am
It would be great to know what you done to fix it in case others ran into the issue.
my worldmodel  in weapon file was same to viewmodel and I forgot to change it to worldmodel and for this reason I had more than 128 joint.