Mirage Source http://www.miragesource.net/forums/ |
|
Pick Pocket http://www.miragesource.net/forums/viewtopic.php?f=210&t=592 |
Page 1 of 2 |
Author: | DarkX [ Mon Oct 02, 2006 8:00 pm ] |
Post subject: | Pick Pocket |
I have an idea for a pick pocketing system, but I was wondering if anyone would have any suggestions on how to work the code. |
Author: | lordgivemick [ Mon Oct 02, 2006 9:35 pm ] |
Post subject: | |
you could work the code by going though the npcs. |
Author: | Shadow Dragon [ Tue Oct 03, 2006 11:07 am ] |
Post subject: | |
What do you mean, have a sort of set like p2ptrading(for npcs)you click a little button and he'll pickpocket someone... something like that? or are you talking about pickpocketing other players? |
Author: | DarkX [ Tue Oct 03, 2006 11:23 am ] |
Post subject: | |
Well my idea is to have both, "rob" npc and "PickPocket" players, now the big idea about the pickpocket players is that it does "NOT" take the item away from the origanal player. here's an example :::::::::::::::Example::::::::::::::::: 1. player trys to pickpocket another player 2. player is successful at sneaking into the pocket 3. "player picks a item to steal" 4. Players 10 - 100% chance of being spotted is called! 5. The item that he actually gets is based on his pick pocket skill 6. If player is successful add item to inventory 7. (other option) If player is caught deal 15 damage to the player pickpocketing - don't add the item to his inventory; adds the title of theif at the end of his name ::::::::::::End Example::::::::::::: And for the npc's :::::::::::::::::Example::::::::::::::::: 1. player trys to rob a npc 2. player is successful at sneaking into a crate/bag 3. "player picks item to streal" 4. Platers 10 - 100% chance of being spotted is called! 5. the item that he actually gets is based on his stealing skill(aka pickpocket) 6. If player is successful add item to inventory 7.(other option) If player is caught deal 15 damage to the player and send to jail - don't add the item to his inventory; remove the worth of the item trying to steal from players gold: (if player does not have the cash leave him in a cell for 5 minutes) Add the title theif to the end of his name. :::::::::::::::::::::::::End Example:::::::::::::::::::::: I'm not sure if that's possible to be done, but that's sort of what I'm looking for. any suggestions on how to do that? |
Author: | William [ Tue Oct 03, 2006 12:21 pm ] |
Post subject: | |
Player Could be pretty advanced, but still there are a very easy way to do this. Just follow the attack player code. And you can basicly just make it so you steal gold from the player, the amount depending on your skill. NPCs This is a little bit more difficult, still pretty easy if you just want to take gold. But if you want to scam for items, you would need to add a lot of things, both to the editNPC and also the actual NPC inventory. I suggest you go with the scam for gold idea |
Author: | DarkX [ Tue Oct 03, 2006 12:46 pm ] |
Post subject: | |
Either way I'm doing the gold thing, I was just wanting to get some examples or idea's for doing it, but I want the stealing actual items from npc's for the realism of it, and stealing from players just for fun. but I would rather it be regular items+gold then just gold. |
Author: | Obsidian [ Tue Oct 03, 2006 1:27 pm ] |
Post subject: | |
You should probably add another Byte val to the itemrec, like StealVal or something, so if you were trying to pick-pocket a player, the higher the StealVal, the harder/longer it is to steal. |
Author: | DarkX [ Tue Oct 03, 2006 1:47 pm ] |
Post subject: | |
Even though I'm trying to work out how to do the pick pocket, I'm currently working out a in client editable class thingy(like editing npcs but classes) and back and fourth trying to figure this out. I think I'm going to take your idea and add a stealval to the items, and a robbedval to npc's and players rec's |
Author: | Reece [ Tue Oct 03, 2006 3:47 pm ] |
Post subject: | |
i found this in my documents last night, no idea where it came from or if its even MS compatible i just saw some bits and thought meh, you mike like this Code: PickPocket skill
Sub Commands(Index) ' Place code in here for scripted commands Dim Name Dim Index2 Dim V Dim T Dim V2 Dim T2 Dim G Dim S Dim N If LCase(Mid(GetPlayerStringCommand(Index), 1, 11)) = "/pickpocket" Then If Len(GetPlayerStringCommand(Index)) < 13 Then Call PlayerMsg(Index, "What? Whose that?", 15) Exit Sub End If 'first we check to see if they're of the thief class If GetPlayerClass(Index) <> 0 Then Call PlayerMsg(Index, "Pfft, you're not a thief!", 12) Exit Sub End If 'Lets see if they have a pickpocketing kit, if not, no go. If HasItem(Index, 10) Then Name = Mid(GetPlayerStringCommand(Index), 13, Len(GetPlayerStringCommand(Index)) - 12) Index2 = FindPlayer(Name) If Index2 > 0 Then 'Check to make sure they're next to the person  If GetPlayerMap(Index) <> GetPlayerMap(Index2) Then    Call PlayerMsg(Index, "You're no where near this person!", 15)    ExitSub  End If  Select Case GetPlayerDir(Index)  Case 0  If GetPlayerX(Index2) <> GetPlayerX(Index) Then Call PlayerMsg(Index, "You gotta get a little closer...", 15) Exit Sub End If  If GetPlayerY(Index2) <> GetPlayerY(Index) - 1 Then Call PlayerMsg(Index, "You gotta get a little closer...", 15) Exit Sub End If  Case 1  If GetPlayerX(Index2) <> GetPlayerX(Index) Then Call PlayerMsg(Index, "You gotta get a little closer...", 15) Exit Sub End If  If GetPlayerY(Index2) <> GetPlayerY(Index) + 1 Then Call PlayerMsg(Index, "You gotta get a little closer...", 15) Exit Sub End If  Case 2  If GetPlayerX(Index2) <> GetPlayerX(Index) - 1 Then Call PlayerMsg(Index, "You gotta get a little closer...", 15) Exit Sub End If  If GetPlayerY(Index2) <> GetPlayerY(Index) Then Call PlayerMsg(Index, "You gotta get a little closer...", 15) Exit Sub End If  Case 3  If GetPlayerX(Index2) <> GetPlayerX(Index) + 1 Then Call PlayerMsg(Index, "You gotta get a little closer...", 15) Exit Sub End If  If GetPlayerY(Index2) <> GetPlayerY(Index) Then Call PlayerMsg(Index, "You gotta get a little closer...", 15) Exit Sub End If  End Select  'These are success chances based on speed, change these at will 'We'll call this the thief's skills T = Int(GetPlayerSpeed(Index) / 5) T2 = Int(Rnd * GetPlayerLevel(Index)) + T 'And this will be the victims dodge chance V = Int(GetPlayerSpeed(Index2) / 5) V2 = Int(Rnd * GetPlayerLevel(Index2)) + V If V2 > GetPlayerLevel(Index2) * 2 Then V2 = GetPlayerLevel(Index2) * 2 If T2 > GetPlayerLevel(Index) * 2 Then T2 = GetPlayerLevel(Index) * 2 'This will measure how much gold to take, change this to fit your game G = Int(Rnd * 100) * Int(GetPlayerLevel(Index2) / 5) 'Just a few numeric triggers  S = slot, N = number S = 0 N = 0 'This finds the slot with the gold Do  S = S + 1  If GetPlayerInvItemNum(Index2, S) = 1 Then N = 1  Loop Until N = 1 or S = 101 'If the player doesnt have gold, then you cant steal it! If S < 1 or S > 100 Then  Call PlayerMsg(Index, "This guy doesnt have anything to steal!", 15)  Exit Sub End If 'If the Victim is better than the thief... If V2 > T2 Then  Call PlayerMsg(Index, "You've failed! Get Out of here before you're caught!", 12)  Call PlayerMsg(Index2, GetPlayerName(Index) & " has just attempted to steal your cash!", 14) Exit Sub End If 'If it was a close one? If T2 = V2 Then  Call PlayerMsg(Index, "You missed, but they dont seem to have noticed...", 14) Exit Sub End If 'If the thief Succeeds! If T2 > V2 Then  If HasItem(Index2, 1) Then  If GetPlayerInvItemValue(Index2, S) < G Then G = GetPlayerInvItemValue(Index2, S) - 1  'Call SetPlayerInvItemValue(Index2, S, GetPlayerInvItemValue(Index2, S) - G)  Call GiveItem(Index, 1, G)  Call TakeItem(Index2, 1, G)  Call PlayerMsg(Index, "Yes! You got the loot, now scram!", 11)  End If End If Else Call PlayerMsg(Index, "Wha?... There's No one here...", 15)  Exit Sub End If Else Call PlayerMsg(Index, "You're ill equipped for this!", 14) End If End If 'The end of the thief portion... End Sub |
Author: | DarkX [ Tue Oct 03, 2006 4:10 pm ] |
Post subject: | |
Ok I'll try that out with some stuff, thanks for the assist, if you come up with any ideas or helpful code hints please post. |
Author: | ShadowLife [ Wed Oct 04, 2006 6:40 am ] |
Post subject: | |
considering that is just script, I don't believe it will work, atleast not without modifying it quite a bit....It is a nice base to use though. as for where it came from I believe i seen it on a closed source engine..... |
Author: | Reece [ Wed Oct 04, 2006 8:32 am ] |
Post subject: | |
As i said, i just found it :S realy confused me xD. |
Author: | William [ Wed Oct 04, 2006 2:06 pm ] |
Post subject: | |
It doesn't work. It uses functions that does not exist, and it also has a few errors in it. But its a decent start. |
Author: | Robin [ Wed Oct 04, 2006 3:00 pm ] |
Post subject: | |
I think P2P pickpocketing is really bad news, but pickpocketing NPC's could easily be done. Just copy the drop item code, but instead of when the NPC dies, when he is pickpocketeted(sp?). You could even add levels to the playerrec and make it more advanced. As for the packets, again, pretty easy. Send a request to the server, server does all calculations and then gives the player the item, and even send a message. Results in what... 2-3 packets? Easy peasy lemon squeazy. ~Kite |
Author: | DarkX [ Wed Oct 04, 2006 3:37 pm ] |
Post subject: | |
Well, I have sort of what I'm wanting to do, but I was wondering how I would make the npc's inventory(because I have a certain way I'm going to do this.) Also I'm confused on how to make it so that when you click ctrl it brings up the inventory rather than wack the player with your sword,axe or w/e. |
Author: | ShadowLife [ Wed Oct 04, 2006 4:19 pm ] |
Post subject: | |
I suggest choosing a new key, |
Author: | Shadow Dragon [ Mon Oct 23, 2006 3:22 pm ] |
Post subject: | |
I know this is a fairly old topic, but which of the attacking things should be duplicated(I'm trying to make a pickpocket myself) here's a list 1. CanAttackPlayer 2. CanAttackNpc 3. CannpcAttackPlayer 4. AttackPlayer 5. NpcAttackPlayer 6. AttackNpc Where is the thing that makes the "Ctrl" Key actually use the attack buttons? could someone help me I'm clueless. ?Please help out some? |
Author: | Matt [ Mon Oct 23, 2006 3:34 pm ] |
Post subject: | |
HandleKeyPresses or something like that, I think. |
Author: | DarkX [ Wed Oct 25, 2006 12:56 am ] |
Post subject: | |
It's not in handlekeypresses, it's somewhere else, assuming you can find it, but if you don't wanna look I think it's in modGlobals under ' Game Direction Vars |
Author: | Matt [ Wed Oct 25, 2006 1:17 am ] |
Post subject: | |
HandleKeyPresses handles all the pressing of keys in Mirage, I havn't opened it up, but I'm pretty sure it handles it there, since it handles what happens when you press enter to pick up an item and such. [EDIT] Guess I was wrong. I finally stopped being lazy, and actually opened my source and looked in handlekeypresses, I will now look for the correct location. [EDIT 2] I think it is this code: Code: If KeyCode = vbKeyControl Then ControlDown = True End If In: Code: Sub CheckInput(ByVal KeyState As Byte, ByVal KeyCode As Integer, ByVal Shift As Integer)
Though, I'm prolly wrong. Dunno. |
Author: | DarkX [ Wed Oct 25, 2006 1:35 am ] |
Post subject: | |
I think it might be, I'm not really sure though. |
Author: | Matt [ Wed Oct 25, 2006 1:38 am ] |
Post subject: | |
I checked, that is where it sets attacking to true, then runs a check for everything dealing with it, then proceeds to attack. |
Author: | Shadow Dragon [ Wed Oct 25, 2006 1:39 am ] |
Post subject: | |
Ok I will experiment with it over some time and figure out what I'm doing. |
Author: | Dr. Spoon [ Wed Oct 25, 2006 12:34 pm ] |
Post subject: | |
i woudl suggest raskingthe player which woudl they like to do.. or setup an option for the pickpocket class to always attempt to pick pockets when on and always attack when off place a simple check in the attack sub to see if they have it set on if so then send the target info to the pickpocket sub and activate it that way.. i could get into more detail but it seems you have enough info for now.. i may be able to help out a bit more later.. |
Author: | Robin [ Fri Oct 27, 2006 2:17 pm ] |
Post subject: | |
checkinput and gameloop house the code which checks if a button (such as ctrl, up, down etc.) is being pressed, whereas HandleKeyPresses is all the chat keys, such as A, B, Backspace, enter etc. keys are handled. -Kite- |
Page 1 of 2 | All times are UTC |
Powered by phpBB® Forum Software © phpBB Group https://www.phpbb.com/ |