More questions regarding an battle system

Christopher
09 Feb 2005, 02:18
One of my game has an item with the name and alias of 'It'. However whenever I try to do anything with the item it comes up with the undefined 'it' error message. Is there anyway to fix this?

I'm planning a complicated RPG battle system at the moment, and am having some problems. The plan is to stick enemy or character names in certain 'slots' for battle and refer to their stats etc. during battle. Thus I was wondering:

How do give each enemy object values for hp, strength etc. (for the characters i'm just using variables eg. char1hp) and set flags onto them for things like ability to cast spells or status conditions

I want to set a variable (eg. monster1) to the name of the enemy selected, and then refer to the aforementioned values easily. How can I do this?

Is there any easy way to quickly sort the 5 to 8 characters/enemies into order according to their speed value, and then execute a procedure that is dependent on if its a character or not?

How can I check to see if a variable starts with a certain word (eg. Attack (something))?

Is it possible to have a variable in a variable? For example, if a variable "attack type" is set to poison, can I easily check to see if an enemy has the flag "resist #attack type#"?

And finally, how can I give each enemy object a procedure that I can refer to later (eg. one for choosing how to act in battle, then refer to it later to run the #enemy1# procedure #act#)?

Okay, I think that's it for now. Sorry for all the questions, but that's what happens when a noob tries to achieve incredibly difficult goals.

paul_one
09 Feb 2005, 08:27
Right, these questions qill be hard to reply to, and not all of them will be answered to in a good manner.

It's better not to have an alias of "it", but I suppose it should work... You'd have to send your code to Alex to get a ifx on whether it's a Quest fault, or something in your coding.

Expect to have many more problems with your RPG system, especially if it's not planned out 100% from the start... I've changed my object/monster/etc specifications it's unbelievable.

Certain "slots" I'm guessing you mean, certain places in the status variable window... No, although I would love a feature to organise the object/inventory/status variable list... Somehow giving each object a number which organises it - and any numbers that are the same are organised alphebetically...

For each enemy - I reccomend you use object's... Give each enemy an object, and use object properties for HP/MP/etc, and use object actions for their attacks... That's what I'm doing - and infact I have alot of it done for enemy attacks, just need to have them automated, and status effect's added too.

As I said, I'd use object properties - then you can just refer to the variable:
#monstername:HP# and that will deal with the HP...
You could, alternatively use the nice variable names available - like:
monster.HP... But I don't like that - too many variable's IMO.

Where you say "sorting", I suppose you mean an internal sorting - where the computer goes through and sort's them by their speed and then goes through them one by one. I'm half way through doing this in my own system, and I took a short twist back into magic because that's more interesting :D. I have to work the last bit out a bit more.

Well, if you're just checking what the user typed then just use the command "attack #whatever#" and whatever the player types after "attack" goes into #whatever#"
You'll have to clear up what you mean by that statement.

You can indeed check for the status effect's if you use object's and object properties (you can use $objectproperty( monster ; resist #attacktype# )$ to get it) or something like that... But you cannot have a variable within a variable - which usually means you want to pass-by-reference (IE, use the variable to store the name of another variable)... Quest is only pass-by-value (give the contents of a variable over, that's it).
I have yet to code my status effect code, but it will be very easy as I have it all in my head.

You've had exactly the idea I had, give the monster object an "action" as an attack... Object's in quest actually have "action's", which are procedure's - but they are stored in the object themselves... This means you don't have to go down a whole list of variable's - but just look in the monster-object you want to see the attack for.
I have this part working in my battle system. Each monster has an action, and each action can call an attack etc - or the designer can create his own attack... It works either way.

You are correct - these are incredibly difficult goals, especially with Quest (you need to know the language and know the quirks and difficult area's in which ASL restricts you) - but you can make it if you go in little steps.

Hope I helped a little.

Christopher
10 Feb 2005, 06:43
Computer Whizz wrote:Expect to have many more problems with your RPG system, especially if it's not planned out 100% from the start... I've changed my object/monster/etc specifications it's unbelievable.


I'd like to think I've planned out most of the system well. I've planned all the spells, status effects and the like to put in straight away and with my system adding more monsters shouldn't be too hard.

Computer Whizz wrote:Certain "slots" I'm guessing you mean, certain places in the status variable window... No, although I would love a feature to organise the object/inventory/status variable list... Somehow giving each object a number which organises it - and any numbers that are the same are organised alphebetically...


By slots, I meant having four variables (enemy1, enemy2 etc.) that will contain the name of the enemy object (or 'none') The plan is to refer to the enemy's stats and stuff through these somehow.

Computer Whizz wrote:For each enemy - I reccomend you use object's... Give each enemy an object, and use object properties for HP/MP/etc, and use object actions for their attacks... That's what I'm doing - and infact I have alot of it done for enemy attacks, just need to have them automated, and status effect's added too.


That's the general idea. I'll have to go figure out how to use the object properties and actions though, since I haven't tried them yet.

Computer Whizz wrote:As I said, I'd use object properties - then you can just refer to the variable: #monstername:HP# and that will deal with the HP... You could, alternatively use the nice variable names available - like: monster.HP... But I don't like that - too many variable's IMO.


Yeah, that would probably be the easiest to do. Variables don't worry me at all, I'll just keep a list of them all in a text document. You wouldn't believe how many different flags I've got in one of my other games.

Computer Whizz wrote:Well, if you're just checking what the user typed then just use the command "attack #whatever#" and whatever the player types after "attack" goes into #whatever#" You'll have to clear up what you mean by that statement.


Well since you get to control four characters I plan to use 'store next thing player types into a string variable' (or whatever its called) command four times for each character, so I don't think I can do that. I want to be able to add a condition that if char1command is 'attack (something)' then do this, else do that. It's a bit confusing.

Computer Whizz wrote:You can indeed check for the status effect's if you use object's and object properties (you can use $objectproperty( monster ; resist #attacktype# )$ to get it) or something like that... But you cannot have a variable within a variable - which usually means you want to pass-by-reference (IE, use the variable to store the name of another variable)... Quest is only pass-by-value (give the contents of a variable over, that's it).
I have yet to code my status effect code, but it will be very easy as I have it all in my head.


Urgh. I'm going to have to hand code half of this aren't I? (crosses fingers and hopes not)

Computer Whizz wrote:Hope I helped a little.


Yep, you managed to help out again!

paul_one
10 Feb 2005, 18:46
Right now I WANT to have object's in the players' inventory AND the object window - both are the names of the characters (ie "Sephiroth", "Cloud", "Aeris" and "John" in both inventory AND room object pane)... That was you can use them on themselves/they can attack automatically/you can use inventory objects on them...

BUT I haven't fully thought out that "how they will attack" yet.

I'll probably add up all their attacks, with your's, and then use that to compare to the monsters' combined speed/agility.

BTW, Alex... This forum has - for some reason - basically stoped working...
Is this the phpBB bug going round or has the mySQL database gotten too big?

Alex
10 Feb 2005, 22:48
Er, forum is working fine for me - what's not working for you?

paul_one
11 Feb 2005, 16:19
The forum (and infact website) takes AGES to load, about 10 minutes for each page - something like that... INCREDIBLY slow.

paul_one
11 Feb 2005, 21:08
OK, it's really sped up alot now... I don't know what it was.
Still a tiny bit slow, but at least it loads now, whereas yesterday I couldn't even load up the forum's... (pinging from this machine, or infact a seperate online page didn't work.) Maybe a server-issue has been fixed, or updated or whatever.

Christopher
12 Feb 2005, 09:05
(Hmmm... this is going to take longer than I thought...)

I've done the code for selecting your party, but I'm having trouble with leveling up. How can I add simple math equations to the code? I can get the right random numbers for the stats, but when I tried incrementing the char1:base_strength variable it didn't work?

BTW My game's got a name now... RPG - Reading Presented Gallivant (aka Restricted Programming Gamble:roll:).

007bond
12 Feb 2005, 21:28
If you look back a couple of months through the developer forum (i think), you'll find computer whizz's maths library. If you download that, and put it into your game, you might have some more luck.

paul_one
13 Feb 2005, 12:16
Heh, that's a semi-beta library as well...

Quest can't handle full equations - it can only handle one operand (+, -, * or -)... It also has integer problem's too, where all numbers have to be full numbers.

I did try to solve this, but also forgot that Quest uses signed integers', which have a restriction of +/- 32,000 or there abouts... In short, I need to re-write the library to allow these numbers.

ALTHOUGH, right now the library can handle this:

set numeric <$cwadd(3;5;7;9)$ / $cwsub(15;1;2;3)$ >
Where that'll all come down to :
set numeric <24 / 9>

The great thing is you can add variables like so:
set numeric <$cwmult(%var1%; %var2%; %var3%)$ - $cwadd(#object:var#; %var33%; 9)$ >

If you want any help on that code, then if you send it to me, and tell me exactly where the problem is, I'll have a look into it for you...

007bond
13 Feb 2005, 19:53
Maybe you could get MaDbRiT to help you?

Christopher
14 Feb 2005, 03:17
Ah, one last problem. Whenever I set a property on an object as (say) 12, it treats it as a string variable rather than a numeric one. For example,
property <char1; base_strength=15>


How can I fix this?

paul_one
14 Feb 2005, 07:37
Well, it doesn't really matter, as string variable's can be changed into numeric variables VERY easily... Infact, sting variables can be used as numerics AFAIK...
I wouldn't worry too much about it.

007Bond - There are a couple of reasons... One of them is me, one is him being busy, and one is the language - it's not needed for multiple people to develop it.

I could re-write the math library to have better decimal support, but I just can't be bothered right now... It's just too tedious to locate the point, seperate the numbers, then do aritmetic on them seperately and then combine them... It's really only the decimal effected right now, I think I have the other functions in place.

Christopher
14 Feb 2005, 08:33
Computer Whizz wrote:Well, it doesn't really matter, as string variable's can be changed into numeric variables VERY easily... Infact, sting variables can be used as numerics AFAIK...


Well it's preventing my level-up code from working correctly (ie. at all). Maybe it's my other code that's the problem... what would be correct the increase a variable-defined object's property by another variable?

paul_one
14 Feb 2005, 17:07
You want to change an object's property - that property name is held in a variable... Right?

I deal with this in my code (I have a 14-depth array and loop through it to get/change values)... But I shall give an example here:

property <char1; base_strength=10>
set string <obj.property; base_strength>
property <char1; #obj.property#=20>

That will set the property to 10, then change it to 20.

Christopher
15 Feb 2005, 00:40
Yeah I can change it, but I want to increase by another variable (ie. %strplus%). :? I'm confused...

paul_one
15 Feb 2005, 07:55
property <object; base_strength=10>
set numeric <strplus; 10>

set numeric <newvalue; #object:base_strength# + %strplus%>
property <object; base_strength=%newvalue%>

That will set it first to 10, set a numeric to the base_strength added to %strplus% and then change the property to that.

Christopher
15 Feb 2005, 08:18
It finally works! :D Now I get on with the interesting parts (first up, items). Hopefully a demo will be released in a few weeks now. Thanks again!

(BTW computer whizz, I put you in the credits section of my help guide for all your help!)

Shadowalker
16 Feb 2005, 08:27
Hi...I haven't really been following this thread, but I was skimming through it, and I saw that you (Christopher) wrote that you will be releasing a demo in a few weeks. I don't know if you know this, but unfortunately, Alex doesn't let people post demo's anymore. Only full versions. Good luck with your game.

Alex
16 Feb 2005, 18:48
Well I don't put demos up on the Quest Games Archive these days, and that's to discourage people from uploading a "game" with two rooms and three objects with no description and an intro text telling me how fantastic the game will be one day, honest.

Of course there's nothing to stop you from uploading a demo to your own webserver and putting a link on the Games & Chat Forum.

Christopher
17 Feb 2005, 02:02
Oh well, I do have my own webspace so I'll put it there. I believe that getting people to judge and rate your demo is good for the game, but that's just my opinion. And make that a month a the least, I didn't release how long some of these things take!

davidw
17 Feb 2005, 07:44
It's a good idea to get people to test your game before it's released (betatesting) but there's no need to fill up the main page with demos. There's enough junk on there already.