jcsnider Posted February 9, 2012 Author Share Posted February 9, 2012 I do not make source tutorials very often but here are a few quick edits to enable fogs in Cs:DE.As long as you are able to read and follow directions step by step you will be fine, otherwise you may find this difficult.**CLIENT SIDE.**In modTypes find Private Type Map Rec and Before the End Type add``` Fog As Byte FogOpacity As Byte FogBlendMode As Byte```Next, in Sub SendMap find``` With Map For x = 1 To MAX_MAP_NPCS Buffer.WriteLong .Npc(x) Next End With```UNDER it add``` Buffer.WriteByte Map.Fog Buffer.WriteByte Map.FogOpacity Buffer.WriteByte Map.FogBlendMode```Next, in sub HandleMapData find``` For x = 1 To MAX_MAP_NPCS Map.Npc(x) = Buffer.ReadLong Next```UNDER it add``` Map.Fog = Buffer.ReadByte Map.FogOpacity = Buffer.ReadByte Map.FogBlendMode = Buffer.ReadByte```Next, in Sub MapEditorProperties find,``` .scrlBoss = Map.BossNpc```UNDER it add…``` .scrlFog.value = Map.Fog .scrlFogOpacity.value = Map.FogOpacity .scrlFogBlending.value = Map.FogBlendMode```Find and Replace Sub DrawFog() with this one…```Public Sub DrawFog()Dim fogNum As Long, colour As Long, x As Long, y As Long, renderState As Long fogNum = Map.Fog If fogNum <= 0 Or fogNum > Count_Fog Then Exit Sub renderState = Map.FogBlendMode + 1 colour = D3DColorARGB(Map.FogOpacity, 255, 255, 255) ' render state Select Case renderState Case 1 ' Additive D3DDevice8.SetTextureStageState 0, D3DTSS_COLOROP, D3DTOP_MODULATE D3DDevice8.SetRenderState D3DRS_DESTBLEND, D3DBLEND_ONE Case 2 ' Subtractive D3DDevice8.SetTextureStageState 0, D3DTSS_COLOROP, D3DTOP_SUBTRACT D3DDevice8.SetRenderState D3DRS_SRCBLEND, D3DBLEND_ZERO D3DDevice8.SetRenderState D3DRS_DESTBLEND, D3DBLEND_INVSRCCOLOR End Select For x = 0 To 4 For y = 0 To 3 'RenderTexture Tex_Fog(fogNum), (x * 256) + fogOffsetX, (y * 256) + fogOffsetY, 0, 0, 256, 256, 256, 256, colour RenderTexture Tex_Fog(fogNum), (x * 256), (y * 256), 0, 0, 256, 256, 256, 256, colour Next Next ' reset render state If renderState > 0 Then D3DDevice8.SetRenderState D3DRS_SRCBLEND, D3DBLEND_SRCALPHA D3DDevice8.SetRenderState D3DRS_DESTBLEND, D3DBLEND_INVSRCALPHA D3DDevice8.SetTextureStageState 0, D3DTSS_COLOROP, D3DTOP_MODULATE End IfEnd Sub```Note: There are two lines of code, 1 commented out, that draw the fog, the top one is the scrolling fog while the bottom places it on the screen but does not give the moving effect. It is your choice which type you would like.In sub SaveMap find,``` Put #f, , Map.BossNpc```under it add``` Put #f, , Map.Fog Put #f, , Map.FogOpacity Put #f, , Map.FogBlendMode```In Sub LoadMap find,``` Get #f, , Map.BossNpc```Under it add,``` Get #f, , Map.Fog Get #f, , Map.FogOpacity Get #f, , Map.FogBlendMode```Finally, replace your frmEditor_MapProperties with the one I have attached to this post.(If, for whatever reason you do not want to replace yours, add mine to an empty project and copy over the changes I have made to the bars/labels and the code that goes with them.)**SERVER SIDE**Find Private Type MapRec and before the End Type add``` Fog As Byte FogOpacity As Byte FogBlendMode As Byte```Next, in Sub HandleMapData find``` For x = 1 To MAX_MAP_NPCS Map(mapNum).Npc(x) = Buffer.ReadLong Call ClearMapNpc(x, mapNum) Next```Under it add``` Map(mapNum).Fog = Buffer.ReadByte Map(mapNum).FogOpacity = Buffer.ReadByte Map(mapnum).FogBlendMode = Buffer.ReadByte```Finally, in sub MapCache_Create find,``` For x = 1 To MAX_MAP_NPCS Buffer.WriteLong Map(mapNum).Npc(x) Next```and under it add,``` Buffer.WriteByte Map(mapNum).Fog Buffer.WriteByte Map(mapNum).FogOpacity Buffer.WriteByte Map(mapNum).FogBlendMode```In Sub SaveMap find,``` Put #F, , Map(mapNum).BossNpc```Under it add,``` Put #F, , Map(mapNum).Fog Put #F, , Map(mapNum).FogOpacity Put #F, , Map(mapNum).fogblendmode```Finally, in Sub LoadMaps find,``` Get #F, , Map(i).BossNpc```under it add,``` Get #F, , Map(i).Fog Get #F, , Map(i).FogOpacity Get #F, , Map(i).fogblendmode```And you are done!>! ![](http://www.freemmorpgmaker.com/files/imagehost/pics/afcca64db43198f966447e1c6cdc9a30.png)>! ![](http://www.freemmorpgmaker.com/files/imagehost/pics/4640ad04d0ddf2aa731433baae6821a7.png)Notice: The overall fog system was made by Robin this is just a tutorial to make it work, most of the credit goes to him ;)-jcsniderDo Not forget to replace your frmEditor_MapProperties with the one I have attached below. Link to comment Share on other sites More sharing options...
kibbelz Posted February 9, 2012 Share Posted February 9, 2012 Nice job Jc! Perhaps a screenshot of it in action would be nice :3 Link to comment Share on other sites More sharing options...
crzyone9584 Posted February 9, 2012 Share Posted February 9, 2012 Did jc just come out of no where and posted? Either way its a nice tutorial man. Nice to see you haven't lost your skillz. Link to comment Share on other sites More sharing options...
jcsnider Posted February 9, 2012 Author Share Posted February 9, 2012 Updating the first post, now with screenshots. :D@Crzy, no I didn't come from no where… I came from [here](http://www.touchofdeathforums.com/smf/index.php/topic,78108.msg837154.html#msg837154). Link to comment Share on other sites More sharing options...
crzyone9584 Posted February 9, 2012 Share Posted February 9, 2012 I know you where there. I was just surprised that you made a tutorial for the guy. I've been thinking of getting the CS:DE from robins history bundle and start making a game with it. Id I do I'll add this into it. It looks really nice. Link to comment Share on other sites More sharing options...
jcsnider Posted February 10, 2012 Author Share Posted February 10, 2012 Good luck XD. Link to comment Share on other sites More sharing options...
LOLOLOL Posted February 10, 2012 Share Posted February 10, 2012 Thanks for this :D Link to comment Share on other sites More sharing options...
Techos Posted February 11, 2012 Share Posted February 11, 2012 Worked! good jobEDIT:After a day its not working anymore :confused:i always got an error ''Runtime Error 380: Invalid Property Value"it highlights/\/\V Link to comment Share on other sites More sharing options...
Growlith1223 Posted April 24, 2012 Share Posted April 24, 2012 THX for this!!!! :DEDIT: For some reason, when i click Send, it doesn't save it Server Side D:When i save, it saves it Client Side but it doesn't save it to the Server >.<Help is greatly appreciatedEDIT2: NVM i got it to work xD Link to comment Share on other sites More sharing options...
santa-clause Posted May 1, 2012 Share Posted May 1, 2012 Works perfectly only the cmdmoral (button) must be replaced with the original button Link to comment Share on other sites More sharing options...
Synergy Posted May 18, 2012 Share Posted May 18, 2012 This sort of works for me..When I add the fog in the map editor (properties) it appears, and it works. However, as soon as I save the map (Send) it disappears..I have no idea why. Has anyone else had this problem, and how do I fix it?Thanks. Link to comment Share on other sites More sharing options...
Synergy Posted May 20, 2012 Share Posted May 20, 2012 If anyone else had the "Runtime Error 380" problem, the same as Ç○D륙 and I did, then have a look here:[http://www.touchofdeathforums.com/smf2/index.php/topic,80277.msg859285.html#new](http://www.touchofdeathforums.com/smf2/index.php/topic,80277.msg859285.html#new)That should fix it. Link to comment Share on other sites More sharing options...
Finalmix16 Posted May 26, 2012 Share Posted May 26, 2012 Wtf I can't make it work..If anyone could upload his CS:DE with working fogs it will be very helpful :)Thanks you ! Link to comment Share on other sites More sharing options...
Growlith1223 Posted May 26, 2012 Share Posted May 26, 2012 because not everything is in the right areas….they are in the right subs but not in the right section of them...just organize them with the other functions n the subs.... Link to comment Share on other sites More sharing options...
Finalmix16 Posted May 26, 2012 Share Posted May 26, 2012 I've just tried but can't find "Sub SendMap find" and all the others modules. aw Link to comment Share on other sites More sharing options...
Growlith1223 Posted May 26, 2012 Share Posted May 26, 2012 it's Sub SendMap Link to comment Share on other sites More sharing options...
Finalmix16 Posted May 26, 2012 Share Posted May 26, 2012 I give up x) Link to comment Share on other sites More sharing options...
Finalmix16 Posted May 26, 2012 Share Posted May 26, 2012 Omg I tried again and didn't find everythingAnyone can upload his CS:DE with working fog ?Edit : Or only the scr folder for both client or server folder. Link to comment Share on other sites More sharing options...
eltony Posted May 27, 2012 Share Posted May 27, 2012 Well i got same problem as Synergy i get what im supposed to do is addNoneSafe ZoneBoss Chamberbut idk how >_can anyone show me how? Link to comment Share on other sites More sharing options...
Finalmix16 Posted May 27, 2012 Share Posted May 27, 2012 I don't understand this : Note: There are two lines of code, 1 commented out, that draw the fog, the top one is the scrolling fog while the bottom places it on the screen but does not give the moving effect. It is your choice which type you would like.How to make the fog moving ? help me please Link to comment Share on other sites More sharing options...
Synergy Posted May 27, 2012 Share Posted May 27, 2012 Eltony, look at the link I posted:[http://www.touchofdeathforums.com/smf2/index.php/topic,80277.msg859285.html#new](http://www.touchofdeathforums.com/smf2/index.php/topic,80277.msg859285.html#new)There's a solution which is really quite easily to follow.But, here's a quick summary:@Synergy:> For the new frmMapProperties, you have to add "None", "Safe Zone" and "Boss Chamber" manually (typing!) to the list - this then creates the correct references in the List and ItemData properties.Finalmix16,There are two lines of code. One has been commented out (it has a ') just delete one of the lines of code. It doesn't matter which, it's up to you.Just remove the comment if you use the top line of code. Link to comment Share on other sites More sharing options...
Wilfre Posted May 27, 2012 Share Posted May 27, 2012 ~~Wow, now I can't open VB6 after I compiled this, it screwed up and now no longer works when I turn it on.~~Works, no issues. Link to comment Share on other sites More sharing options...
Finalmix16 Posted May 27, 2012 Share Posted May 27, 2012 So if I understand, I have to delete this one to make the fog moving ? ' reset render state If renderState > 0 Then D3DDevice8.SetRenderState D3DRS_SRCBLEND, D3DBLEND_SRCALPHA D3DDevice8.SetRenderState D3DRS_DESTBLEND, D3DBLEND_INVSRCALPHA D3DDevice8.SetTextureStageState 0, D3DTSS_COLOROP, D3DTOP_MODULATE End If?(Sorry I'm a noob..) Link to comment Share on other sites More sharing options...
Synergy Posted May 27, 2012 Share Posted May 27, 2012 No.```For x = 0 To 4 For y = 0 To 3 'RenderTexture Tex_Fog(fogNum), (x * 256) + fogOffsetX, (y * 256) + fogOffsetY, 0, 0, 256, 256, 256, 256, colour RenderTexture Tex_Fog(fogNum), (x * 256), (y * 256), 0, 0, 256, 256, 256, 256, colour Next```The ' comments out the line.Delete one of the lines, either:```' RenderTexture Tex_Fog(fogNum), (x * 256) + fogOffsetX, (y * 256) + fogOffsetY, 0, 0, 256, 256, 256, 256, colour```OR:```RenderTexture Tex_Fog(fogNum), (x * 256), (y * 256), 0, 0, 256, 256, 256, 256, colour```If you delete the second one, you need to uncomment the first one. Just delete the ' - hope that helps. Link to comment Share on other sites More sharing options...
Finalmix16 Posted May 27, 2012 Share Posted May 27, 2012 THANK YOU SO MUCH IT WORKS !! 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