Working on battle system, need advice please.

Started by Construed, Sun 09/01/2011 09:48:29

Previous topic - Next topic

Construed

#20
edited bad stuff :( sorry
I felt sorry for myself because I had no shoes.
Then I met the man with no feet.

Construed

#21
edited bad stuff :( sorry
I felt sorry for myself because I had no shoes.
Then I met the man with no feet.

Khris

Here's what I'do:
Put this in Global.asc:
Code: ags
function player_UseInv() {

  if (player.ActiveInventory == hpot) {
    health += 10;
    if (health > player_maxhealth) health = player_maxhealth;   // player_maxhealth is a global int variable
    player.LoseInventory(hpot);
    weight -= 1;
  }
}


Then put "player_UseInv" in the text field next to "use inv on character" on the events page for every character that's playable.

If you want to be able to take the potion by clicking it, you have to change a setting in General settings:
Set "Override built-in inventory window click handling" to "True".
Then set gInventory's visibility to "Normal, initially off". (this allows custom clicks on the GUI)

Now find on_mouse_click in Global.asc and change the first if line to:
Code: ags
  if (IsGamePaused() == 1 || (gInventory.Visible && GUI.GetAtScreenXY(mouse.x, mouse.y) != gInventory)) {

(this prevents outside clicks from being processed while the inventory GUI is open)

Then add this after right click handling:

Code: ags
  else if (button == eMouseLeftInv) {
    InventoryItem*ai = inventory[game.inv_activated];
    if (ai == hpot) hpot.RunInteraction(eModeInteract);
    else player.ActiveInventory = ai;
  }


Now put what's supposed to happen in "Interact inventory item" for the potion.

Construed

#23
edited bad stuff :( sorry
I felt sorry for myself because I had no shoes.
Then I met the man with no feet.

Matti

As Khris said, you can shorten that part using a single line:

health -= ouch;

Construed

#25
edited bad stuff :( sorry
I felt sorry for myself because I had no shoes.
Then I met the man with no feet.

Construed

#26
edited bad stuff :( sorry
I felt sorry for myself because I had no shoes.
Then I met the man with no feet.

Matti

#27
You can do something like this:

health -= Random (damage + strength);

This would lower the health at a random number between 0 and the damage plus the strength variable.

This is all very basic and logical stuff, you should really try to figure this out by yourself, otherwise we need to constantly help you until the game is finished..

Construed

#28
so
I felt sorry for myself because I had no shoes.
Then I met the man with no feet.

Construed

#29
everyone
I felt sorry for myself because I had no shoes.
Then I met the man with no feet.

Matti

#30
It's very easy again. All you have to do is using a variable.

Code: ags

int wait = 0;

//in the rep-exe:
if (wait > 0) wait --;

function oObject_Interact()
{
if (wait == 0){
  wait = 20;
  // do stuff
}
}


No matter how fast the player clicks, the action will only happen twice a second at most.

Construed

#31
edited bad stuff :( sorry
I felt sorry for myself because I had no shoes.
Then I met the man with no feet.

Construed

#32
exactly
I felt sorry for myself because I had no shoes.
Then I met the man with no feet.

Khris

#33
I don't mean to be rude (by stating the obvious) but why don't you clean up first, then ask for help?

Also, while you're at it, please indent the code. I'm not going to look at it like that, cleaned up or not.

Construed

#34
edited bad stuff :( sorry
I felt sorry for myself because I had no shoes.
Then I met the man with no feet.

Construed

#35
edited bad stuff :( sorry
I felt sorry for myself because I had no shoes.
Then I met the man with no feet.

Construed

Should i take this to the technical forum?
I felt sorry for myself because I had no shoes.
Then I met the man with no feet.

Khris

I told Studio3 how (not) to write a battle system here:
http://www.adventuregamestudio.co.uk/yabb/index.php?topic=42751.msg567251#msg567251

You are taking a similar approach to coding.

My guess is that people don't really want to get involved helping you fix that mess of code, sorry.
Opening a new thread at the technical forum won't help I'm afraid.

Icey

However mine consist of two people that are selected out of four people.

His only uses 1 person to fight. But what put's you in a struggle is that you game is Online(Like mine) and your battles consist of 1+ people. With this said, I can enter a battle room at any time but if some one else enters the room when I killed it they might be trapped there after I am sent back.

There is many downfalls to making a (Successful)RPG with ags and it is an even more pan is the ass to try at a online-RPG with ags. Now I am not telling you to stop because you dont get half the stuff. I know I cant stop because I put a lot of effort/thought into this game as it is already.

Dont think I am trying to put you down but I am pretty suer you'll figure away around this. :)

Construed

#39
you
I felt sorry for myself because I had no shoes.
Then I met the man with no feet.

SMF spam blocked by CleanTalk