Please login or register.

Login with username, password and session length
Advanced search  

News:

IRC channel - server: waelisch.de  channel: #wme (read more)

Author Topic: Using Point in the game  (Read 3743 times)

0 Members and 1 Guest are viewing this topic.

Adventureforall

  • Lurker
  • *
  • Karma: 0
  • Offline Offline
  • Posts: 26
  • I'm a llama!
    • View Profile
Using Point in the game
« on: June 15, 2003, 11:48:27 AM »

Is It possible too use a point in the game, for example, when i pick up a key i get 5 points, and so on.

I though that to accomplish this i had the make a "variable" called "points" and set it to "0" in the beginnening of the game. when an actions is done "var_points +5" (5 is refering to the pionts i ad to the action"

If this is possible can anyone tell me how to to this ?

Logged

Jerrot

  • Global Moderator
  • Addicted to WME forum
  • *
  • Karma: 0
  • Offline Offline
  • Gender: Male
  • Posts: 690
    • View Profile
Re:Using Point in the game
« Reply #1 on: June 15, 2003, 12:10:18 PM »

Hi !

Is It possible too use a point in the game, for example, when i pick up a key i get 5 points, and so on.

Actually it is as you already mentioned - you set a global variable "points" and in the action script you just increase this variable. If you have an object called "key", you probably have somethin like a "key.script". And you could do this point system there by:

Code: [Select]
// points are global to all scripts. if not set yet, set them to zero.
if(points==null) points=0;

on "Take"
{
  // walk to the key
  GoToObject();
  actor.Talk("Cool. It's a golden key! I get 5 points!");
  points = points + 5;
}

Hope that helps ?
Logged
Mooh!

odnorf

  • w00t?
  • Global Moderator
  • Addicted to WME forum
  • *
  • Karma: 7
  • Offline Offline
  • Gender: Male
  • Posts: 1454
  • Lamp dog!
    • View Profile
Re:Using Point in the game
« Reply #2 on: June 15, 2003, 12:13:42 PM »

But that way you should put the line "if(points==null) points=0;" in every script that can change the points! You could just place that line once in the game.script file (if you use the wme_demo as a tutorial).
Logged
fl*p

Adventureforall

  • Lurker
  • *
  • Karma: 0
  • Offline Offline
  • Posts: 26
  • I'm a llama!
    • View Profile
Re:Using Point in the game
« Reply #3 on: June 15, 2003, 12:32:01 PM »

So now i put : if(points==null) points = 0 in the game.script file
and after a correct handling i put : points = points + 5

And i need to put : global points;  in the base.inc.

Thanx that will help.
Logged

Adventureforall

  • Lurker
  • *
  • Karma: 0
  • Offline Offline
  • Posts: 26
  • I'm a llama!
    • View Profile
Re:Using Point in the game
« Reply #4 on: June 21, 2003, 09:31:10 PM »

Looks likes it's working.

Now i want to make an window in the inventory bar to display the score. My question is can i do that in the inventory.def or do i have to make a new file for it, i already tried several things, but the game crashed every time.
Logged

Mnemonic

  • WME developer
  • Administrator
  • Addicted to WME forum
  • *
  • Karma: 41
  • Offline Offline
  • Gender: Male
  • Posts: 5679
    • View Profile
    • Dead:Code Site
Re:Using Point in the game
« Reply #5 on: June 23, 2003, 03:18:36 PM »

Now i want to make an window in the inventory bar to display the score. My question is can i do that in the inventory.def or do i have to make a new file for it, i already tried several things, but the game crashed every time.

Yes, you can add it to the inventory.def. There is a "WINDOW" definition in there, just add something like:

Code: [Select]
WINDOW
{
  ...
  STATIC
  {
    NAME = "score"
    X = 100
    Y = 20
  }
}


Now, whenewer you change the score, update the score indicator:

Code: [Select]
var InvWin = Game.GetInventoryWindow();
var ScoreWin = InvWin.GetWidget("score");
ScoreWin.Text  = points; // points is your global variable

Note that I'm improvizing now, I didn't test it. There may be some mistakes, but you get the idea.
« Last Edit: June 23, 2003, 03:26:45 PM by Mnemonic »
Logged
Yes, I do have a twitter account
Please don't send me technical questions in private messages, use the forum. ::wave

Adventureforall

  • Lurker
  • *
  • Karma: 0
  • Offline Offline
  • Posts: 26
  • I'm a llama!
    • View Profile
Re:Using Point in the game
« Reply #6 on: June 23, 2003, 03:38:53 PM »

Thanx it's works
Logged
 

Page created in 0.219 seconds with 24 queries.