Jump to content
xisto Community
Sign in to follow this  
ewcreators

A Simple Attack System A how-to on making a simple attack system

Recommended Posts

-----------------------

Game Making ::Simple Attack Script::

Ok, When making my first, ok well second ..ok , my current and third one (first 2 were really bad, but then i found out my own way on how to make an idea script), I would always first write down or think of the stats of the character. For the purpose of this tut, i will be using space-ship kinda stats(since my first proper attack script was a space battle script) :

 

The Attack Stats :

-Accuracy(Aim)

-Hull Damage(Main Dmg.)

Defense Stats :

-Shield Power(Armor)

-Speed(dodge/swiftness)


ATTACK/DAMAGE STATS

Now , the main thing is that you visualize a real fight or fights on other games.

Usually, the attacker gets the first blow, giving him an edge/incentive in attacking.

The stat used for this is Hull Damage and its factor is Accuracy.


Well, usually in my attack scripts, i don't find a way to make "Accuracy" do its purpose, so instead, i just add it to the Main Damage equation. I'm not gonna reveal some actual attack equations, ill just give a base simple one like most games have.

 

//create the equation for the attacker$hit_1 =round(rand(1,$damage_1) * $accuracy_1 + $level_1 ) / $ level_1   / $accuracy_1 + 1);//create the equation for the defender$hit_2 =round(rand(1,$damage_2) * $accuracy_2 + $level_2 ) / $ level_2 / $accuracy_2);

$hit_1 is the attack equation for the person who attacks aka the Attacker.

$hit_2 is the attack equation for the person who is being attacked aka the Defender.

You may notice, that in the second equation, there is no +1 at the end. this is because, the defender doesn't gain an incentive like the attacker. The attacker is the one who starts the fight thus taking the first blow which gives + 1 damage. Then the defender retaliates giving +0 bonus when he attacks back.

 

 

This is not so much, its barely little, but I have some other work right now, so I will continue this tomorrow, or possibly a little more later on today if i can. The next part will be on how to utilize the defense stats and how to make the dodge stat "dodge" and the shield stat "defend".

After that, we will lay out the entire structure and go through how it all fits in into 1 thing.

 

~Ewcreators aka Aldo

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

×
×
  • Create New...

Important Information

Terms of Use | Privacy Policy | Guidelines | We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.