Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Hotel Map Moral
#1
Hotel Map Moral

Very fun and easy

CLIENT SIDE:

modGameLogic, under:

Code:
' Party request

add:

Code:
' Map inn If LCase(Mid(MyText, 1, 10)) = "/sleep" Then Call SendInnSleep MyText = "" Exit Sub End If


in modClientTCP, under :
Code:
Sub SendJoinParty()

add, this sub:

Code:
Sub SendInnSleep()
Dim Packet As String
Packet = "INNSLEEP" & SEP_CHAR & END_CHAR
Call SendData(Packet)
End Sub



In frmMapProperties add to the list of cmbMoral a new line and type on it "Inn"

SERVER SIDE:


In modHandleData, under:

Code:
' :: Respawn map packet ::


add:

Code:
' ::::::::::::::::::::::::::
' :: Sleep Request packet ::
' ::::::::::::::::::::::::::
If LCase(Parse(0)) = "innsleep" Then
If Map(GetPlayerMap(Index)).Moral = MAP_MORAL_INN Then
Call TakeItem(Index, 1, 100) 'Change the valeu from 1(ItemNum) for the # you want and 100(GetValue) from the # you want
Call SetPlayerHP(Index, GetPlayerMaxHP(Index))
Call SetPlayerMP(Index, GetPlayerMaxMP(Index))
Call SetPlayerSP(Index, GetPlayerMaxSP(Index))
Call SendHP(Index)
Call SendMP(Index)
Call SendSP(Index)
Call PlayerMsg(Index, "You sleep...", White)
Else
Call PlayerMsg(Index, "You cant sleep here...", White)
End If
Exit Sub
End If

Done!

Can some 1 post an add to this, that if inn is selected on cmdMoral in frmMapProperties it apears 2 txtboxes and on it you type the item and the value that you wana get?

Server and client, in modConstants

unde:

Code:
Public Const MAP_MORAL_SAFE = 1

add:

Code:
Public Const MAP_MORAL_INN = 2



NOTE FROM GRIM:
REMIND EM LATER TO ADD THE UPDATE REQUESTED IN THIS TUT
Reply
#2
this never worked for me on the old forum. I'll test tonight, much love
Reply
#3
Sorry to necro-post but i've tried this time and time again and it always kicks me telling me i have an invalid packet (INNSLEEP)) and highlights nothing :?
Reply
#4
taken from elysium tuts
Reply
#5
I'm sure this was here, years ago
Reply
#6
Uarepoo2 Wrote:taken from elysium tuts

No it wasn't this tute was here before I joined, that was before Elysium was made. So SHHHHH
Reply
#7
Uarepoo2 Wrote:taken from elysium tuts
Haha, I believe this is done by GSD, as many tuts here are. And he made it before es started.
Reply
#8
Actualy that's mine xD
I used to make a lot of tutorials a while ago. Now I just don't have time, since I'm in college now.
I added this to my game and made this tutorial from it.
Reply
#9
lol any ideas on my error?
Reply
#10
This may not fix bug, but im looking into that. This is just another little thing to keep it from being like a Safe Zone map color.

Client Side:

Find:
Code:
If Map.Moral = MAP_MORAL_NONE Then

Replace that whole 'If' statement with:
Code:
' Draw map name
        If Map.Moral = MAP_MORAL_NONE Then
            Call DrawText(TexthDC, Int((MAX_MAPX + 1) * PIC_X / 2) - (Int(Len(Trim(Map.Name)) / 2) * 8), 1, Trim(Map.Name), QBColor(BrightRed))
        ElseIf Map.Moral = MAP_MORAL_SAFE Then
            Call DrawText(TexthDC, Int((MAX_MAPX + 1) * PIC_X / 2) - (Int(Len(Trim(Map.Name)) / 2) * 8), 1, Trim(Map.Name), QBColor(White))
        Else
            Call DrawText(TexthDC, Int((MAX_MAPX + 1) * PIC_X / 2) - (Int(Len(Trim(Map.Name)) / 2) * 8), 1, Trim(Map.Name), QBColor(Blue))
        End If

Server Side:
-This will keep people from attacking you while in this zone

Find:
Code:
' Check if at same coordinates
        Select Case GetPlayerDir(Attacker)
            Case DIR_UP
Replace the whole case with this:
Code:
' Check if at same coordinates
        Select Case GetPlayerDir(Attacker)
            Case DIR_UP
                If (GetPlayerY(Victim) + 1 = GetPlayerY(Attacker)) And (GetPlayerX(Victim) = GetPlayerX(Attacker)) Then
                    ' Check to make sure that they dont have access
                    If GetPlayerAccess(Attacker) > ADMIN_MONITER Then
                        Call PlayerMsg(Attacker, "You cannot attack any player for thou art an admin!", BrightBlue)
                    Else
                        ' Check to make sure the victim isn't an admin
                        If GetPlayerAccess(Victim) > ADMIN_MONITER Then
                            Call PlayerMsg(Attacker, "You cannot attack " & GetPlayerName(Victim) & "!", BrightRed)
                        Else
                            ' Check if map is attackable
                            If Map(GetPlayerMap(Attacker)).Moral = MAP_MORAL_NONE Or GetPlayerPK(Victim) = YES Then
                                ' Make sure they are high enough level
                                If GetPlayerLevel(Attacker) < 10 Then
                                    Call PlayerMsg(Attacker, "You are below level 10, you cannot attack another player yet!", BrightRed)
                                Else
                                    If GetPlayerLevel(Victim) < 10 Then
                                        Call PlayerMsg(Attacker, GetPlayerName(Victim) & " is below level 10, you cannot attack this player yet!", BrightRed)
                            ElseIf Map(GetPlayerMap(Attacker)).Moral = MAP_MORAL_INN Or GetPlayerPK(Victim) = YES Then
                                If GetPlayerLevel(Attacker) < 10 Then
                                    Call PlayerMsg(Attacker, "You are below level 10, you cannot attack another player yet!", BrightRed)
                                Else
                                    If GetPlayerLevel(Victim) < 10 Then
                                        Call PlayerMsg(Attacker, GetPlayerName(Victim) & " is below level 10, you cannot attack this player yet!", BrightRed)
                                    Else
                                        CanAttackPlayer = True
                                    End If
                                End If
                            Else
                                Call PlayerMsg(Attacker, "This is a safe zone!", BrightRed)
                            End If
                        End If
                    End If
                End If

And continue doing that with rest of Directions like DIR_DOWN, DIR_LEFT, and DIR_RIGHT.
Reply
#11
Gawian Wrote:Sorry to necro-post but i've tried this time and time again and it always kicks me telling me i have an invalid packet (INNSLEEP)) and highlights nothing :?

You get error server or client side? Try going over tutorial again and make sure you did it right.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)