![]() |
[Feature] Random blood - Printable Version +- Mirage Source (https://mirage-engine.uk/forums) +-- Forum: Mirage Source (Nostalgia) (https://mirage-engine.uk/forums/forumdisplay.php?fid=61) +--- Forum: Archive (2006-2011) (https://mirage-engine.uk/forums/forumdisplay.php?fid=18) +---- Forum: Source Code Development (https://mirage-engine.uk/forums/forumdisplay.php?fid=51) +----- Forum: Mirage Source 4 (Visual Basic 6) (https://mirage-engine.uk/forums/forumdisplay.php?fid=44) +------ Forum: Tutorials (https://mirage-engine.uk/forums/forumdisplay.php?fid=13) +------ Thread: [Feature] Random blood (/showthread.php?tid=2813) |
[Feature] Random blood - GIAKEN - 20-05-2009 Difficulty: 1/5 - Copypasta mmm Introduction: This tutorial will add some random blood splatters to your game when you attack NPCs / players. Now, lets get started... SERVER-SIDE [spoiler]First thing, add this to the bottom of the "Public Enum ServerPackets": Code: SBloodSplatter Now add this in modTypes: Code: Public TempTile() As TempTileRec Now under: Code: ReDim MapCache(1 To MAX_MAPS) As String Add this: Code: ReDim TempTile(1 To MAX_MAPS) As TempTileRec Find this: Code: Public Sub PlayerWarp(ByVal Index As Long, ByVal MapNum As Long, ByVal x As Long, ByVal y As Long) Add this under it: Code: 'sending the blood splatter packet without any data will tell the client to clear Add this Random function to modGameLogic or whatever: Code: Function Random(Lowerbound As Integer, Upperbound As Integer) As Integer Now add this Sub in modGameLogic or wherever: Code: Public Sub SendBlood(ByVal Map As Long, ByVal Target As Long, ByVal TargetType As Long) Now find this in Sub AttackNpc: Code: ' Check for weapon Under add this: Code: SendBlood GetPlayerMap(Attacker), MapNpcNum, TARGET_TYPE_NPC Find this in Sub AttackPlayer: Code: ' reduce dur. on victims equipment Under add: Code: SendBlood GetPlayerMap(Victim), Victim, TARGET_TYPE_PLAYER Find: Code: Do While ServerOnline Under add: Code: For x = 1 To MAX_MAPS And now ~............. CLIENT-SIDE [spoiler]First thing, add this to the bottom of the "Public Enum ServerPackets": Code: SBloodSplatter Now add this in modTypes: Code: Public Blood(1 To 50) As BloodRec At the top of modDirectDraw7 add this: Code: Public DDS_Blood As DirectDrawSurface7 Then in Sub InitSurfaces add this: Code: InitDDSurf "blood", DDSD_Blood, DDS_Blood Now add this sub to modDirectDraw or wherever: Code: Public Sub DrawBloods() Now find: Code: BltMapTiles Under add: Code: If BloodHighIndex > 0 Then DrawBloods Now at the bottom of modHandleData add: Code: Private Sub HandleBloodSplatter(ByRef Parse() As String) Now find: Code: Select Case Parse(0) Under add: Code: Case SBloodSplatter Finally in modGlobals add this to the top: Code: Public BloodHighIndex As Long And that SHOULD be it...I might have left something out... ----------------------------------- Oh yeah, and in your gfx folder add this: CREDITS GO TO BLODYAVENGER IF YOU USE. STYLE IS FOR 16-BIT GAMES, LIKE FF1. http://mayhem.auburnflame.com/blood.bmp Customizing and explanations: With that blood.bmp, there are 6 different bloods able to be selected. If you want to change that, simply change this line in server-side: Code: .Pic = Random(0, 5) That randomly selects between 6 blood pictures. If you want to control if blood disappears faster, change this in the server in Sub SendBlood: Code: .Timer = GetTickCountNew + 30000 That tells the server to get rid of the blood in 30 seconds. If you want to make a chance the blood appears, get rid of the comment on the second line here in Sub SendBlood: Code: ' 50% chance blood spawns THAT SHOULD BE ALL! I might have missed something. This was made on my engine made from MS4...so make sure you test with MS4 and post here, please. Re: [Feature] Random blood - Nean - 20-05-2009 Looks awesome man. Great tut. Re: [Feature] Random blood - GIAKEN - 20-05-2009 Oh yeah, here's an example (giving another hint here of another possible tutorial) ![]() Re: [Feature] Random blood - Robin - 30-05-2009 Pretty cool. Nothing I can't do, but I'm sure many people find it useful. +5 rating. |