| Mirage Source http://miragesource.net/forums/ |
|
| Npc Targeting http://miragesource.net/forums/viewtopic.php?f=201&t=4700 |
Page 1 of 2 |
| Author: | Avarit [ Thu Nov 06, 2008 9:32 am ] |
| Post subject: | Npc Targeting |
Hello, These are few questions more targeted to Robin... Its based on the source I got from him [v0.0.9]. But anyone else willing can take a shot at answering them I have a problem right now with targeting NPC's. If I click on myself or another player it tells me that they are my target. But if I click on an NPC [monster/npc], it dosent show them as targeted. I was wondering how I could do that. Also I would like when they are targeted to blt a 32x32 sprite box around them, and also if their a NPC/Friendly to have a seprete sprite [a blue square], and if their a monster [bat/etc.] to blt a seprate [a red square] sprite. Ex: ![]() Thanks *Edit: Heres the code (i think) for the targeting: Code: Public Sub BltTarget()
If TargetType = TARGET_TYPE_PLAYER Then rec.top = 240 rec.Left = 0 rec.Bottom = rec.top + 80 + 8 rec.Right = rec.Left + 48 'rec.top = 0 'rec.Bottom = 20 'rec.Left = 0 'rec.Right = 20 DD_MiddleBuffer.BltFast (Player(Target).X * 32) + Player(Target).XOffset - 8, (Player(Target).Y * 32) + Player(Target).YOffset - 44, DD_MiscSurf, rec, DDBLTFAST_WAIT Or DDBLTFAST_SRCCOLORKEY 'DD_MiddleBuffer.BltFast 20, 20, DD_MiscSurf, rec, DDBLTFAST_SRCCOLORKEY And DDBLTFAST_WAIT Else rec.top = 240 rec.Left = 0 rec.Bottom = rec.top + 80 + 8 rec.Right = rec.Left + 48 DD_MiddleBuffer.BltFast (MapNpc(Target).X * 32) + MapNpc(Target).XOffset - 8, (MapNpc(Target).Y * 32) + MapNpc(Target).YOffset - 44, DD_MiscSurf, rec, DDBLTFAST_WAIT Or DDBLTFAST_SRCCOLORKEY End If End Sub |
|
| Author: | William [ Thu Nov 06, 2008 3:35 pm ] |
| Post subject: | Re: Npc Targeting |
Try and post the code for it, maybe something is wrong with whats currently there. |
|
| Author: | Matt [ Thu Nov 06, 2008 4:48 pm ] |
| Post subject: | Re: Npc Targeting |
For the squares, I suggest you just use directdraw. Don't waste time with the sprite. |
|
| Author: | Avarit [ Thu Nov 06, 2008 5:36 pm ] |
| Post subject: | Re: Npc Targeting |
Allright ill try that, does anyone know whats up with the npc targeting though? |
|
| Author: | GIAKEN [ Thu Nov 06, 2008 10:18 pm ] |
| Post subject: | Re: Npc Targeting |
Here's my BltTargetting sub. Code: Public Sub BltTargetting()
Dim X As Long Dim Y As Long Dim rec As DXVBLib.RECT If Not OverPlay Then If Current_Target = 0 Or Current_TargetType = TARGET_TYPE_NONE Then Exit Sub End If If Current_TargetType = TARGET_TYPE_PLAYER And HasTarget Then If Current_Target <> MyIndex Then If GetPlayerMap(Current_Target) <> GetPlayerMap(MyIndex) Then Exit Sub End If End If With rec .Top = PIC_Y If Not HasTarget Then .Top = 0 .Bottom = .Top + PIC_Y .Left = 40 * TargetLeft .Right = .Left + 40 End With If HasTarget Then If Current_TargetType = TARGET_TYPE_PLAYER Then X = ((Norm.X_Loc(GetPlayerX(Current_Target)) + Player(Current_Target).XOffset) - 4) Y = ((Norm.Y_Loc(GetPlayerY(Current_Target)) + Player(Current_Target).YOffset) + 8) ElseIf Current_TargetType = TARGET_TYPE_NPC Then X = ((Norm.X_Loc(MapNpc(Current_Target).X) + MapNpc(Current_Target).XOffset) - 4) Y = ((Norm.Y_Loc(MapNpc(Current_Target).Y) + MapNpc(Current_Target).YOffset) + 8) End If Else X = (CurX * PIC_X) - 4 Y = (CurY * PIC_Y) + 8 End If If X < 0 Then X = 0 With rec .Left = .Left + (X * -1) End With End If Call DD_BackBuffer.BltFast(X, Y, DD_Target, rec, DDBLTFAST_WAIT Or DDBLTFAST_SRCCOLORKEY) End Sub |
|
| Author: | Avarit [ Fri Nov 07, 2008 12:15 am ] |
| Post subject: | Re: Npc Targeting |
I tried it but it gave me some errors, i guess ill have to modify it Thank you though. Edit* Nope i modified it and it still wont target npc's :/ Double Edit* Im trying to get it when you target an NPC it tells you in the txtChat that it is your target. Right now it only works for players like "n% is now your target." |
|
| Author: | genusis [ Fri Nov 07, 2008 4:47 am ] |
| Post subject: | Re: Npc Targeting |
find where it targets the player when you click on them. copy that paste it where it should be and change to NPC. IT really help me if i saw the code though. like for example, 4.6 code sorry ^^ but basically find something close to this in the player Code: ' Change target TempPlayer(Index).Target = i TempPlayer(Index).TargetType = TARGET_TYPE_PLAYER Call PlayerMsg(Index, "Your target is now " & GetPlayerName(i) & ".", Yellow) //npc// for 4.6 Code: ' Check for an npc For i = 1 To MAX_MAP_NPCS If MapNpc(GetPlayerMap(Index), i).Num > 0 Then If MapNpc(GetPlayerMap(Index), i).x = x And MapNpc(GetPlayerMap(Index), i).y = y Then ' Change target TempPlayer(Index).Target = i TempPlayer(Index).TargetType = TARGET_TYPE_NPC Call PlayerMsg(Index, "Your target is now a " & Trim$(Npc(MapNpc(GetPlayerMap(Index), i).Num).Name) & ".", Yellow) Exit Sub End If TempPlayer(Index).Target = i changes the target selected TempPlayer(Index).TargetType = TARGET_TYPE_NPC changes the target type to npc so it doesn't show up as a player haha ^^ Call PlayerMsg(Index, "Your target is now " & Trim$(Npc(MapNpc(GetPlayerMap(Index), i).Num).Name) & ".", Yellow) calls the message that says "Your target is now npc1. |
|
| Author: | genusis [ Fri Nov 07, 2008 5:16 am ] |
| Post subject: | Re: Npc Targeting |
well the code i used is from MSE 4.6< which i said on there> but basically search for TargetType and you should find it. should be server side for one. in mod handle data in 4.6 so you can try that ^^. just things to help you find it. he must have just deleted his recent post V.V sigh~ |
|
| Author: | Avarit [ Fri Nov 07, 2008 5:22 am ] |
| Post subject: | Re: Npc Targeting |
Sweet! Got it working heres what I came up with: Code: ' Check for an npc For i = MAX_MAP_NPCS To 1 Step -1 If MapNpc(GetPlayerMap(index), i).Num > 0 Then If MapNpc(GetPlayerMap(index), i).x = x And MapNpc(GetPlayerMap(index), i).y = y Then ' Change target Player(index).Target = i Player(index).TargetType = TARGET_TYPE_NPC SendTarget index If Mid(Trim(Npc(MapNpc(GetPlayerMap(index), i).Num).Name), 0, 1) = "a" Then Call PlayerMsg(index, "Your target is now a " & Trim(Npc(MapNpc(GetPlayerMap(index), i).Num).Name) & ".", Yellow) End If Exit Sub End If End If Next i Works great now |
|
| Author: | genusis [ Fri Nov 07, 2008 5:55 am ] |
| Post subject: | Re: Npc Targeting |
you are welcomed ^^. |
|
| Author: | William [ Fri Nov 07, 2008 12:25 pm ] |
| Post subject: | Re: Npc Targeting |
What button are you using to cast spells? |
|
| Author: | Avarit [ Fri Nov 07, 2008 7:22 pm ] |
| Post subject: | Re: Npc Targeting |
I dont know this is my first week working with vb6 and ms XD |
|
| Author: | GIAKEN [ Fri Nov 07, 2008 8:59 pm ] |
| Post subject: | Re: Npc Targeting |
Yeah my code for targetting is a bit more complicated than just the blting part, sorry. |
|
| Page 1 of 2 | All times are UTC |
| Powered by phpBB® Forum Software © phpBB Group https://www.phpbb.com/ |
|