UGX-Mods

Call of Duty: Black Ops 3 => Tutorial Desk => Scripting => Topic started by: shinged on October 17, 2016, 12:47:20 am

Title: [Tutorial] Buildable power switch
Post by: shinged on October 17, 2016, 12:47:20 am
Title: Re: [Tutorial] Buildable power switch
Post by: Blink-420 on October 17, 2016, 03:53:28 am
Was hoping for this soon..Thank you very much! Works flawlessly
Title: Re: [Tutorial] Buildable power switch
Post by: Warheez on October 17, 2016, 10:26:54 am
This is beautiful! Going to try it out later  :D

Double Post Merge: October 17, 2016, 04:10:58 pm
Works perfectly! I give it 5 out of 5 Slav-Squats  ;)
Title: Re: [Tutorial] Buildable power switch
Post by: Archaicvirus on November 19, 2016, 07:44:48 pm
Very nice, thanks.

I noticed something in the script: Your functions pick1() and pick2() both thread your build() function, so essentially you have 2 of the same build() functions running in parallel, and build() won't break if you only have 1 part, because the first line wait's until the variable level.allParts equals 2.

Does this explain why some custom maps are playing the power up sound twice for players when you hit the power switch?

The way you have it set up is perfect, but instead of threading build() two times in the pick1() and pick2() functions, just thread build() once before pick1() & pick2() are threaded, and it will only execute once after the variable level.allParts= 2. Then of course remove the "thread build()" line from pick1() and pick2().

Maybe i'm reading it wrong or something, but just thought I would give some potentially helpful feedback. Thanks again, this is very useful.
Title: Re: [Tutorial] Buildable power switch
Post by: reckfullies on November 20, 2016, 10:13:44 am
Very nice, thanks.

I noticed something in the script: Your functions pick1() and pick2() both thread your build() function, so essentially you have 2 of the same build() functions running in parallel, and build() won't break if you only have 1 part, because the first line wait's until the variable level.allParts equals 2.

Does this explain why some custom maps are playing the power up sound twice for players when you hit the power switch?

The way you have it set up is perfect, but instead of threading build() two times in the pick1() and pick2() functions, just thread build() once before pick1() & pick2() are threaded, and it will only execute once after the variable level.allParts= 2. Then of course remove the "thread build()" line from pick1() and pick2().

Maybe i'm reading it wrong or something, but just thought I would give some potentially helpful feedback. Thanks again, this is very useful.

You are correct, from what I see there is also no need to use a while loop inside the build function since waittill only needs to be called once and it will continue to wait.

I believe this was the first script he released so its safe to assume that it might have errors.
Title: Re: [Tutorial] Buildable power switch
Post by: LingerCustomMap on December 30, 2016, 10:01:05 pm
I Will try this :D
Title: Re: [Tutorial] Buildable power switch
Post by: BarkseyLXIX on June 04, 2017, 06:25:05 am
i put the script into to my gsc and loaded the game after i did everything and i got fatal error "getweapon" with 0 parameters in script at line 306
***unresolved external "getweapon" with 0 parameters in script
and this  is what is at line 306, weapon = GetWeapon( PAP_WEAPON_KNUCKLE_CRACK );

can anyone help?
Title: Re: [Tutorial] Buildable power switch
Post by: Archaicvirus on June 05, 2017, 05:01:05 am
i put the script into to my gsc and loaded the game after i did everything and i got fatal error "getweapon" with 0 parameters in script at line 306
***unresolved external "getweapon" with 0 parameters in script
and this  is what is at line 306, weapon = GetWeapon( PAP_WEAPON_KNUCKLE_CRACK );

can anyone help?

You're getting an unresolved variable, which probably means the .gsh file in which PAP_WEAPON_KNUCKLE_CRACK is defined isn't getting parsed or included somewhere. Or simply that PAP_WEAPON_KNUCKLE_CRACK isn't defined. In my script I did it differently, like this
	weapon = GetWeapon("zombie_builder");

and in that script at the top I put
#precache("weapon", "zombie_builder");

I may be wrong, but good luck.
Title: Re: [Tutorial] Buildable power switch
Post by: HitmanVere on June 05, 2017, 12:26:14 pm
You're getting an unresolved variable, which probably means the .gsh file in which PAP_WEAPON_KNUCKLE_CRACK is defined isn't getting parsed or included somewhere. Or simply that PAP_WEAPON_KNUCKLE_CRACK isn't defined. In my script I did it differently, like this
	weapon = GetWeapon("zombie_builder");

and in that script at the top I put
#precache("weapon", "zombie_builder");

I may be wrong, but good luck.

You are somewhat right, but the real reason is that he didn't follow the guide properly:
(https://www.ugx-mods.com/forum/proxy.php?request=http%3A%2F%2Fi.imgur.com%2F7jDn8xZ.png&hash=c79910a4946e0814d591795504ba56b2)
Title: Re: [Tutorial] Buildable power switch
Post by: Archaicvirus on June 05, 2017, 05:40:30 pm
That's cool, how did you crop that part of his tutorial in your reply?
Title: Re: [Tutorial] Buildable power switch
Post by: Scobalula on June 05, 2017, 07:08:27 pm
That's cool, how did you crop that part of his tutorial in your reply?

It's a screenshot.
Title: Re: [Tutorial] Buildable power switch
Post by: GAMERMANRAF on June 26, 2018, 02:35:45 pm
Does this work for Call of Duty World at War??

I really need this for my cod waw custom map  :-\