![]() |
Make Item Command - Client Command - Printable Version +- Mirage Source (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: Resources (https://mirage-engine.uk/forums/forumdisplay.php?fid=49) +---- Thread: Make Item Command - Client Command (/showthread.php?tid=444) |
Make Item Command - Client Command - Leighland - 05-12-2006 Difficulty 1/5 Understanding 2/5 - must posses knowledge of code What this does is allow GM's (or whatever access level you specify) to create items while in game. CLIENT SIDE in modClientTCP add the following: Code: Sub SendMakeItem(ByVal ItemNum As Long) in Sub HandleKeyPresses FIND the following: Code: ' Editing shop request after the "End If" add the following: Code: If Mid(MyText, 1, 5) = "/make" Then Code: /make # SERVER SIDE in modHandleData add the following before the last "End Sub": Code: ':::::::::::::::::::::: 1. Checks to see if the "MyIndex" is of access level 3 or higher, if not it exits the sub. 2. It spawns the item using the data sent by the packet. 3. Sends a message to everyone stating that a GM has created an item, just for kicks. 4. Logs the action. If you have log handler's this will be useful when the logs are checked to make sure that someone hasn't used a hacked client to create an item. Though, the global message will give them away anyways. That's it. If anyone has problems just post them. I ran it twice and tried it all and it seemed to work fine. Don't worry about using numbers that are out of range... it just doesn't create the item, and doesn't cause the server/client to crash. This can be greatly optimized and when I do get around to adding on to this function I will update this post. Enjoy ![]() - Matt - 05-12-2006 Does it spawn the item on the map, or into the player's inventory? - Forte - 05-12-2006 Quote:Note: # is the item number. On my server, gold is item number 1. So using "/make 1" would spawn 1 gold piece under me. The amount spawned can be changed (as stated above). ![]() - Leighland - 06-12-2006 To give a better answer than Quake, it spawns directly under the player, on the map. No one can take the item, unless you've changed something, while that person is standing on the item. I had the whole "drop party" thing in mind when I did this. - Matt - 06-12-2006 Maybe this should be expanded upon and made to spawn the item in the players inventory. You know, like most commercial games and such. - Rian - 06-12-2006 To make it spawn straight into the inventory just do this: Server side, find this line Code: 'Call SpawnItem(Val(Parse(2)), Val(Parse(3)), Val(Parse(4)), Val(Parse(5)), Val(Parse(6))) ![]() Anyways, comment or remove the line I posted above, and replace it with this: Code: Call GiveItem(Parse(1), Val(Parse(2)), Val(Parse(3))) Now I also noticed that you can only spawn 1 item at a time, which isn't a bad thing unless you want to spawn a currency. That's where these modifications come in handy. You should already know that these belong client. Just replace what you added while following Leighland's tutorial. Code: ' Spawn Item Code: Sub SendMakeItem(ByVal ItemNum As Long, ByVal ItemVal As Long) There, now you can choose which item number and HOW MANY of that item will be spawned. Example /make 001 500 - That would spawn 500 of item 1 (gold in my case) Yes, each value must be triple digits. Though, the code is commented and tells you more about that ![]() - Matt - 06-12-2006 Good job. I was actually suggesting for him to improve upon the tut, but hey, it's good to see you're actually getting better with the code Sonire. ^_^ - Leighland - 08-12-2006 Sonire Wrote:To make it spawn straight into the inventory just do this: Oh well, beat me to it. I did it slightly different than the way you have but I did make the modifications to spawn weapons and such in numerous amounts, using the MAX_MAP_ITEMS constant as my cutoff variable. Anyways, that code looks like it work, but here's mine: Client Side Code: If Mid(MyText, 1, 5) = "/make" Then Code: Sub SendMakeItem(ByVal ItemNum As Long, ByVal ItemAmount As Long) Server Side: Code: ':::::::::::::::::::::: However I did not code the functions for spawning the items right into the inventory, but if I do I think i'll be wise to add another variable. Based on that variable the server will decide whether to spawn the item on to the map, or to the inventory. I also realize that code above could be a lot shorter using some "Or" statement instead of that method. That way is just easier for me to understand lol. There's probably a million and 1 ways to expand on this so if anyone is willing, feel free to do so ![]() NOTE: I am in the midst of completely changing the potion system to that's why there is no potion support. But if you want it, it's as easy as (A) Making your potions stackable items or (B) copying my weapon/shield/armor/helmet code above, and using it for a few more ElseIf Statements. |