Home » MODDING HQ 1.13 » Flugente's Magika Workshop » New feature: Externalised Merchants
Re: New feature: Externalised Merchants[message #360388 is a reply to message #360386] Wed, 17 June 2020 01:06 Go to previous messageGo to previous message
Flugente

 
Messages:3509
Registered:April 2009
Location: Germany
As expected, it works fine. I'm using a lua function that looks like this:

-- functions used here:
-- 
-- path: path and name of soundfile we want to play (in .wav, .ogg or .mp3 format)
-- volume: optional sound volume (65: medium volume, 127: loud), default 65
-- PlaySound(path, volume)

-- handle
-- sSectorX, sSectorY and bSectorZ indicate the sector coordinates
-- ubMerchantID is the ID of the merchant for whom this is called
-- usQuoteNum is the event of the dialogue that is supposed to be called 
function HandleNPCMerchantQuote(sSectorX, sSectorY, bSectorZ, ubMerchantID, usQuoteNum )

        -- test sounds
	choicenr = math.random(1, 7)
			
	if ( choicenr == 1 ) then     	PlaySound("Sounds//Weapons//38//38 CALIBER.ogg")
	elseif ( choicenr == 2 ) then 	PlaySound("Sounds//Weapons//38//38SUPER PISTOL SINGLE SHOT.ogg")
	elseif ( choicenr == 3 ) then 	PlaySound("Sounds//Weapons//38//380 MAC11 BURST 5.ogg")
	elseif ( choicenr == 4 ) then 	PlaySound("Sounds//Weapons//RIFLE SILENCER BURST 5.ogg")
	elseif ( choicenr == 5 ) then 	PlaySound("Sounds//Weapons//PUMP-ACTION.ogg")
	elseif ( choicenr == 6 ) then 	PlaySound("Sounds//Weapons//BOLT-ACTION SPRINGFIELD.ogg")
	elseif ( choicenr == 7 ) then 	PlaySound("Sounds//Weapons//50CAL.WAV")
	end

end

As I assume the plan isn't to have the merchants double as firearms, this is where the sounds would go. ubMerchantID is the ID used when placing a merchant in HandleSectorTacticalEntry(...) in strategicmap.lua:

-- armour store (Skin Tight Fashions)
CreateCivilian(13010, CivGroup.KINGPIN_CIV_GROUP, 67, Bodytype.MINICIV, -1, -1, -1, -1, -1, -1, -1, -1)

so in this case it would be 67. usQuoteNum meanwhile is number of the quote that would be played if this were a profile-based merchant, which I posted earlier.

I could add extra arguments but am not that hopeful about it. Due to the way this lua function is accessed deep in the code, I'd prefer not having to drag in extra arguments, like stats of the merchant themself, though one should already know their bodytype and thus gender as we set that ourselves via CreateCivilian(...)

The only thing I'm unsure of is whether to add any sounds from movies/games/etc. you find to the GameDir trunk. That feels... unsafe, which is one of the reasons the mercs I made are not part of 1.13.
But even then nothing would stop one from simply packing the sounds as an addon.

[Updated on: Wed, 17 June 2020 01:09]




I know now that it could never work between us, as much as we wanted to, it could never be! Not because you're a rabbit, but because you're black.

If you want, you can donate to me. This will not affect how and what I code, and I will not code specific features in return. I will be thankful though.

Report message to a moderator

Captain

 
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: New feature: Take prisoners, interrogate them
Next Topic: Pending Feature: Increased Team sizes
Goto Forum:
  


Current Time: Fri Mar 29 07:49:07 GMT+2 2024

Total time taken to generate the page: 0.02486 seconds