UGX-Mods

Call of Duty 5: World at War => Help Desk => Scripting => Topic started by: KDXDARK on April 02, 2014, 08:42:52 pm

Title: Powerup problem
Post by: KDXDARK on April 02, 2014, 08:42:52 pm
so i create a custom powerup script and i dont know why it dont give me the weapon

here is the script

Code Snippet
Plaintext
	add_zombie_powerup( "god_ray", 		"weapon_usa_ray_gun",					&"" );

Code Snippet
Plaintext
					case "god_ray":
players[i] thread god_ray_powerup( self );
break;

Code Snippet
Plaintext
god_ray_powerup( drop_item, player_won )
{
players = get_players();
i = player_won;
players[i] TakeAllWeapons();
players[i] playsound( "god_power");
players[i] giveWeapon("ray_gun2");
players[i] SwitchToWeapon( "ray_gun2" );
}

also i try using "self" but it dont work :/
Title: Re: Powerup problem
Post by: daedra descent on April 02, 2014, 08:59:14 pm
None of the code that you posted helps any because their not giving the full context of the script itself.

However for this,

Code Snippet
Plaintext
god_ray_powerup( drop_item, player_won )
{
players = get_players();
i = player_won;
players[i] TakeAllWeapons();
players[i] playsound( "god_power");
players[i] giveWeapon("ray_gun2");
players[i] SwitchToWeapon( "ray_gun2" );
}

self should probably be used... i mean it works but you need to define the player by passing the number through when you could just use self which would be more efficient. also the function argument "drop_weapon" isn't used, so it should probably be removed.
Title: Re: Powerup problem
Post by: KDXDARK on April 02, 2014, 09:20:03 pm
well now it give me the weapon but it dont play the sound :/
Title: Re: Powerup problem
Post by: daedra descent on April 02, 2014, 09:23:27 pm
well now it give me the weapon but it dont play the sound :/

Maybe you need to define the sound origin like:

Code Snippet
Plaintext
playsound( "god_power", self.origin);

does that work?
Title: Re: Powerup problem
Post by: KDXDARK on April 02, 2014, 09:54:08 pm
well the problem was in the .csv but thanks daedra +1 :D
Title: Re: Powerup problem
Post by: chromastone10 on April 14, 2014, 05:52:43 pm
well the problem was in the .csv but thanks daedra +1 :D

Can I expect a tutorial for this? It would be pretty cool