![]() |
Bounty System (2/5) C & P - Printable Version +- Mirage Engine (https://mirage-engine.uk/forums) +-- Forum: Mirage Source (Nostalgia) (https://mirage-engine.uk/forums/forumdisplay.php?fid=61) +--- Forum: Archive (2006-2011) (https://mirage-engine.uk/forums/forumdisplay.php?fid=18) +---- Forum: Source Code Development (https://mirage-engine.uk/forums/forumdisplay.php?fid=51) +----- Forum: Mirage Source 4 (Visual Basic 6) (https://mirage-engine.uk/forums/forumdisplay.php?fid=44) +------ Forum: Tutorials (https://mirage-engine.uk/forums/forumdisplay.php?fid=13) +------ Thread: Bounty System (2/5) C & P (/showthread.php?tid=2478) |
Bounty System (2/5) C & P - Nean - 07-01-2009 Ok, so this is just a bounty system I made for the hell of it. Keep in mind I did this, after pulling an all nighter, and was completely exhausted when I wrote most if it, so if you find a mistake, please let me know and don't hold it against me. This feature, will allow users to put hits out on other people, as soon as the hit is put out, the money is subtracted from their inventory. Anyone who kills the person with the price on their head, will receive the money. I also went as far as to include a command which brings up a list of people with bounties, and the price of the bounty on their head (was extremely easy) Credit goes to: William for his TakeGold function, and then the rest of the credit goes to you of MS4, for always answering my questions and helping. ![]() Without further adieu: Server Side [spoiler]Find: Code: Function HasItem(ByVal index As Long, ByVal ItemNum As Long) As Long Under it add: Code: Function TakeGold(ByVal index As Long, ByVal ItemNum As Long, ByVal ItemVal As Long) As Boolean Then find: Code: ' Player is dead Under it add: Code: If GetPlayerBounty(Victim) > 0 Then And now for the code for the list: Find: Code: Case CWhosOnline Under it add: Code: Case CBountyList Then find: Code: ' ::::::::::::::::::::::: Under it add: Code: ' :::::::::::::::::::::::: Then find: Code: Sub SendWhosOnline(ByVal index As Long) Under it add: Code: Sub SendBountyList(ByVal index As Long) Then find: Code: CSetBounty Under it add: Code: CBountyList Client Side [spoiler]Find: Code: CQuit Under it add: Code: CSetBounty Then find: Code: Case "/setaccess" Under it add: Code: Case "/bounty" Then find: Code: Sub SendSetAccess(ByVal Name As String, ByVal Access As Byte) Under it add: Code: Sub SendSetBounty(ByVal Name As String, _ Then find: Code: Sub SendWhosOnline() Under it add: Code: Sub SendBountyList() Then find: Code: CSetBounty Under it add: Code: CBountyList Then find: Code: ' Whos Online Under it add: Code: ' Bounty List This feature gives you two different commands: /bounty (playername) (price of bounty) /bounties (Displays the list of people with prices on their head, and how much) Also it allows you to use two new functions: GetPlayerBounty, and SetPlayerBounty. Have fun. Also, remember to read the code. After all, it will require one or two tweaks, such as replacing the 1's with the number slot that your currency is, etc, etc. That's where the 2/5 comes into play ![]() Re: Bounty System (2/5) C & P - Rory - 07-01-2009 I once worked on a bounty system. And then I reformatted my computer. And then I stopped coding. Re: Bounty System (2/5) C & P - genusis - 07-01-2009 this looks very interesting =]. thanks. this could help with making a law system. where if your in an npc range and you steal or something bad you get a bounty put on your head =]. Re: Bounty System (2/5) C & P - Rian - 07-01-2009 Nice work Nean. I haven't tested it, but it seems like a solid tutorial. I might even use it if I ever get around to reinstalling Visual Studio ![]() Re: Bounty System (2/5) C & P - Nean - 07-01-2009 @Rory: I know the feeling, I've had to reinstall VB6 multiple times, it's a pain. @Genusis: Tell me how that works out dude, sounds awesome. @Rian: Sweet, if/when you do so, tell me how it works for you, I have it full implemented and I haven't found any problems, so I hope it's the same for you. ![]() Re: Bounty System (2/5) C & P - genusis - 07-01-2009 well for the law system all you do is set the npc to have a tile range to where they can see. then you code in a new frm where you can set stuff like the skill theifing or something you want to be considered breaking a rule. then once you set that you then make a npc that is a guard npc ok for example the rule attacking players in town. place guard npc there and if the code attack player is called send another code doing a search to see if npcs are close enough if not nothing happens to them if so they set a bounty and guard npcs will start to attack them. and if players like kill a bounties player out of the npcs range they get the bounty Re: Bounty System (2/5) C & P - deathknight - 07-01-2009 It might also be a good idea to set another variable in the bounty system, to check to see if the bounty was player created, or created by the guards, and if it was created by the guards and the guard kills the player, the bounty goes away. Re: Bounty System (2/5) C & P - genusis - 08-01-2009 to me i think a player shouldn't be able to set a bounty on another player unless that player breaks a rule in the game. to make it more fair for the other players, because then there probably be bounties on everyone if they where allowed to freely do that. Re: Bounty System (2/5) C & P - Nean - 09-01-2009 genusis Wrote:to me i think a player shouldn't be able to set a bounty on another player unless that player breaks a rule in the game. to make it more fair for the other players, because then there probably be bounties on everyone if they where allowed to freely do that. Take this into consideration. A lower level player is going around farming, chilling, generally having a good time. Bam. A higher level comes out of nowhere, and pwns the shit out of them. Tough luck, doubtful any higher level will have any incentive to go kill them as revenge for the other player. With the bounty system implemented, this n00b can exact his/her revenge by using money as the incentive for the more bored players. Re: Bounty System (2/5) C & P - Coke - 09-01-2009 I haven't read the code so this may be an uninformed comment, but I think a nice implementation of this idea would be to restrict the ability to place bounties. The way I would do it, is allow people to place bounties if the person has killed them, or has killed someone in their guild who is the same rank or lower. Also, perhaps a new npc type that brings up a noticeboard of all current bounties would be a nice expansion. Oh, I'm not requesting this btw, just pooling my thoughts :3 Re: Bounty System (2/5) C & P - Rory - 09-01-2009 A good idea would be to only be able to put a bounty as high as you can offer. So if you only have 12gold you can only put a 12gold bounty on the player. Allowing normal players to put bounty on other player's heads. Once they use the command, their money is automatically deducted. Re: Bounty System (2/5) C & P - Nean - 09-01-2009 Fox Wrote:I haven't read the code so this may be an uninformed comment, but I think a nice implementation of this idea would be to restrict the ability to place bounties. That's a great idea, however would be a little difficult to do. I suppose I could just make a variable when someone kills another person, or something. Yeah, I like the idea of the noticeboard, I don't think it would be too difficult to add either. Thanks for the suggestions, I think I'll try some of them out! Rory Wrote:A good idea would be to only be able to put a bounty as high as you can offer. So if you only have 12gold you can only put a 12gold bounty on the player. Allowing normal players to put bounty on other player's heads. Once they use the command, their money is automatically deducted. As it stands now, they can only set a bounty if they have the right money, but I like your idea. However instead of taking all of their money, I was thinking of calculating the price based on the players level. ![]() Re: Bounty System (2/5) C & P - deathknight - 10-01-2009 I like that idea, having it calculated based on the players level, but I think it would be fun to make that a minimum. Also it would be interesing to add in 2 more commands, a cancel bounty command (get your gold back minus a certain percent I.e. bounty of 100 gold, you cancel get 90 back). And an add on to bounty command, so that if no one wants to kill that person for that money, you can increase it to create a better incentive, or someone else can add their money to the bounty to create more of an incentive. Re: Bounty System (2/5) C & P - timster0 - 11-01-2009 OMG! Thank you! Very nice tut! Re: Bounty System (2/5) C & P - timster0 - 14-01-2009 Well, I tried it out and GetPlayerBounty is int defined. Re: Bounty System (2/5) C & P - Nean - 14-01-2009 timster0 Wrote:Well, I tried it out and GetPlayerBounty is int defined. Find: Code: Sub SetPlayerName(ByVal index As Long, _ Under it add: Code: Function GetPlayerBounty(ByVal index As Long) As String Re: Bounty System (2/5) C & P - timster0 - 14-01-2009 Works perfectly now, thanks. Re: Bounty System (2/5) C & P - Nean - 14-01-2009 timster0 Wrote:Works perfectly now, thanks. You're welcome. ![]() |