I was wondering if there was a way to make it so that you can buy Jihad Sounds from the Pointshop, and it will override the default "lalala". What would I add to the Pointshop lua file and to the Jihad lua? Thanks in advance!
Also please note that I am very new to lua.
On purchase set a variable equal to the items sound path, and just replace that in the jihad.
do you mean as a taunt ?
[QUOTE=Nookyava;46086750]On purchase set a variable equal to the items sound path, and just replace that in the jihad.[/QUOTE]
How would I do that?
[url]http://pointshop.burt0n.net/items/functions[/url]
On Equip set the variable == to the sound path.
So for example...
[lua]function ITEM:OnEquip(ply)
ply.JihadTaunt = "taunts/taunt1.wav";
end[/lua]
Then, in the jihad file find where the sound is played and do a check like so...
[lua]if ply.JihadTaunt then
self.Owner:EmitSound(ply.JihadTaunt);
else
self.Owner:EmitSound(regularjihadsoundpath);
end[/lua]
Also, make sure to set it to nil on holster, so like so.
[lua]function ITEM:OnHolster(ply, mods)
ply.JihadTaunt = nil;
end[/lua]
[QUOTE=CertifiedCode;46086763]do you mean as a taunt ?[/QUOTE]
sorry now i know what you mean ;0
[QUOTE=Nookyava;46086959][url]http://pointshop.burt0n.net/items/functions[/url]
On Equip set the variable == to the sound path.
So for example...
[lua]function ITEM:OnEquip(ply)
ply.JihadTaunt = "taunts/taunt1.wav";
end[/lua]
Then, in the jihad file find where the sound is played and do a check like so...
[lua]if ply.JihadTaunt then
self.Owner:EmitSound(ply.JihadTaunt);
else
self.Owner:EmitSound(regularjihadsoundpath);
end[/lua]
Also, make sure to set it to nil on holster, so like so.
[lua]function ITEM:OnHolster(ply, mods)
ply.JihadTaunt = nil;
end[/lua][/QUOTE]
Okay, I did all that but know I can't buy the item since there's no icon, and usually the icon is generated when you can see the item. How would I add the icon?
Look at the other Pointshop items to see how they do; basically grab a model or material filepath and use ITEM.Material = or ITEM.Model =
[QUOTE=NiandraLades;46088870]Look at the other Pointshop items to see how they do; basically grab a model or material filepath and use ITEM.Material = or ITEM.Model =[/QUOTE]
Yeah, I did try using the code for the Player Models and Materials, but those all move, and I want the icon to just be a picture. Like if I had a Turn Down for What .wav or something like that, I would want a picture of the Lil Jon.
Just use the radio model, that's what I use.
[QUOTE=Nookyava;46088980]Just use the radio model, that's what I use.[/QUOTE]
Okay, I tried doing what you told me to but that just brought up a bunch of errors. But, I was wondering if this would work:
[lua]
if (SERVER) then
timer.Simple(2, function() self:Asplode() end )
self.Owner:EmitSound( "siege/jihad.wav" )
end
[/lua]
and turn that into something that uses ITEM:IsOwned
[lua]
if (SERVER) then
if ITEM:IsOwned("sparta") then
timer.Simple(2, function() self:Asplode() end )
self.Owner:EmitSound( "siege.sparta.wav" )
else
timer.Simple(2, function() self:Asplode() end )
self.Owner:EmitSound( "siege/jihad.wav" )
end
end
[/lua]
This is just how I want it to end up like, and obviously there errors but I don't know how to fix this.
[lua]if (SERVER) then
timer.Simple(2, function() self:Asplode() end )
if self.Owner:PS_HasItemEquipped("sparta") then
self.Owner:EmitSound("siege.sparta.wav")
else
self.Owner:EmitSound("siege/jihad,wav")
end
end
[/lua]
It's PS_HAsItemEquipped, not ITEM.
Please just look at pointshops functions first :) [url]http://pointshop.burt0n.net/player-meta-functions/items#has-item-equipped[/url] and btw its PS_HasItemEquipped('item')
I just precached a table of sounds and networked the default sound that when you equip the jihad taunt via pointshop it'll replace the default sound with the one you just bought. (Thanks you Baby Weiner)
When I get home I can help you.
Edit: I lied.
So in the jihad file where it was calling the sound I did:
[CODE]if (SERVER) then
timer.Simple(2, function() self:Asplode() end )
local expsound = self.Owner:GetNetworkedVar("esound", "siege/jihad.wav")
self.Owner:EmitSound( expsound )
end
end[/CODE]
Then in the pointshop sounds I did:
[CODE]
function ITEM:OnEquip(ply)
ply:SetNetworkedVar("esound", "taunts/daddy.mp3")
end
[/CODE]
Why would you set a network var? That's a terrible idea. Just do what I suggested..
[QUOTE=Nookyava;46104950]Why would you set a network var? That's a terrible idea. Just do what I suggested..[/QUOTE]
I'm not saying he should do this. I'm just saying that that was how I did it.
Then why even give him the example? It's just going to confuse him.
[QUOTE=Nookyava;46105087]Then why even give him the example? It's just going to confuse him.[/QUOTE]
The example is for learning purposes. I'd rather have many different ways of doing something rather than just one way because it could benefit me in a future project.
[QUOTE=Aeternal;46105165]The example is for learning purposes. I'd rather have many different ways of doing something rather than just one way because it could benefit me in a future project.[/QUOTE]
I agree with helping with other projects, I constantly go back to stuff I made in the past to remember how to do it. The more code you have, the more knowledge in your files :D
Why is there no video on how to do this yet????? there are like 8 post's about this. but no one who nknows how to do this has made a video yet.
It's so basic no one even bothered to do it. All you need to do is:
Assign a variable to the player on equip
Change the sound of the jihad so that it plays the sound from it's owner instead of the normal sound
It takes 5 seconds for someone with even the most basic of Lua knowledge.
[editline]11th February 2015[/editline]
It's even right up there, 5th post.
I have figered out how to do this. with some help from @Nookyava's coded jihad. i might make a video on it latter today.
Sorry, you need to Log In to post a reply to this thread.