Guest Posted September 19, 2012 Share Posted September 19, 2012 download link[http://www.freemmorpgmaker.com/files/imagehost/pics/e7af871755961eafa51c68ceea14fb42.rar](http://www.freemmorpgmaker.com/files/imagehost/pics/e7af871755961eafa51c68ceea14fb42.rar)if any credit is due anywhere it goes to robin.In this tut you will be able to make your npcs alpha blend and turn it on and off. you can just as easily change it to work with players, or anything else for that matter. even alphaed paperdolls. i will cover a few of the things you can easily change to make this work for you.**ALL Client Side.**add the attached **alphablend.dll** to your **client directory**add the attached **alphablend module** to your **client**at the bottom of **frmmain** add```Private Sub optAlphaff_Click()' If debug mode, handle error then exit outIf Options.Debug = 1 Then On Error GoTo errorhandlerOptions.alpha = 0' save to config.iniSaveOptions' Error handlerExit Suberrorhandler:HandleError "optMOff_Click", "frmMain", Err.Number, Err.Description, Err.Source, Err.HelpContextErr.ClearExit SubEnd SubPrivate Sub optAlphaOn_Click()' If debug mode, handle error then exit outIf Options.Debug = 1 Then On Error GoTo errorhandlerOptions.alpha = 1' save to config.iniSaveOptions' Error handlerExit Suberrorhandler:HandleError "optMOff_Click", "frmMain", Err.Number, Err.Description, Err.Source, Err.HelpContextErr.ClearExit SubEnd Sub```in **frmmain** add a lablel and set its caption to **Alpha Blending**in **frmmain** add a option box to the option window named **optAlphaOn**in **frmmain** add a option box to the option window named optAlphaffopen your **config.ini** file and add **alpha= 1** to the listsearch for **Private Type OptionsRec**below```Sound As Byte```add```alpha as byte```search for **Call PutVar(fileName, "Options", "Sound", str(Options.Sound))**below it add```Call PutVar(fileName, "Options", "Alpha", str(Options.alpha))```search for **Options.Sound = GetVar(fileName, "Options", "Sound")**below it add```Options.alpha = GetVar(fileName, "Options", "Alpha")```at the bottom of **Public Sub LoadOptions()**add```If Options.alpha = 0 Then frmMain.optAlphaff.Value = TrueElse frmMain.optAlphaOn.Value = TrueEnd If```search for **Public Sub BltNpc(ByVal MapNpcNum As Long)**and change it to```Public Sub BltNpc(ByVal MapNpcNum As Long, alpha As Boolean)```then directly below the other dims in **sub bltnpc** add```Dim aDC, bDC As Long```now find this bit further down the same sub….**sub bltnpc**```' Proceed as normal y = MapNpc(MapNpcNum).y * PIC_Y + MapNpc(MapNpcNum).YOffsetEnd If```directly below that code add this```' render the actual sprite in alpha blendIf alpha = True Then If Sprite = 146 Then aDC = DDS_BackBuffer.GetDC bDC = DDS_Character(Sprite).GetDC If Options.alpha = 1 Then FoxAlphaBlend aDC, ConvertMapX(x), ConvertMapY(y), 32, 32, bDC, rec.Left, rec.top, 100, RGB(255, 0, 255), 1 Else Options.alpha = 0 FoxAlphaBlend aDC, ConvertMapX(x), ConvertMapY(y), 32, 32, bDC, rec.Left, rec.top, 255, RGB(255, 0, 255), 1 End If DDS_BackBuffer.ReleaseDC aDC DDS_Character(Sprite).ReleaseDC bDC Else Call BltSprite(Sprite, x, y, rec) End IfEnd If```at the bottom comment out or delete this line```Call BltSprite(Sprite, x, y, rec)```next find this bit of code in **moddirectdraw7**```' Npcs For i = 1 To Npc_HighIndex If MapNpc(i).y = y Then Call BltNpc(i) End If Next```change to this```' Npcs For i = 1 To Npc_HighIndex If MapNpc(i).y = y Then Call BltNpc(i, True) End If Next```ok thats it. now on to the explaining bits.```'render the actual sprite in alpha blendIf alpha = True Then 'this here can be replaced by a case select if you wanted, in this case i set my ghost to sprite number 146 via the npc editor. so if its that sprite, it will be alpha blended. If Sprite = 146 Then aDC = DDS_BackBuffer.GetDC bDC = DDS_Character(Sprite).GetDC If Options.alpha = 1 Then 'these 32, 32 numbers are the sprites frame size, set it to your sprites frames size, a player sprite is 32, 48 standard i belive. ' the 100 in this line is the level of alpha being applied. in the latter its 255\. 255 = max FoxAlphaBlend aDC, ConvertMapX(x), ConvertMapY(y), 32, 32, bDC, rec.Left, rec.top, 100, RGB(255, 0, 255), 1 Else Options.alpha = 0 ' the rgb stuff is the color used for the alpha blending, its set to the stock purple magenta color that eo sprites are backed against. FoxAlphaBlend aDC, ConvertMapX(x), ConvertMapY(y), 32, 32, bDC, rec.Left, rec.top, 255, RGB(255, 0, 255), 1 End If DDS_BackBuffer.ReleaseDC aDC DDS_Character(Sprite).ReleaseDC bDC Else 'down here we do the normal calling of the sprite. Call BltSprite(Sprite, x, y, rec) End IfEnd If``` Link to comment Share on other sites More sharing options...
Zzbrandon Posted September 19, 2012 Share Posted September 19, 2012 What does this exactly do? Link to comment Share on other sites More sharing options...
Guest Posted September 19, 2012 Share Posted September 19, 2012 well in this edit it will make npc with sprite #146 be alpha blended and apear more ghost like. it can be changed to apply the effect to anything. Link to comment Share on other sites More sharing options...
tslusny Posted September 19, 2012 Share Posted September 19, 2012 Why you maked it as ON/OFF value, why you do not saved it as value from 0 to 255 and then make scrollbar for setting it in NPC editor and then read from it and not just check if its highter than 0 then alphablend it at specific value Link to comment Share on other sites More sharing options...
Guest Posted September 19, 2012 Share Posted September 19, 2012 > Why you maked it as ON/OFF value, why you do not saved it as value from 0 to 255 and then make scrollbar for setting it in NPC editor and then read from it and not just check if its highter than 0 then alphablend it at specific valueim sure you could. why dont you post your edit? Link to comment Share on other sites More sharing options...
tslusny Posted September 19, 2012 Share Posted September 19, 2012 > im sure you could. why dont you post your edit?And why yes? I am using DX8 ![:)](http://www.touchofdeathforums.com/community/public/style_emoticons/<#EMO_DIR#>/smile.png) Link to comment Share on other sites More sharing options...
Valentine90 Posted September 20, 2012 Share Posted September 20, 2012 That's fine, but do not recommend, especially these days when we have DirectX8, the alpha leaves the game slow. Link to comment Share on other sites More sharing options...
bunny123 Posted September 22, 2012 Share Posted September 22, 2012 I made a quick edit that only requires one check box.Delete the label, **optAlphaOn**, and **optAlphaff**.Add one check box, name it chkAlpha.Replace the frmMain code with:```Private Sub chkAlpha_Click()' If debug mode, handle error then exit outIf Options.Debug = 1 Then On Error GoTo errorhandlerOptions.alpha = 0' save to config.iniSaveOptions' Error handlerExit Suberrorhandler:HandleError "optMOff_Click", "frmMain", Err.Number, Err.Description, Err.Source, Err.HelpContextErr.ClearExit SubEnd Sub```At the bottom of **Public Sub LoadOptions()**, replace```If Options.alpha = 0 ThenfrmMain.optAlphaff.Value = TrueElsefrmMain.optAlphaOn.Value = TrueEnd If```with```frmMain.optAlphaff.Value = Options.alpha = 0```Done. Link to comment Share on other sites More sharing options...
Zzbrandon Posted September 22, 2012 Share Posted September 22, 2012 Why not just simply make the npc transparency ghostlike instead of adding this script it slow game?? Link to comment Share on other sites More sharing options...
bunny123 Posted September 22, 2012 Share Posted September 22, 2012 By the way, I fixed my above post. I have NO idea how the optAlphaOn code got in there! :/ Link to comment Share on other sites More sharing options...
Guest Posted September 22, 2012 Share Posted September 22, 2012 good stuff. nice to see someone help out. Link to comment Share on other sites More sharing options...
VKAllstar Game.NET Posted May 1, 2015 Share Posted May 1, 2015 upload new link please . i can't download it TT Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now