Mirage Source http://web.miragesource.net/forums/ |
|
Hotel Map Moral http://web.miragesource.net/forums/viewtopic.php?f=210&t=96 |
Page 1 of 1 |
Author: | grimsk8ter11 [ Fri Jun 02, 2006 7:14 pm ] |
Post subject: | Hotel Map Moral |
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 |
Author: | James [ Sun Sep 17, 2006 2:48 am ] |
Post subject: | |
I shall update this tutorial for you! ALL SERVER SIDE! First, Let's add a new nifty function that could be useful elsewhere! Add this to ModGameLogic Code: Function GetPlayerInvItemName(ByVal Index As Long, ByVal InvSlot As Long) As String GetPlayerInvItemName = Trim$(Item(Player(Index).Char(Player(Index).CharNum).Inv(InvSlot).Num).Name) End Function Now, The Sleep Request packet. Replace it ALL with this. Code: ' ::::::::::::::::::::::::::
' :: Sleep Request packet :: ' :::::::::::::::::::::::::: Dim GoldItem As Long If LCase(Parse(0)) = "innsleep" Then For I = 1 To MAX_INV If Trim$(GetPlayerInvItemName(Index, I)) = "Gold" Then If Map(GetPlayerMap(Index)).Moral = MAP_MORAL_INN Then If GetPlayerInvItemValue(Index, I) >= 100 Then Call TakeItem(Index, I, 100) 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 and wake up feeling refreshed!", BrightGreen) Exit Sub ElseIf GetPlayerInvItemValue(Index, I) < 100 Then Call PlayerMsg(Index, "You do not have enough money to sleep here!", BrightRed) Exit Sub End If Else Call PlayerMsg(Index, "There is no Inn here. You cannot sleep!", BrightRed) End If End If Next I Exit Sub End If Tada, now it does not matter WHERE the item is in their inventory, and it makes sure they have enough money to sleep. Please replace the name "Gold" to whatever your currency is, and replace 100 with however much you'd like to charge them. This is SOO much better. And tested to work! |
Author: | Reece [ Sun Sep 17, 2006 11:35 am ] |
Post subject: | |
this never worked for me on the old forum. I'll test tonight, much love <3 |
Author: | Gawian [ Sat Apr 14, 2007 4:35 am ] |
Post subject: | |
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 |
Author: | Uarepoo2 [ Sat Apr 14, 2007 9:49 am ] |
Post subject: | |
taken from elysium tuts |
Author: | funkynut [ Sat Apr 14, 2007 10:06 am ] |
Post subject: | |
I'm sure this was here, years ago |
Author: | Reece [ Sat Apr 14, 2007 10:38 am ] |
Post subject: | |
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 |
Author: | William [ Sat Apr 14, 2007 11:11 am ] |
Post subject: | |
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. |
Author: | Dragoons Master [ Sat Apr 14, 2007 1:29 pm ] |
Post subject: | |
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. |
Author: | Gawian [ Sat Apr 14, 2007 2:38 pm ] |
Post subject: | |
lol any ideas on my error? |
Author: | Boo [ Mon Apr 16, 2007 3:06 am ] |
Post subject: | |
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. |
Author: | Boo [ Tue Apr 17, 2007 2:56 am ] |
Post subject: | |
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. |
Page 1 of 1 | All times are UTC |
Powered by phpBB® Forum Software © phpBB Group https://www.phpbb.com/ |