Menu

Show posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.

Show posts Menu

Messages - Shockbolt

#1
Quote from: KhrisMUC on Fri 27/03/2009 19:43:55
It should be noted that this tutorial is really old and wasn't exactly perfect when it was published, either (sorry Gord).
You did a good job of adapting it to current script though. :)

For reference: String.Format returns the first parameter with the following ones inserted. So it is exclusively used to the right of a "=" or as parameter of another function.

Thanks! a few days of studying code scripting for the first time can do wonders.
I just wish the manual would give more obvious examples as to what the more advanced commands do (going further than what's seen in the tutorial(s), examples that
are related to adventure games. Cuz frankly, it's a "hell" trying to imagine what the commands do, and which commands fit together and are appropriate for what You want to do.

That said, I think I've learned alot of what I need for my games just by visiting this forum for the last few days, and I guess I'll post some of the stuff I've made so far, if there's an appropriate thread for that in here somewhere.
#2
Well...I'm stumbling along after a computercrash last night which ruined my progress so far with my game..
Starting all over again is so fun :)

I've been going through the tutorials, manual, forum and other websites such as:

http://www.geocities.com/akk13us/rpg-tuto.htm

My problem is that I want my adventure/rpg to have a handful of stats that can be affected all over the gameworld.
These are : Alchemy, Coins, Fatigue and Hunger.
These should be GlobalInt's and be constantly updated and shown in the GUI 0 : gStatusline.

Lets focus on just one of the stats: Alchemy, as I'll be able to cope with the others based on the help I'll get with that one.

in GUI 0 : gStatusline , I've made two labels : label 1 shows text "Alchemypoints:" , label 2 shows "..."

In the Global variables I've defined : "myAlchemypoints" "int" and the initial value of "5"

The problem appears when I test my game using these codes in the rep_ex :

  String Alchemy;
  String.Format(Alchemy, "%d", myAlchemypoint);
  Label.Text(0, 2, Alchemy);

The error message I get is:
GlobalScript.asc(62): Error (line 62): must have an instance of the struct to access a non-static member


Whatr am I doing wrong here?

------
Edit:

I actually found out myself in a reply that had escaped me in the first searches:

LabelAlchemy.Text=String.Format("Alchemypoints: %d", myAlchemypoint);

-------

Problem solved :)
#3
Quote from: KhrisMUC on Thu 26/03/2009 11:28:29
There's a function called repeatedly_execute() in the global script that is called 40 times per second (40 is the default value, the current setting can be obtained using GetGameSpeed()).

You'd use a variable to count minutes:

Code: ags
// above rep_ex

int timer, minutes; // declare two variables, intial value is 0

// inside rep_ex

  timer++;
  if (timer == GetGameSpeed()*60) {   // one minute of real-time has passed
    minutes++;  // increase minute counter
    timer = 0;    // reset timer

    if (minutes%20 == 0) SwitchDayNight();  // cull custom function that handles day/night

    if (minutes == 60*4) {  // four hours of real-time have passed
      AdvanceSeason();   // call custom function that advances to next season
      minutes = 0;  // reset minutes
    }
  }


Thank You! Simply amazing, I don't know if I'll ever be able to do stuff like that.
I mean, my brain hurts just by looking at the codes above, trying to understand how on earth one is able to understand and know when to put everything together
and make stuff work like You want it to. *sighs*
#4
Quote from: KhrisMUC on Thu 26/03/2009 10:35:21
AGS allows up to five background frames for each room; instead of using them for constantly animating the background, you can switch between them, so that's how I'd go about having four seasons in each room.

The best way to accomplish a day-night-cycle depends on how sophisticated you want it to look.
A very easy way is to use a semi-transparent, black (or slightly bluish), non-clickable GUI.

If you want to use different background images for day & night, you have to use two rooms per location (since you'd need 8 background frames then).

The technical side is comparatively easy; each room has a before fadein event, in there you'd check the current season (stored in a global variable), then change the room background accordingly.


Thanks, but what if I wanted the game itself to handle the transitions between seasons and day/night, by how much real-time You're spending in the game:

For example 20 minutes in realtime would be the lenght of the day or night in the game, 4 hours in realtime would be the lenght of one season (I might end up using just summer/winter for the first version of the game)


I seem to remember that in the Quest for Glory 1 game, day and night occured on a regular basis.
#5
How would one go about, creating a game having a code that changed day into night and the other way around, and also having something that would allow for the game to change seasons (summer, autumn, winter, spring)?

The scenes will change accordingly to the above, and the player should be able to have an option to sleep/rest to speed things up.

I've gone through the tutorials, read up on several website (with old codes that don't help me much now)
I'm reading the manual now, but for a graphic artist, it's mighty tough to understand how it all fits together. I mean, I could aswell have been studying advanced chinese, I don't think it'd be much more difficult than this :)
SMF spam blocked by CleanTalk