Jump to content
Search In
  • More options...
Find results that contain...
Find results in...

Simple question.. I think.


DopeyBiach
 Share

Recommended Posts

No, sorry. That doesn't move the text depending on the sprite's size.. That does it depending on the name ![:P](http://www.touchofdeathforums.com/community/public/style_emoticons/<#EMO_DIR#>/tongue.png)

EDIT: I have an idea, will tell you if it works. Keep the ideas coming until then :]

EDIT: It worked. Here's what I did.

Added a new object to the NPC Editor.

scrlSize and lblSize.

The procedure for scrlSize_Change() is as follwoed:

```

Private Sub scrlSize_Change()

' If debug mode, handle error then exit out

If Options.Debug = 1 Then On Error GoTo Errorhandler

lblSize.Caption = "Size: " & scrlSize.Value

Npc(EditorIndex).Size = scrlSize.Value

' Error handler

Exit Sub

Errorhandler:

HandleError "scrlSize_Change", "frmEditor_NPC", Err.Number, Err.Description, Err.Source, Err.HelpContext

Err.Clear

Exit Sub

End Sub

```

Add this to NpcRec in ModTypes in the Server and Client - Just under 'Level as Long'

```

Size As Long

```

Add this to NPCEditorInit in modGameEditors just under '.scrlAnimation.Value = Npc(EditorIndex).Animation'

```

If Npc(EditorIndex).Size <= 0 or Npc(EditorIndex).Size > .scrlSize.Max Then

.Npc(EditorIndex).Size = 0

.scrlSize.Value = 0

Else

.scrlSize.Value = Npc(EditorIndex).Size

End If

```

Add:

```

Dim CenterShift As Long

```
Just under 'Dim npcNum as Long'

Just under:

```

Select Case Npc(npcNum).Behaviour

Case NPC_BEHAVIOUR_ATTACKONSIGHT

color = QBColor(White)

Case NPC_BEHAVIOUR_ATTACKWHENATTACKED

color = QBColor(Grey)

Case NPC_BEHAVIOUR_GUARD

color = QBColor(White)

Case Else

color = QBColor(White)

End Select

```

and above 'Npc = Trim$(Npc(npcNum).Name) add:

```

If Val(Npc(MapNpc(Index).num).Size) > 0 Then

If Val(Npc(MapNpc(Index).num).Size) = 1 Then

CenterShift = 0

ElseIf Val(Npc(MapNpc(Index).num).Size) = 2 Then

CenterShift = 16

End If

End If

```

Finally replace:

```

TextX = ConvertMapX(MapNpc(Index).X * PIC_X) + MapNpc(Index).XOffset + (PIC_X \ 2) - getWidth(TexthDC, (Trim$(Name)))

```

With:

```

TextX = ConvertMapX(MapNpc(Index).X * PIC_X) + MapNpc(Index).XOffset + (PIC_X \ 2) - ((Len(Trim$(Npc(MapNpc(Index).num).Name)) / 2) * 8) + CenterShift

```

Zero, I used that bit of code you gave me aswell to make it work :]..

What this does is if the actual sprite's image width (not the entire block, like the transparency around it) is 64px then it centers the name nicely. When the size is set to 2 in the npc editor.. If it's a normal sprite, set it to 1 ^___^

I'm sure there was an easier way but meh.
Link to comment
Share on other sites

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...