collect and win code?

Topics regarding Scripting with Reality Factory
Post Reply
User avatar
GumTrod
Posts: 4
Joined: Sun Jul 09, 2006 6:55 pm
Location: atlantic canada
Contact:

collect and win code?

Post by GumTrod »

I'm planning to do a simple 'collect the items and win' type kids game, and was wondering if anyone has ever put together a similar script - something I could learn from and perhaps base my own code upon.

thanks for taking the time to read this.
User avatar
jonas
Posts: 779
Joined: Tue Jul 05, 2005 5:43 pm
Location: Texas, USA
Contact:

Post by jonas »

I've never done anything like that. But I think it could be done by treating the objects as attributes, and when all these objects have been collected the attributes equal 100 and it goes to the next level. So everytime maybe the player picks the items up it changes the attributes value, then when the all the objects are picked up the value equals 100.

I hope that makes sense.
Jonas

Focused, hard work is the real key to success. Keep your eyes on the goal, and just keep taking the next step towards completing it. If you aren't sure which way to do something, do it both ways and see which works better. - John Carmack
User avatar
GumTrod
Posts: 4
Joined: Sun Jul 09, 2006 6:55 pm
Location: atlantic canada
Contact:

Post by GumTrod »

hi jonas;

thanks for your reply 8) . i'm not 'entirely' clear on your advice, but some reading up on attributes should help me to get the full meaning.

thanks again for the help.

if anyone else knows of a code to start from, i'd really appreciate it. i'm not much of a coder :oops: , but i can (at times) modify existing code to suit my needs.
User avatar
steven8
Posts: 1487
Joined: Wed Aug 24, 2005 9:08 am
Location: Barberton, OH

Post by steven8 »

Well, the cool part is that you won't need to write any code at all. That's the beauty of reality factory.

You merely add an Attribute Entity to your level. You give it a name in Attribute Name, say, Presents (this can be anything) then fill in an Attribute Amount. Say, One.

From the help file:

Giving the Player Attributes


Everything the player has or uses in a level must be predefined as an attribute before it is available to the player. This includes such things as health, stamina and ammunition for weapons. If these items are not predefined then you can't acquire them from an Attribute entity. In the PlayerSetup entity there is an entry called AttributeInfoFile. This is the name of the file that contains all the predefined player attributes. The default Reality Factory AttributeInfoFile is called player.ini, although you can change it to any file you wish.

The AttributeInfoFile is a text file that can be edited with any text editor, such as NotePad. It is laid out very much like a standard Windows ini file, with each attribute having its own section. The name of the attribute is enclosed in square brackets such as [health] or [light]. Each line after the attribute name, up to the next section, contains the values used for that attribute. Every attribute requires a low value, which is the minimum amount this attribute can decrease to, a high value, which is the maximum amount of this attribute you can acquire, and the initial value, which is the amount of this attribute that the player starts the game with. These values are assigned in the form:

initial =

low =

high =

Leading and trailing spaces are ignored. The initial value is used to start the player off with such things as health or a limited amount of ammunition.

Some attributes are required if you wish to make use of all the features built-in to Reality Factory. The player automatically receives a health attribute but the high value is only 1. This keeps the player alive if no AttributeInfoFile is specified. Therefore, a health attribute is required if any fighting is to take place. Also, the player can acquire a light from an Attribute entity (attribute name is light) so a light attribute must be predefined in order to use it. If you are using the default melee weapons they require stamina in order to inflict damage so a stamina attribute must also be predefined. Stamina can automatically increase over time (see PlayerSetup entity). If there is an oxygen attribute defined it will be set at maximum when ever the player is not submerged in a liquid. All weapons require ammunition so these attributes must be predefined in order to use them. The default player.ini file contains these predefines for the standard Reality Factory setup, although you may wish to change the values.

The attributes already defined in the player.ini file are:

health

oxygen

Here is where you would add you attribute:

Presents

initial = 0

low = 0

high = 10 (or whatever number you choose)

Then, everytime your player collected an attribute called presents, it would add one.

Now, from here you could use triggers and logic gates. When you attribute reaches a certain level, it would set of a trigger, which would tell the logic gate to trigger some such. Man, it's been so long since I've used a logic gate, I can remember how. Here is a link to the online help page:

http://docs.realityfactory.info/0.76.1/Trigger.htm

All of this is available in the Users manual on your HDD.

I'm sure it could be scripted, but I know very little of how to. I've always found ways, if I can, to use entities rather than scripts.

Anyway, this should get you started. let us know if you need more help.
Steve Dilworth - Resisting change since 1965!
User avatar
GumTrod
Posts: 4
Joined: Sun Jul 09, 2006 6:55 pm
Location: atlantic canada
Contact:

Post by GumTrod »

@ Stephen8 -

Wow! Thanks for such a clear and detailed answer. You've been a Big help! 8)
User avatar
steven8
Posts: 1487
Joined: Wed Aug 24, 2005 9:08 am
Location: Barberton, OH

Post by steven8 »

Excellent! I'm glad I could help. My time on the board has been diminished lately due to schedule, and I have been sad at that.

Post as you need help and I'll try to be there as much as I can. Otherwise, we have a wonderful, brilliant, helpful community you can always rely on!!
Steve Dilworth - Resisting change since 1965!
User avatar
jonas
Posts: 779
Joined: Tue Jul 05, 2005 5:43 pm
Location: Texas, USA
Contact:

Post by jonas »

wow yeah you did a way better job explaining that then I did :D
Jonas

Focused, hard work is the real key to success. Keep your eyes on the goal, and just keep taking the next step towards completing it. If you aren't sure which way to do something, do it both ways and see which works better. - John Carmack
Post Reply