![]() |
[WIP] Enemy (Baddy) System
Baddy System V.1
So, hey guys! I've actually had the chance to start scripting and working with enemies and ai and the sort and have really been having fun doing it. I'm currently working on a project, ( yes one of the same projects I always bounce back and for between ) which requires me to do so. However, I wanted to be a bit inventive in what I was doing about it. So I figured I'd use text files and a public function in the database. I eventually hope to release alot of the things from my project scriptwise for learning purposes and to make life easier for those who lack scripters on their up and coming servers and such. I doubt any scripts I've made custom to my project will help you must in terms of copy and pasting to use it, but it might help you le arn something and that's what I want to do ( we need more scripters! ). :) Here, I can only post the actual class part first as I haven't gotten around to doing the loading of the text file and setting the vars, as well as doing a custom attack system. So for this purpose I use "wa****", as well as regular Graal head and body. Keep in mind that this system is being debugged and you should NOT use it, I posted it here as to show what I'm doing so far, what I plan to do and to get major feedback and some opinions as well. --- Plans --- 1.) Get everything that can be done with regular Graal finished up completely. 2.) Finish the loading of the file and setting of the appropriate ani. 3.) Get the AI worked on a bit more and perfected as much as possible. As said this is not the only file based AI I plan to release as a package from my project, but for the most part if you have any questions just AIM me. So without further ado, here's the, in progress, class for the enemy: PHP Code:
Upon the final version everything, necessary, will be commented and I was have a guide or something about using it. The distance checks and hurt section was a part borrowed from Gambet. I also had some help from Joey's old baddy script. :) Crits would be nice and appreciated. |
whats the point of putting this here unless u want people to use it?
|
Quote:
Very nice script, killerouge, I hope people like theHAWKER can learn from this, and perhaps if it gets some more features, I may even use it on my server! :) Chris |
Quote:
|
killerouge, I never quite understood what enum did, and what it can be used for. Care to explain?
|
it says that u cant use it, so i was wondering why he put it here :(
|
Quote:
|
Quote:
PHP Code:
Quote:
In my post I clearly stated it was free to use when I had finished the actual product. I put it here so that people like you may learn from it and also to get some constructive criticism from people who can actually script. |
enumerators auto-assign integers to the variable. ( I don't think you should use them inside events, or functions. I don't in C++, at least. )
PHP Code:
|
Enum is useful because it can be used in ways like this:
PHP Code:
|
Quote:
Of course this makes it seem more and more like an array! But easier to remember and such in the fact that it's more so, enumname.stuff rather than array[0]. Can you add things to enumerators through function? |
PHP Code:
PHP Code:
|
Quote:
Anyway, back on topic! Can I get a few opinions here? |
Enumerators are mainly for auto-assigning integers, I would prefer something like xXziroXx said for the keys. ( Though I think you wouldn't be required to set it as a new TStaticVar(), unsure though )
|
Quote:
HTML Code:
function onKeyPressed(characterCode) |
Quote:
|
Back on topic, this is a pretty good base of a script. Needs a bit more meat on its bones before it's ready to be used though.
|
I also think enumerators are pointless, I had a talk about this on RC before, I use them because I think it makes my code look cleaner.
|
They can be useful if you know how to use them well. Stuff like using enums for every month of the year. Gives them the appropriate monthly number. Can also be used for things like colours. It may be easier to use 'purple' rather than a 3 in code.
Another example could be parameters. Say a function takes an integer as a parameter to change the object. For instance, a baddy and it's mode. It may be easier for people to understand if they send 'attack' rather than a 3 as a parameter. In essence, the number 3 will still be sent as the parameter but the code will make more sense for the programmer. Enums are a method of documentation. They have there uses. I think it's much more efficient to use enums to represent integer values rather than creating a TStaticVar() for them. |
Enums are not pointless.
|
Quote:
|
| All times are GMT +2. The time now is 11:50 AM. |
Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2026, vBulletin Solutions Inc.
Copyright (C) 1998-2019 Toonslab All Rights Reserved.