![]() |
String-Based Weapon Tutorial [Intermediate]
Hello... Bored one friday night, so I'm writing this! I'm doing this directly in the Forum, so there might be little mistakes.
First off... You want to know what you want your item system to look like. There are many things you can do on this to make what you want. Persay, if you want some gun item system made, something like: NPC Code: INDEX: what the item index is... A code-name to better remember things. Gun Name: The name of your Gun TYPE: Type of item (Gun - 0; Bullet - 1) Shoot Rate: How fast your bullets shoot Max Shells: How much bullets you can shoot before needing to reload. Bullet Type: The index of the bullet. Damage: How much the bullets hurt Speed: The speed it shoots out Once you have what you want, you can easily make an item... I'll make one before making the system to refer to it. NPC Code: Now that you got that determined, you can move on to the actual programming. First off... You'd want to know what items you have... You can have a multitude of items, and want them easily accessed. To do so, the most effective way I found was to record them in an array: NPC Code: In here, you can see that I have this.item, this.itemtype, and this.itemstate. This is mainly so that I can easily identify whether I selected a gun, or ammo, and whether I have it equiped. NPC Code: Now, well... In here, you see some traces of something I'll be using next. The client.weap reprosents what weapon your using. Understand so far? Now... I won't be making the Q-Menu for you, however I'll make the main functions. NPC Code: Erm... Complicated? Basically, if you say an index, it sees if it excists, and if it does, it records as the weapon your wearing. It recalls the item array, which reinitializes, and makes the item "on". Now, for the actual use... This is mainly the most complex part, once you have the top done. NPC Code: That's a basic concept of it. It doesn't subtract bullets, nor does it shoot from the center of the player, however, that is the general look of what it would look like. Hope this tutorial explained what you wanted it to. If you want me to go into more details of things, just ask. EDIT: Fixed some things. |
It's a good tutorial, but it's hard. You didn't describe any of the commands in detail and I couldn't really understand it :(...
But it looks good I guess <3 5 rating:) |
Most of the people wont understand it.
|
Erm... Not for starters, I must admit. I tried not using too simple commands none-the-less.
I can't see where someone COULD have trouble... Just submit the part of the code which you don't understand, and I'll explain it more in detail. |
use clientr.flags
client.flags can be hacked easily |
I made it conceptual...
|
I understand it. <3 Rance
=P However, for the angle in the shoot part, all you need to do is NPC Code: |
Rance, a **** who dosn't know how to indent a script I doubt he knows strings or anything..
It's good though like I said before :) |
Quote:
|
Wan, it's obvious you don't know Rance as well as I do. :)
|
NPC Code: Remember, being paranoid about spelling errors is crucial for programming. |
Erm.. You posted two errors: "float" , and the whole float thing needs to be in a #v()... :P
|
Its cool, someone should sticky.
|
Indices are not 'code names'.
They are the position in a list, which can be iterated through by using an index. |
Quote:
|
| All times are GMT +2. The time now is 10:17 PM. |
Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2026, vBulletin Solutions Inc.
Copyright (C) 1998-2019 Toonslab All Rights Reserved.