Mirage Source http://web.miragesource.net/forums/ |
|
Overhead Damage http://web.miragesource.net/forums/viewtopic.php?f=210&t=58 |
Page 1 of 3 |
Author: | grimsk8ter11 [ Thu Jun 01, 2006 9:41 pm ] |
Post subject: | Overhead Damage |
Original Code - GodSentDeath Difficulty - 2/5 ::::::::::::::::::::: ::CLIENT SIDE:: ::::::::::::::::::::: In modClientTCP (or modHandleData, depending on which version of MS you're using) go to the sub "HandleData" and at the bottom before Code: end sub add Code: ' :::::::::::::::::::::::: ' :: Blit Player Damage :: ' :::::::::::::::::::::::: If LCase(Parse(0)) = "blitplayerdmg" Then DmgDamage = Val(Parse(1)) NPCWho = Val(Parse(2)) DmgTime = GetTickCount iii = 0 Exit Sub End If ' ::::::::::::::::::::: ' :: Blit NPC Damage :: ' ::::::::::::::::::::: If LCase(Parse(0)) = "blitnpcdmg" Then NPCDmgDamage = Val(Parse(1)) NPCDmgTime = GetTickCount ii = 0 Exit Sub End If Now go into modGameLogic, at the top of that module, in the declares statements, add these statements Code: Public DmgDamage As Long Public DmgTime As Long Public NPCDmgDamage As Long Public NPCDmgTime As Long Public NPCWho As Long Public ii As Long, iii As Long ' Variables Public NewPlayerX As Long Public NewPlayerY As Long Public NewXOffset As Long Public NewYOffset As Long Public NewX As Long Public NewY As Long Public sx as Long The "Variables" listed above, may be duplicates of something you already have, if they are, you can just delete them. Now, still in modGameLogic go into the GameLoop Sub and under the comment that says ' Lock the backbuffer so we can draw text and names add this code Code: If NPCWho > 0 Then If MapNpc(NPCWho).Num > 0 Then If GetTickCount < NPCDmgTime + 2000 Then Call DrawText(TexthDC, (Player(MyIndex).x) * PIC_X + sx + (Int(Len(NPCDmgDamage)) / 2) * 3 + Player(MyIndex).XOffset - NewXOffset, (Player(MyIndex).y) * PIC_Y + sx - 30 + Player(MyIndex).YOffset - NewYOffset - ii, NPCDmgDamage, QBColor(BrightRed)) End If ii = ii + 1 End If End If If NPCWho > 0 Then If MapNpc(NPCWho).Num > 0 Then If GetTickCount < DmgTime + 2000 Then Call DrawText(TexthDC, (MapNpc(NPCWho).x - NewPlayerX) * PIC_X + sx + (Int(Len(DmgDamage)) / 2) * 3 + MapNpc(NPCWho).XOffset - NewXOffset, (MapNpc(NPCWho).y - NewPlayerY) * PIC_Y + sx - 57 + MapNpc(NPCWho).YOffset - NewYOffset - iii, DmgDamage, QBColor(White)) End If iii = iii + 1 End If End If If you have ANY problems with this code, view the note at the bottom of this tutorial. Carrying on... :::::::::::::::::::::: ::SERVER SIDE:: :::::::::::::::::::::: In modGameLogic the sub NPCAttackPlayer, at the bottom of the sub, but before the Code: end sub add Code: Call SendDataTo(Victim, "BLITNPCDMG" & SEP_CHAR & Damage & SEP_CHAR & END_CHAR) Now in modServerTCP (or possibly modHandleData... does the MSE server use modHandleData for both?) find the HandleDataSub find the "Player Attack Packet" the parse line looks like Code: If LCase(Parse(0)) = "attack" Then Ok, now scroll down in that code, just before the bottom of that packet there is a line that looks like this Code: ' Try to attack a npc if you scroll down just a little bit further, you will see a line that looks like Code: If Damage > 0 Then from that line to the FIRST EXIT SUB should be changed to look like this Code: If Damage > 0 Then Call AttackNpc(Index, i, Damage) Call SendDataTo(Index, "BLITPLAYERDMG" & SEP_CHAR & Damage & SEP_CHAR & i & SEP_CHAR & END_CHAR) Else Call PlayerMsg(Index, "Your attack does nothing.", BrightRed) Call SendDataTo(Index, "BLITPLAYERDMG" & SEP_CHAR & Damage & SEP_CHAR & i & SEP_CHAR & END_CHAR) End If Exit Sub Okay, that is all if you have problems with the red text (npcs attacking you) then you may need to change that line to look like Code: Call DrawText(TexthDC, (Int(Len(NPCDmgDamage)) / 2) * 3 + NewX + sx, NewY - 22 - ii + sx, NPCDmgDamage, QBColor(BrightRed))
That code did not work for me, so i rewrote it as shown at the beginning of the tutorial. Please Post Any Comments/Mistakes. |
Author: | nofan [ Sat Jul 01, 2006 7:43 am ] |
Post subject: | |
Sounds very good, i won't implement this code into the game im working on But i will use the idea of overhead damage, if i do leech off your code credit will be given. Thats a awesome code, i hope it works |
Author: | Robin [ Sat Jul 01, 2006 11:12 am ] |
Post subject: | |
nofan wrote: Sounds very good, i won't implement this code into the game im working on But i will use the idea of overhead damage, if i do leech off your code credit will be given. Thats a awesome code, i hope it works GodSentDeath made this, so give him credits grimsk8ter11 wrote: Original Code - GodSentDeath
And it does work, GSD added it into Konfuze, and so it is in all Elysium bi-products (unless removed) ~Kite |
Author: | Obsidian [ Sat Jul 01, 2006 4:55 pm ] |
Post subject: | |
Yea i wrote the original tutorial, i just ripped it from Konfuze i think... |
Author: | Krloz [ Sat Jul 01, 2006 5:33 pm ] |
Post subject: | |
Allright thanks got no problem at compiling =D |
Author: | Dark Echo [ Mon Jul 03, 2006 8:00 am ] |
Post subject: | |
Just because you have no trouble complining, doesnt mean the everythings working perfectly fine. There might be a logic error, something that the complier wouldnt pick up, since the syntax is correct. Just a thought to keep in the back of your mind.. |
Author: | Krloz [ Mon Jul 03, 2006 6:23 pm ] |
Post subject: | |
Yep I noticed but that was a noobish post when I just started long ago xD |
Author: | Misunderstood [ Mon Jul 03, 2006 7:34 pm ] |
Post subject: | |
long ago? that was today lol. |
Author: | Krloz [ Mon Jul 03, 2006 7:38 pm ] |
Post subject: | |
Exactly 1 day is alot for me >.> |
Author: | Leighland [ Mon Jul 03, 2006 8:43 pm ] |
Post subject: | |
Maybe it's just me, but after adding this it compiles fine, yet the damage isn't displayed... |
Author: | Krloz [ Mon Jul 03, 2006 8:46 pm ] |
Post subject: | |
Its not you I have that problem too xD |
Author: | Obsidian [ Mon Jul 03, 2006 9:42 pm ] |
Post subject: | |
The only problem (that could possibly exist), is where i had written... Quote: ' Lock the backbuffer so we can draw text and names
There is 1 line of code underneath that, i dont remember exactly what is is... but it needs to go after that... So it should be like this... (and this should fix your problem.. if you're getting one) Code: ' Lock the backbuffer so we can draw text and names
'*Should Be a Line here already* If NPCWho > 0 Then If MapNpc(NPCWho).Num > 0 Then If GetTickCount < NPCDmgTime + 2000 Then Call DrawText(TexthDC, (Player(MyIndex).x) * PIC_X + sx + (Int(Len(NPCDmgDamage)) / 2) * 3 + Player(MyIndex).XOffset - NewXOffset, (Player(MyIndex).y) * PIC_Y + sx - 30 + Player(MyIndex).YOffset - NewYOffset - ii, NPCDmgDamage, QBColor(BrightRed)) End If ii = ii + 1 End If End If If NPCWho > 0 Then If MapNpc(NPCWho).Num > 0 Then If GetTickCount < DmgTime + 2000 Then Call DrawText(TexthDC, (MapNpc(NPCWho).x - NewPlayerX) * PIC_X + sx + (Int(Len(DmgDamage)) / 2) * 3 + MapNpc(NPCWho).XOffset - NewXOffset, (MapNpc(NPCWho).y - NewPlayerY) * PIC_Y + sx - 57 + MapNpc(NPCWho).YOffset - NewYOffset - iii, DmgDamage, QBColor(White)) End If iii = iii + 1 End If End If If you check that out, that should be the only reason your code may not work.... If you put this chunk of code BEFORE the line, that comes after the " ' Lock the backbuffer so we can draw text and names " part, you won't see any text. So make sure, you have the Comment, the original line directly after the comment and then that part of the code. I didn't write that part too well when i made the original tutorial. |
Author: | Leighland [ Mon Jul 03, 2006 10:09 pm ] |
Post subject: | |
Oh you mean this? Quote: ' Lock the backbuffer so we can draw text and names
TexthDC = DD_BackBuffer.GetDC I did put it after that... I mean, I'm dumb, but not that dumb no offence to anyone who put it before BTW: Still doesn't work. |
Author: | Robin [ Thu Jul 06, 2006 7:02 am ] |
Post subject: | |
If it doesnt work, just nip over to elysium and rip it out. |
Author: | Obsidian [ Thu Jul 06, 2006 2:53 pm ] |
Post subject: | |
it's odd, because on the backup forum, everyone that tried it had it working, so i dont know why simply moving to this forum... would result in people having errors |
Author: | Leighland [ Thu Jul 06, 2006 9:09 pm ] |
Post subject: | |
^^^^ Thats what I thought... but I just went over there and tried copying it from there and it still didn't work. |
Author: | Anthony [ Sun Jul 09, 2006 4:39 am ] |
Post subject: | |
Just want to expand on this a bit and consider blitting the exp after you kill the npc. Currently I have it sending the data from the server to the client, but I am not sure how to get it to blit when the npc is killed, could anybody help? |
Author: | Rian [ Sun Jul 09, 2006 5:59 am ] |
Post subject: | |
I don't have a project open, but this is how I would go about doing it... Find the sub the tell the NPC to drop the goods when they die, and have the exp sent then, and then have that packet call sub blt_exp |
Author: | Misunderstood [ Sun Jul 09, 2006 1:50 pm ] |
Post subject: | |
you would need to have it as a timer or in the game loop, cause if you just call blt_exp it will only be shown quickly, so maybe set a variable or something. |
Author: | Obsidian [ Sun Jul 09, 2006 10:01 pm ] |
Post subject: | |
i actually redid this entire system, so you can send any overhead message you like, and define who you send it over. I use it to send damage over a players and npcs head, during a fight, so everyone on the map can see how well/bad that player is doing... it also blts exp, when a player takes potions, and a few other things. i might just post a tutorial for that, cause it seems to be a pretty "wanted" feature i've noticed. |
Author: | Krloz [ Sun Jul 09, 2006 10:33 pm ] |
Post subject: | |
Yes please I will give u a cookie =D |
Author: | Coke [ Thu Aug 24, 2006 10:44 pm ] |
Post subject: | |
Just been looking over the old forums (the backup) and i found this post seemed to help some people make it work: ---------------------------------------------------------- Make sure, when you see this ' Lock the backbuffer so we can draw text and names There is a code directly below it. I dont remember what the code is, but make sure you place Code: If NPCWho > 0 Then
If MapNpc(NPCWho).Num > 0 Then If GetTickCount < NPCDmgTime + 2000 Then &nbs p; Call DrawText(TexthDC, (Player(MyIndex).x) * PIC_X + sx + (Int(Len(NPCDmgDamage)) / 2) * 3 + Player(MyIndex).XOffset - NewXOffset, (Player(MyIndex).y) * PIC_Y + sx - 30 + Player(MyIndex).YOffset - NewYOffset - ii, NPCDmgDamage, QBColor(BrightRed)) End If ii = ii + 1 End If End If If NPCWho > 0 Then If MapNpc(NPCWho).Num > 0 Then If GetTickCount < DmgTime + 2000 Then &nbs p; Call DrawText(TexthDC, (MapNpc(NPCWho).x - NewPlayerX) * PIC_X + sx + (Int(Len(DmgDamage)) / 2) * 3 + MapNpc(NPCWho).XOffset - NewXOffset, (MapNpc(NPCWho).y - NewPlayerY) * PIC_Y + sx - 57 + MapNpc(NPCWho).YOffset - NewYOffset - iii, DmgDamage, QBColor(White)) End If iii = iii + 1 End If End If Place that AFTER Quote: ' Lock the backbuffer so we can draw text and names
W/e The Code is that is here moo! |
Author: | grimsk8ter11 [ Wed Sep 06, 2006 2:04 am ] |
Post subject: | |
it doesnt work because oif all of GSDs offsets for scrolling, you need to remove them |
Author: | GodSentDeath [ Wed Sep 06, 2006 6:18 am ] |
Post subject: | |
Basically what grim said I wrote this tutorial using the Elysium Source a while back. I totally forgot to fix it up for MS... bleh, and probably never will! |
Author: | grimsk8ter11 [ Wed Sep 06, 2006 3:08 pm ] |
Post subject: | |
OMG GSD PLX GTALK NOW lol. whered you go O_O. back on topic, ill probably fix it sometime today when i finish my damage class. |
Page 1 of 3 | All times are UTC |
Powered by phpBB® Forum Software © phpBB Group https://www.phpbb.com/ |