Todo-Argentum
¿Quieres reaccionar a este mensaje? Regístrate en el foro con unos pocos clics o inicia sesión para continuar.

[APORTE] Luces En Items v2 IAO CLON

4 participantes

Ir abajo

[APORTE]  Luces En Items v2 IAO CLON Empty [APORTE] Luces En Items v2 IAO CLON

Mensaje por Zenitram Sáb Ago 31, 2013 12:59 pm

Bueno primero lo que tienen que hacer es crear un modulo llamado: LuzItem

en el modulo ponemos

Código:
Option Explicit
Public Const NumItemsLuz As Byte = 2 'Numeros de items con luz
Public GrhItemLuz(1 To NumItemsLuz) As Integer
 
Function TieneLuz(ByVal X As Byte, ByVal Y As Byte)
'**************Autor: Nait(Nicolás Pedetti)**************************
Dim i As Byte
For i = 1 To NumItemsLuz
   If GrhItemLuz(i) = MapData(X, Y).ObjGrh.grhindex And MapData(X, Y).OBJInfo.TieneLuz = 0 Then
   MapData(X, Y).OBJInfo.TieneLuz = 1
   Light.Create_Light_To_Map X, Y, 3, 255, 255, 255
   End If
Next i
End Function
 
Function DeletLuz(ByVal X As Byte, ByVal Y As Byte)
'**************Autor: Nait(Nicolás Pedetti)**************************
Dim i As Byte
For i = 1 To NumItemsLuz
    If GrhItemLuz(i) = MapData(X, Y).ObjGrh.grhindex And MapData(X, Y).OBJInfo.TieneLuz = 1 Then
        Light.Delete_Light_To_Map X, Y
    End If
Next i
End Function
 
Sub ObjLuz()
'**************Autor: Nait(Nicolás Pedetti)**************************
GrhItemLuz(1) = 1521 'Fogata
GrhItemLuz(2) = 510 'Daga comun
End Sub
luego buscarmos:

Call CargarCuerpos

y
abajo ponemos

Call ObjLuz

luego Buscamos

Código:
Private Sub HandleObjectDelete()
y abajo de

Código:
    Dim X As Byte
    Dim Y As Byte
    
    X = incomingData.ReadByte()
    Y = incomingData.ReadByte()
ponemos

Código:
DeletLuz X, Y
despues buscamos:

Código:
Call Draw_Grh(.ObjGrh, PixelOffsetXTemp, PixelOffsetYTemp
y abajo ponemos

Código:
TieneLuz X, Y
luego creamos un modulo de clase llamado : clsLight

y en el modulo de clase ponemos :

Código:
Option Base 0
Private Type tLight
    RGBcolor As D3DCOLORVALUE
    active As Boolean
    map_x As Byte
    map_y As Byte
    range As Byte
End Type
 
Private light_list() As tLight
Private NumLights As Byte
Public Function Create_Light_To_Map(ByVal map_x As Byte, ByVal map_y As Byte, Optional range As Byte = 3, Optional ByVal red As Byte = 255, Optional ByVal green = 255, Optional ByVal blue As Byte = 255)
    NumLights = NumLights + 1
  
    ReDim Preserve light_list(1 To NumLights) As tLight
  
    'Le damos color
    light_list(NumLights).RGBcolor.r = red
    light_list(NumLights).RGBcolor.g = green
    light_list(NumLights).RGBcolor.b = blue
  
    'Alpha (Si borras esto RE KB!!)
    light_list(NumLights).RGBcolor.A = 255
  
    'Un rango determinado
    light_list(NumLights).range = range
  
    'La activamos para que se pueda renderizar
    light_list(NumLights).active = True
  
    'Pos en el mapa
    light_list(NumLights).map_x = map_x
    light_list(NumLights).map_y = map_y
  
    Call LightRender(NumLights)
End Function
Public Function Delete_Light_To_Map(ByVal X As Byte, ByVal Y As Byte)
  
    Dim i As Long
  
    For i = 1 To NumLights
        If light_list(i).map_x = X And light_list(i).map_y = Y Then
            Delete_Light_To_Index i
        End If
    Next i
 
End Function
Public Function Delete_Light_To_Index(ByVal light_index As Byte)
  
    Dim min_x As Integer
    Dim min_y As Integer
    Dim max_x As Integer
    Dim max_y As Integer
    Dim Ya As Integer
    Dim Xa As Integer
 
    light_list(light_index).active = False
 
    min_x = light_list(light_index).map_x - light_list(light_index).range
    max_x = light_list(light_index).map_x + light_list(light_index).range
    min_y = light_list(light_index).map_y - light_list(light_index).range
    max_y = light_list(light_index).map_y + light_list(light_index).range
      
    For Ya = min_y To max_y
        For Xa = min_x To max_x
            If InMapBounds(Xa, Ya) Then
                MapData(Xa, Ya).light_value(0) = 0
                MapData(Xa, Ya).light_value(1) = 0
                MapData(Xa, Ya).light_value(2) = 0
                MapData(Xa, Ya).light_value(3) = 0
            End If
        Next Xa
    Next Ya
  
End Function
Private Function LightCalculate(ByVal cRadio As Integer, ByVal LightX As Integer, ByVal LightY As Integer, ByVal XCoord As Integer, ByVal YCoord As Integer, TileLight As Long, LightColor As D3DCOLORVALUE, AmbientColor As D3DCOLORVALUE) As Long
    Dim XDist As Single
    Dim YDist As Single
    Dim VertexDist As Single
    Dim pRadio As Integer
  
    Dim CurrentColor As D3DCOLORVALUE
  
    pRadio = cRadio * 32
  
    XDist = LightX + 16 - XCoord
    YDist = LightY + 16 - YCoord
  
    VertexDist = Sqr(XDist * XDist + YDist * YDist)
  
    If VertexDist <= pRadio Then
        Call D3DXColorLerp(CurrentColor, LightColor, AmbientColor, VertexDist / pRadio)
        LightCalculate = D3DColorXRGB(Round(CurrentColor.r), Round(CurrentColor.g), Round(CurrentColor.b))
        'If TileLight > LightCalculate Then LightCalculate = TileLight
    Else
        LightCalculate = TileLight
    End If
End Function
 
Private Sub LightRender(ByVal light_index As Integer)
 
    If light_index = 0 Then Exit Sub
    If light_list(light_index).active = False Then Exit Sub
  
    Dim min_x As Integer
    Dim min_y As Integer
    Dim max_x As Integer
    Dim max_y As Integer
    Dim color As Long
    Dim Ya As Integer
    Dim Xa As Integer
  
    Dim TileLight As D3DCOLORVALUE
    Dim AmbientColor As D3DCOLORVALUE
    Dim LightColor As D3DCOLORVALUE
  
    Dim XCoord As Integer
    Dim YCoord As Integer
  
    AmbientColor.r = 128
    AmbientColor.g = 128
    AmbientColor.b = 128
  
    LightColor = light_list(light_index).RGBcolor
      
    min_x = light_list(light_index).map_x - light_list(light_index).range
    max_x = light_list(light_index).map_x + light_list(light_index).range
    min_y = light_list(light_index).map_y - light_list(light_index).range
    max_y = light_list(light_index).map_y + light_list(light_index).range
      
    For Ya = min_y To max_y
        For Xa = min_x To max_x
            If InMapBounds(Xa, Ya) Then
                XCoord = Xa * 32
                YCoord = Ya * 32
                MapData(Xa, Ya).light_value(1) = LightCalculate(light_list(light_index).range, light_list(light_index).map_x * 32, light_list(light_index).map_y * 32, XCoord, YCoord, MapData(Xa, Ya).light_value(1), LightColor, AmbientColor)
 
                XCoord = Xa * 32 + 32
                YCoord = Ya * 32
                MapData(Xa, Ya).light_value(3) = LightCalculate(light_list(light_index).range, light_list(light_index).map_x * 32, light_list(light_index).map_y * 32, XCoord, YCoord, MapData(Xa, Ya).light_value(3), LightColor, AmbientColor)
                      
                XCoord = Xa * 32
                YCoord = Ya * 32 + 32
                MapData(Xa, Ya).light_value(0) = LightCalculate(light_list(light_index).range, light_list(light_index).map_x * 32, light_list(light_index).map_y * 32, XCoord, YCoord, MapData(Xa, Ya).light_value(0), LightColor, AmbientColor)
  
                XCoord = Xa * 32 + 32
                YCoord = Ya * 32 + 32
                MapData(Xa, Ya).light_value(2) = LightCalculate(light_list(light_index).range, light_list(light_index).map_x * 32, light_list(light_index).map_y * 32, XCoord, YCoord, MapData(Xa, Ya).light_value(2), LightColor, AmbientColor)
              
            End If
        Next Xa
    Next Ya
End Sub
luego buscan

Código:
Public Audio As New clsAudio
y abajo agregan

Código:
Public Light As New clsLight
por ultimo busquen

Código:
Sub Main()
y Abajo de Set Audio = New

Código:
Set Light = New clsLight
y listo les quedaria asi

[APORTE]  Luces En Items v2 IAO CLON 1289911_10201026195310698_1702470718_n

Todo fue gracias a MAYCO Y SDERTY !!! SON UNOS CAPOS DE LA VIDA


Última edición por Saurus el Sáb Ago 31, 2013 8:18 pm, editado 3 veces
Zenitram
Zenitram

[APORTE]  Luces En Items v2 IAO CLON 5O26YPx

Aportes : 10
Mensajes : 65
Puntos : 130
Edad : 23

Volver arriba Ir abajo

[APORTE]  Luces En Items v2 IAO CLON Empty Re: [APORTE] Luces En Items v2 IAO CLON

Mensaje por Sderty Sáb Ago 31, 2013 5:16 pm

Se agradece por traerlo al foro. No es nada de otro mundo pero esta muy bien Razz (De rango pone un 2 Sos un asesino poniendo 3)
Sderty
Sderty

[APORTE]  Luces En Items v2 IAO CLON 5O26YPx

Aportes : 13

Mensajes : 44
Puntos : 75
Edad : 26
Localización : Caba Flores.-

Volver arriba Ir abajo

[APORTE]  Luces En Items v2 IAO CLON Empty Re: [APORTE] Luces En Items v2 IAO CLON

Mensaje por Rydzek Sáb Ago 31, 2013 5:45 pm

Me tirar error al compilar acá:
[APORTE]  Luces En Items v2 IAO CLON 1185936_501254366629093_2107161360_n
"Method or data member not found"
Rydzek
Rydzek

[APORTE]  Luces En Items v2 IAO CLON 5O26YPx

Aportes : 4
Mensajes : 25
Puntos : 39

Volver arriba Ir abajo

[APORTE]  Luces En Items v2 IAO CLON Empty Re: [APORTE] Luces En Items v2 IAO CLON

Mensaje por Zenitram Sáb Ago 31, 2013 6:01 pm

hiciste todo primero
Zenitram
Zenitram

[APORTE]  Luces En Items v2 IAO CLON 5O26YPx

Aportes : 10
Mensajes : 65
Puntos : 130
Edad : 23

Volver arriba Ir abajo

[APORTE]  Luces En Items v2 IAO CLON Empty Re: [APORTE] Luces En Items v2 IAO CLON

Mensaje por Sderty Sáb Ago 31, 2013 8:17 pm

Te falto.-

Código:
Buscan

Public Type Obj

Abajo
    TieneLuz As Byte
Ahora te lo edito Razz
Sderty
Sderty

[APORTE]  Luces En Items v2 IAO CLON 5O26YPx

Aportes : 13

Mensajes : 44
Puntos : 75
Edad : 26
Localización : Caba Flores.-

Volver arriba Ir abajo

[APORTE]  Luces En Items v2 IAO CLON Empty Re: [APORTE] Luces En Items v2 IAO CLON

Mensaje por Sderty Sáb Ago 31, 2013 8:20 pm

Saurus escribió:Bueno primero lo que tienen que hacer es crear un modulo llamado: LuzItem

en el modulo ponemos

Código:
Option Explicit
Public Const NumItemsLuz As Byte = 2 'Numeros de items con luz
Public GrhItemLuz(1 To NumItemsLuz) As Integer
 
Function TieneLuz(ByVal X As Byte, ByVal Y As Byte)
'**************Autor: Nait(Nicolás Pedetti)**************************
Dim i As Byte
For i = 1 To NumItemsLuz
   If GrhItemLuz(i) = MapData(X, Y).ObjGrh.grhindex And MapData(X, Y).OBJInfo.TieneLuz = 0 Then
   MapData(X, Y).OBJInfo.TieneLuz = 1
   Light.Create_Light_To_Map X, Y, 3, 255, 255, 255
   End If
Next i
End Function
 
Function DeletLuz(ByVal X As Byte, ByVal Y As Byte)
'**************Autor: Nait(Nicolás Pedetti)**************************
Dim i As Byte
For i = 1 To NumItemsLuz
    If GrhItemLuz(i) = MapData(X, Y).ObjGrh.grhindex And MapData(X, Y).OBJInfo.TieneLuz = 1 Then
        Light.Delete_Light_To_Map X, Y
    End If
Next i
End Function
 
Sub ObjLuz()
'**************Autor: Nait(Nicolás Pedetti)**************************
GrhItemLuz(1) = 1521 'Fogata
GrhItemLuz(2) = 510 'Daga comun
End Sub
luego buscarmos:

Call CargarCuerpos

y
abajo ponemos

Call ObjLuz

luego Buscamos

Código:
Private Sub HandleObjectDelete()
y abajo de

Código:
    Dim X As Byte
    Dim Y As Byte
    
    X = incomingData.ReadByte()
    Y = incomingData.ReadByte()
ponemos

Código:
DeletLuz X, Y
despues buscamos:

Código:
Call Draw_Grh(.ObjGrh, PixelOffsetXTemp, PixelOffsetYTemp
y abajo ponemos

Código:
TieneLuz X, Y
luego creamos un modulo de clase llamado : clsLight

y en el modulo de clase ponemos :

Código:
Option Base 0
Private Type tLight
    RGBcolor As D3DCOLORVALUE
    active As Boolean
    map_x As Byte
    map_y As Byte
    range As Byte
End Type
 
Private light_list() As tLight
Private NumLights As Byte
Public Function Create_Light_To_Map(ByVal map_x As Byte, ByVal map_y As Byte, Optional range As Byte = 3, Optional ByVal red As Byte = 255, Optional ByVal green = 255, Optional ByVal blue As Byte = 255)
    NumLights = NumLights + 1
  
   ReDim Preserve light_list(1 To NumLights) As tLight
  
   'Le damos color
    light_list(NumLights).RGBcolor.r = red
    light_list(NumLights).RGBcolor.g = green
    light_list(NumLights).RGBcolor.b = blue
  
   'Alpha (Si borras esto RE KB!!)
    light_list(NumLights).RGBcolor.A = 255
  
   'Un rango determinado
    light_list(NumLights).range = range
  
   'La activamos para que se pueda renderizar
    light_list(NumLights).active = True
  
   'Pos en el mapa
    light_list(NumLights).map_x = map_x
    light_list(NumLights).map_y = map_y
  
   Call LightRender(NumLights)
End Function
Public Function Delete_Light_To_Map(ByVal X As Byte, ByVal Y As Byte)
  
   Dim i As Long
  
   For i = 1 To NumLights
        If light_list(i).map_x = X And light_list(i).map_y = Y Then
            Delete_Light_To_Index i
        End If
    Next i
 
End Function
Public Function Delete_Light_To_Index(ByVal light_index As Byte)
  
   Dim min_x As Integer
    Dim min_y As Integer
    Dim max_x As Integer
    Dim max_y As Integer
    Dim Ya As Integer
    Dim Xa As Integer
 
   light_list(light_index).active = False
 
   min_x = light_list(light_index).map_x - light_list(light_index).range
    max_x = light_list(light_index).map_x + light_list(light_index).range
    min_y = light_list(light_index).map_y - light_list(light_index).range
    max_y = light_list(light_index).map_y + light_list(light_index).range
      
   For Ya = min_y To max_y
        For Xa = min_x To max_x
            If InMapBounds(Xa, Ya) Then
                MapData(Xa, Ya).light_value(0) = 0
                MapData(Xa, Ya).light_value(1) = 0
                MapData(Xa, Ya).light_value(2) = 0
                MapData(Xa, Ya).light_value(3) = 0
            End If
        Next Xa
    Next Ya
  
End Function
Private Function LightCalculate(ByVal cRadio As Integer, ByVal LightX As Integer, ByVal LightY As Integer, ByVal XCoord As Integer, ByVal YCoord As Integer, TileLight As Long, LightColor As D3DCOLORVALUE, AmbientColor As D3DCOLORVALUE) As Long
    Dim XDist As Single
    Dim YDist As Single
    Dim VertexDist As Single
    Dim pRadio As Integer
  
   Dim CurrentColor As D3DCOLORVALUE
  
   pRadio = cRadio * 32
  
   XDist = LightX + 16 - XCoord
    YDist = LightY + 16 - YCoord
  
   VertexDist = Sqr(XDist * XDist + YDist * YDist)
  
   If VertexDist <= pRadio Then
        Call D3DXColorLerp(CurrentColor, LightColor, AmbientColor, VertexDist / pRadio)
        LightCalculate = D3DColorXRGB(Round(CurrentColor.r), Round(CurrentColor.g), Round(CurrentColor.b))
        'If TileLight > LightCalculate Then LightCalculate = TileLight
    Else
        LightCalculate = TileLight
    End If
End Function
 
Private Sub LightRender(ByVal light_index As Integer)
 
   If light_index = 0 Then Exit Sub
    If light_list(light_index).active = False Then Exit Sub
  
   Dim min_x As Integer
    Dim min_y As Integer
    Dim max_x As Integer
    Dim max_y As Integer
    Dim color As Long
    Dim Ya As Integer
    Dim Xa As Integer
  
   Dim TileLight As D3DCOLORVALUE
    Dim AmbientColor As D3DCOLORVALUE
    Dim LightColor As D3DCOLORVALUE
  
   Dim XCoord As Integer
    Dim YCoord As Integer
  
   AmbientColor.r = 128
    AmbientColor.g = 128
    AmbientColor.b = 128
  
   LightColor = light_list(light_index).RGBcolor
      
   min_x = light_list(light_index).map_x - light_list(light_index).range
    max_x = light_list(light_index).map_x + light_list(light_index).range
    min_y = light_list(light_index).map_y - light_list(light_index).range
    max_y = light_list(light_index).map_y + light_list(light_index).range
      
   For Ya = min_y To max_y
        For Xa = min_x To max_x
            If InMapBounds(Xa, Ya) Then
                XCoord = Xa * 32
                YCoord = Ya * 32
                MapData(Xa, Ya).light_value(1) = LightCalculate(light_list(light_index).range, light_list(light_index).map_x * 32, light_list(light_index).map_y * 32, XCoord, YCoord, MapData(Xa, Ya).light_value(1), LightColor, AmbientColor)
 
               XCoord = Xa * 32 + 32
                YCoord = Ya * 32
                MapData(Xa, Ya).light_value(3) = LightCalculate(light_list(light_index).range, light_list(light_index).map_x * 32, light_list(light_index).map_y * 32, XCoord, YCoord, MapData(Xa, Ya).light_value(3), LightColor, AmbientColor)
                      
               XCoord = Xa * 32
                YCoord = Ya * 32 + 32
                MapData(Xa, Ya).light_value(0) = LightCalculate(light_list(light_index).range, light_list(light_index).map_x * 32, light_list(light_index).map_y * 32, XCoord, YCoord, MapData(Xa, Ya).light_value(0), LightColor, AmbientColor)
  
               XCoord = Xa * 32 + 32
                YCoord = Ya * 32 + 32
                MapData(Xa, Ya).light_value(2) = LightCalculate(light_list(light_index).range, light_list(light_index).map_x * 32, light_list(light_index).map_y * 32, XCoord, YCoord, MapData(Xa, Ya).light_value(2), LightColor, AmbientColor)
              
           End If
        Next Xa
    Next Ya
End Sub
luego buscan

Código:
Public Audio As New clsAudio
y abajo agregan

Código:
Public Light As New clsLight
Código:
Busca

Public Type Obj
Abajo

    TieneLuz As Byte 'Sderty Madafaca
por ultimo busquen
Código:
Sub Main()
y Abajo de Set Audio = New

Código:
Set Light = New clsLight
y listo les quedaria asi

[APORTE]  Luces En Items v2 IAO CLON 1291810_10201024048017017_968210969_n

Todo fue gracias a MAYCO Y SDERTY !!! SON UNOS CAPOS DE LA VIDA
Sderty
Sderty

[APORTE]  Luces En Items v2 IAO CLON 5O26YPx

Aportes : 13

Mensajes : 44
Puntos : 75
Edad : 26
Localización : Caba Flores.-

Volver arriba Ir abajo

[APORTE]  Luces En Items v2 IAO CLON Empty Re: [APORTE] Luces En Items v2 IAO CLON

Mensaje por Zenitram Sáb Ago 31, 2013 8:31 pm

cambie la foto por q esa era mejor :3
y aparte no decia gracias sderty
Zenitram
Zenitram

[APORTE]  Luces En Items v2 IAO CLON 5O26YPx

Aportes : 10
Mensajes : 65
Puntos : 130
Edad : 23

Volver arriba Ir abajo

[APORTE]  Luces En Items v2 IAO CLON Empty Re: [APORTE] Luces En Items v2 IAO CLON

Mensaje por Sderty Sáb Ago 31, 2013 9:00 pm

Yo no lo agregue ¬¬
Sderty
Sderty

[APORTE]  Luces En Items v2 IAO CLON 5O26YPx

Aportes : 13

Mensajes : 44
Puntos : 75
Edad : 26
Localización : Caba Flores.-

Volver arriba Ir abajo

[APORTE]  Luces En Items v2 IAO CLON Empty Re: [APORTE] Luces En Items v2 IAO CLON

Mensaje por Shermie80 Dom Sep 01, 2013 11:36 am

Abria que tratar de renderizar un poco.

[APORTE]  Luces En Items v2 IAO CLON SyGSOgy

[APORTE]  Luces En Items v2 IAO CLON IChCozo
Shermie80
Shermie80

[APORTE]  Luces En Items v2 IAO CLON ZdImiA6

CoverAOStaff
Aportes : 55
Mensajes : 139
Puntos : 822
Edad : 27

https://todo-argentum.foroargentina.net

Volver arriba Ir abajo

[APORTE]  Luces En Items v2 IAO CLON Empty Re: [APORTE] Luces En Items v2 IAO CLON

Mensaje por Zenitram Dom Sep 01, 2013 12:12 pm

Zenitram
Zenitram

[APORTE]  Luces En Items v2 IAO CLON 5O26YPx

Aportes : 10
Mensajes : 65
Puntos : 130
Edad : 23

Volver arriba Ir abajo

[APORTE]  Luces En Items v2 IAO CLON Empty Re: [APORTE] Luces En Items v2 IAO CLON

Mensaje por Shermie80 Dom Sep 01, 2013 12:56 pm

Dije rederendizar , que la luz quede mejor.

compara

[APORTE]  Luces En Items v2 IAO CLON 1289911_10201026195310698_1702470718_n

Con

[APORTE]  Luces En Items v2 IAO CLON SyGSOgy
Shermie80
Shermie80

[APORTE]  Luces En Items v2 IAO CLON ZdImiA6

CoverAOStaff
Aportes : 55
Mensajes : 139
Puntos : 822
Edad : 27

https://todo-argentum.foroargentina.net

Volver arriba Ir abajo

[APORTE]  Luces En Items v2 IAO CLON Empty Re: [APORTE] Luces En Items v2 IAO CLON

Mensaje por Zenitram Dom Sep 01, 2013 2:40 pm

ahh y como haces ?
Zenitram
Zenitram

[APORTE]  Luces En Items v2 IAO CLON 5O26YPx

Aportes : 10
Mensajes : 65
Puntos : 130
Edad : 23

Volver arriba Ir abajo

[APORTE]  Luces En Items v2 IAO CLON Empty Re: [APORTE] Luces En Items v2 IAO CLON

Mensaje por Contenido patrocinado


Contenido patrocinado


Volver arriba Ir abajo

Volver arriba

- Temas similares

 
Permisos de este foro:
No puedes responder a temas en este foro.