Working on battle system, need advice please.

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

Previous topic - Next topic

Icey

Well it seems you like almost there.

Hope you get it bud. :)

Construed

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

Khris

Quote from: GrimReapYou on Sat 12/02/2011 23:45:09
then i just need to [...] copy/paste this code to multiple rooms, replacing the monster sprites/names/variables.

This is precisely what should be avoided.

Construed

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

Dualnames

Worked on Strangeland, Primordia, Hob's Barrow, The Cat Lady, Mage's Initiation, Until I Have You, Downfall, Hunie Pop, and every game in the Wadjet Eye Games catalogue (porting)

Construed

#45
Ok after ripping out half my global and functions and hair.......I'm finally able to make a struct....

GLOBAL.ASH
Code: ags

struct characters
{
  int strength;
  int dexterity;
  int stamina;
  int maxstamina;
  int mana;
  int maxmana;
  int health;
  int maxhealth;
  int sword;
  int magic;
  int throwing;
  int climbing;
  int expierance;
  int maxexpierance;
  int weight;
  int archery;
  int gold;
  int silver;
  int copper;
  String name;
};

Code: ags


characters fighter;
fighter.strength = 20;
fighter.dexterity = 10;
fighter.stamina = 50;
fighter.maxstamina = 50;
fighter.mana = 10;
fighter.maxmana  = 10;
fighter.health = 50;
fighter.maxhealth = 50;
fighter.sword = 1;
fighter.magic = 0;
fighter.throwing = 0;
fighter.climbing = 10;
fighter.expierance = 0;
fighter.maxexpierance = 9999999;
fighter.weight = 0;
fighter.archery = 0;
fighter.name = "Fighter";

characters wizard;
wizard.strength = 5;
wizard.dexterity = 5;
wizard.stamina = 20;
wizard.maxstamina = 20;
wizard.mana = 40;
wizard.maxmana = 40;
wizard.health = 40;
wizard.maxhealth = 40;
wizard.sword = 0;
wizard.magic = 1;
wizard.throwing = 0;
wizard.climbing = 0;
wizard.expierance = 0;
wizard.maxexpierance = 9999999;
wizard.weight = 0;
wizard.archery = 0;
wizard.name = "Wizard";

characters thief;
thief.strength = 5;
thief.dexterity = 10;
thief.stamina = 50;
thief.maxstamina = 50;
thief.mana = 5;
thief.maxmana = 5;
thief.health = 60;
thief.maxhealth = 60;
thief.sword = 0;
thief.magic = 0;
thief.throwing = 20;
thief.climbing = 10;
thief.expierance = 0;
thief.maxexpierance = 9999999;
thief.weight = 0;
thief.archery = 1;
thief.name = "thief";

Now how do i put this garbage into action.....

Seems like im increasing the scripting required if anything.
I felt sorry for myself because I had no shoes.
Then I met the man with no feet.

Construed

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

Khris

That's not how you are supposed to use them.

You don't need three instances for the player, you only need one.
Then you'd set the one instance's values to those of the class the player chose.

But you're going to have several different enemies, right?
That's were structs really come in handy.

Say you had a troll, a rat, a dragon and an evil wizard as enemies. They are all going to have different stats so those are what you'd store in structs, like an enemy type database.

When the player encounters a random enemy, you load the stats data in a player struct and an enemy struct and keep track of the battle by updating the values of those.

But yeah, sure, all this was really a trap to set you back; structs can indeed suck it.

Construed

I apolagize man, I just didnt know that switching over to structs were going to require an 80% rebuild of what i've done so far.
But you are right, they are alot neater and tidier.
And im sure in the end i will thank you for getting me to switch over when im not buried in a huge pile of unknown global variables.
I suppose i need to drop all other game design aspects for now and focus on structs...
I felt sorry for myself because I had no shoes.
Then I met the man with no feet.

Ryan Timothy B

Thanks for making this a very productive thread with nothing but edits of "jkdhdfhf", it definitely makes this thread useful to others.  Thanks.

Remind me not to offer help next time you ask a question.

ddq

Reminder: don't offer help next time he asks a question.
Even if you don't think your old posts are valid, someone could still learn something from them and maybe help you, so editing them to "jklkjkl" is just silly.

Construed

#51
I apologize for my harshness, but you have no idea the stress i've been under putting in 6-8 hour days of pure game design working on multiple aspects at once.

Besides the destruction of all my global variables bewildered me and caused me to go into a frenzy of brute forcing code which eventually led to me solving the multiplayer follow char problem! users can now equip and use items and the items can be seen by other players!
I felt sorry for myself because I had no shoes.
Then I met the man with no feet.

BlueAngel

Just want to throw my two cent in here.

Please don’t delete or change old thread, please.   :'(
I still having a hard time learning AGS and the manual are a bit hard to understand so to not ask for many stupid questions I always search the forum first and have found a lot of answers doing so.

Knox

QuoteBut yeah, sure, all this was really a trap to set you back; structs can indeed suck it

lol! omg...
--All that is necessary for evil to triumph is for good men to do nothing.

Construed

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

Khris

Whatever makes you happy. Just don't act like a complete jackass here, you aren't doing yourself a favor.
If you feel "pissy", don't post until you feel normal again.

And I sure as hell didn't leave you hanging; you converted everything to structs without really understanding what they do or how to use them. Then you gave me about 2 hours to get you out of the mess you created by not understanding them, and when I didn't get here in time, you accused me of intentionally misleading you into a trap.
You are a fucking sociopath it seems, you need to chill.

Nobody here is going to think "hey, GrimReapYou wants to fuk a struct, swell guy that", so really, just stop.

Dualnames

Khris is correct, I mean we've repeated this too many times over on IRC. You need to grasp a basic deal of the programming, before going into advanced stuff.

You have to slow down. Your games suffer from design and coding issues.
Worked on Strangeland, Primordia, Hob's Barrow, The Cat Lady, Mage's Initiation, Until I Have You, Downfall, Hunie Pop, and every game in the Wadjet Eye Games catalogue (porting)

Ryan Timothy B

I wouldn't go any other way than using a struct. So don't think he's teaching you improper or half-arsed methods.
Once you understand a stuct, which shouldn't be too hard if you experimented with using one, it'll save you unbelievable time and you'll NEVER go back.

Construed

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

Ghost

Quote from: GrimReapYou on Wed 01/02/2012 09:52:04
and btw khristhanks for being a man and accepting my apology "not" I hope you burn in hell you godless sack of horse manure...

Thanks for turning a thread that HAD some interesting information into foul gunk. Really, what's that supposed to tell us about you?

SMF spam blocked by CleanTalk