Originally posted by solosturmFrom Dr.Spoon, WAY back when i joined, he put this up, it has allways worked for me the first time around....
okay first on the client side add this to the handlekeypresses in the modGameLogic.bas make sure you put it in the section labeled for creator access commands ----------------------------------- ' day night command If LCase(Mid(MyText, 1, 9)) = "/daynight" Then If GameTime = TIME_DAY Then GameTime = TIME_NIGHT Else GameTime = TIME_DAY End If Call SendGameTime MyText = "" Exit Sub End If -----------------------------------
then put this one in the modClientTCP.bas at the end is fine -----------------------------------
Sub SendGameTime() Dim Packet As String
Packet = "GmTime" & SEP_CHAR & GameTime & SEP_CHAR & END_CHAR Call SendData(Packet) End Sub
-----------------------------------
this goes in the modClientTCP.bas --> HandleData sub Note: most of this is already there i just added the if then statment this would also be where you change the tile sheets if you have them ----------------------------------- ' ::::::::::::::::: ' :: Time packet :: ' ::::::::::::::::: If (LCase(Parse(0)) = "time") Then GameTime = Val(Parse(1)) If GameTime = TIME_DAY Then Call BrodcastMsg("day has dawned in this realm") Else Call BrodcastMsg("Night has fallen upon the weary eyed nightowls") End If End If -----------------------------------
This goes server side in the modServerTCP --> HandleData sub ----------------------------------- ' :::::::::::::::::::::: ' :: Day Night packet :: ' :::::::::::::::::::::: If LCase(Parse(0)) = "gmtime" Then GameTime = Parse(1) 'used to be 2 Call SendTimeToAll Exit Sub End If -----------------------------------
most every thing server side is set up to handle day/night the primary setting for the day night interval is set in the modGeneral.bas server side under the GameAI sub find this text: ----------------------------------- ' Check if we need to switch from day to night or night to day If TimeSeconds >= 60 Then If GameTime = TIME_DAY Then GameTime = TIME_NIGHT Else GameTime = TIME_DAY End If
Call SendTimeToAll TimeSeconds = 0 End If ----------------------------------
now you have a /daynight command to trigger the change over or just wait the preset time and then this was added in to it also....
' ::::::::::::::::: ' :: Time packet :: ' ::::::::::::::::: If (LCase(Parse(0)) = "time") Then Dim selTile As Integer GameTime = Val(Parse(1)) If GameTime = TIME_DAY Then Call BroadcastMsg("day has dawned in this realm") selTile = 0 ElseIf GameTime = TIME_NIGHT Then Call BroadcastMsg("Night has fallen upon the weary eyed nightowls") selTile = 486 End If For y = 0 To MAX_MAPY For x = 0 To MAX_MAPX Map.Tile(x, y).Fringe = selTile Next x Next y End If and then this also......
Dim selTile As Integer If GameTime = TIME_DAY Then selTile = 0 ElseIf GameTime = TIME_NIGHT Then selTile = 486 End If For y = 0 To MAX_MAPY For x = 0 To MAX_MAPX Map.Tile(x, y).Fringe = selTile Next x Next y make sure it is inside the main Do while in game loop this will fix the transition frommap to map so it keeps the darkness or daylight.. also thsis where you could add in the condition where Code: If Map.inside = 1 then selTile = 0 and then i had to go in and fix something, so put this in also, ok?
'Sync GameTime to current time on Map with Server ' ::::::::::::::::::::::::::::::: ' :: Map send completed packet :: ' ::::::::::::::::::::::::::::::: If LCase(Parse(0)) = "mapdone" Then Map = SaveMap
For i = 1 To MAX_MAP_ITEMS MapItem(i) = SaveMapItem(i) Next i
For i = 1 To MAX_MAP_NPCS MapNpc(i) = SaveMapNpc(i) Next i
GettingMap = False
' Play music Call StopMidi If Map.Music > 0 Then Call PlayMidi("music" & Trim(STR(Map.Music)) & ".mid") End If
'update the map to current game time... Call SendGameTime
Exit Sub End If
Originally posted by solosturmand then PsychoBoy chimed in with this also....
know this is an old topic but I have found another method that is MUCH easier for making it look dark
do everything that solostorm original posted to make it say the message. Then add this to modGameLogic in the client under BltFringeTile
Code: Dim Fringe3 As Long
Code: If GameTime = TIME_NIGHT And Map.BootX = 0 Then Fringe3 = 658 <--- make this a shadow tile to fringe Else Fringe3 = 0 <--- any empty black tile End If
Now this next part add it to the last part of this sub so it draws on top of the rest of the fringe Code: rec.top = Int(Fringe3 / 7) * PIC_Y rec.Bottom = rec.top + PIC_Y rec.Left = (Fringe3 - Int(Fringe3 / 7) * 7) * PIC_X rec.Right = rec.Left + PIC_X 'Call DD_BackBuffer.Blt(rec_pos, DD_TileSurf, rec, DDBLT_WAIT Or DDBLT_KEYSRC) Call DD_BackBuffer.BltFast(X * PIC_X, y * PIC_Y, DD_TileSurf, rec, DDBLTFAST_WAIT Or DDBLTFAST_SRCCOLORKEY)
-Psychoboy ENJOY!
oh and i changed all the entitys to ASCII for you..
|