Please login or register.

Login with username, password and session length
Advanced search  

News:

For WME related articles and tutorials visit WME Resource Center.

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.

Messages - organican

Pages: 1 ... 3 4 [5]
61
Technical forum / Re: inventory items
« on: October 16, 2004, 02:21:06 AM »
:) Ok, I'll try this as best as I can...

>ok I need to know how to combine items.
>1. Items combined in inventory to make a new item.
>Example: I have an empty bottle and a cork. I pick up the cork (left click) from inventory and place >it on the cork in inventory and (left click) - result = cork item in inventory gone, bottle item with
>mouse pointer gone, item in inventory is now bottle with cork.

In the bottle's script, make an event called <on "cork"> (if that's the name of the cork)
and then write a little code, like:

on "cork"
{ Game.DropItem("cork");
Game.TakeItem("cork_bottle");
actor.Talk("Here I am supposed to say something interesting.");
}

So now the actor dropped the bottle and instead you got the new bottle with the cork (you should make this bottle separately, it's easier to script and keep track of.

Just a note about the "on" thing: it seems really backwards-intuitive.
If you use the cork on the bottle you might think that it's the cork that should have on "bottle"
instead of the other way around. But it's the object you're using things on that has the "on something" in it.
And also, you don't have to declare the on "cork" or anything, it's automatic when you use an object on another. So whenever you have a new item, like an apple, you can just write in some object's script: on "apple" {here's what happens}.

>2. Items combined from inventory into a scene.

>Example: I have an empty bottle and in the scene is a fountain. I pick up the empty bottle (left >clcik) from inventory and place it on the scene on the fountain (entity in scene) the empty bottle >changes to bottle of water against my mouse pointer. (left click) puts bottle of water in inventory.

Ok. This is more tricky. The bottle have to have two different sprites or pictures for this.
And then you need a variable to keep track of the bottle's state (empty, full, etc...)
You have two ways to do this, you can either have different bottles, or the same bottle and change it's pictures dynamically.
(the second one is a bit more tricky and requires more scripting)

[... lots of code goes to waste]

No scrap that, I tried it out and came to the conclusion that it's easier to have separate bottles for full, empty, blood, wine, whatever.
So then in the fountains script you just say:
on "fullbottle" {...}
on "emptybottle" {...}
and so on, where fullbottle and emptybottle is different items.
so in your case you say:
(in the fountains script)

on "fullbottle"
{ actor.Talk("But it's already full of water."; }

on "emptybottle"
{ Game.TakeItem("fullbottle", "emptybottle");
Game.DropItem("emptybottle");
Game.SelectedItem = "fullbottle";
actor.Talk("Here, finally I say something cool...";
}

the "emptybottle" in
Game.TakeItem("fullbottle", "emptybottle");
is which object you're to insert it after in the inventory (this is optional, works with just "Game.TakeItem("fullbottle");").
then you just remove the old bottle with
Game.DropItem("emptybottle");
and then you make the new bottle selected from the inventory with
Game.SelectedItem = "fullbottle";
and then finally the actor says something cool.

the bad thing about this is that you have to have four differen bottles if
you can use the cork on each of them.

>3. Item combined with NPC

>Example: I have a bottle of water and in the scene is an old man. I pick up the bottle of water (left >click) from inventory and place it on the NPC (in the scene) and left click. The bottle of water >disappears and the NPC animates a response.

in the old man's script:

on "emptybottle"
{ Game.Interactive=false;
this.Talk("This bottle is empty.");
actor.Talk("I can see that..");
this.Talk("What would I want an empty bottle with?");
actor.Talk("Drink it??...");
this.Talk("OK.");
this.Talk("I now drink this bottle and give it back to you... the player that is...");
actor.Talk("Was it any good?");
this.Talk("Perfect. But I'm still thirsty. And I won't give you the apple until I get my dose of H2O.");
actor.Talk("Ok.");
Game.Interactive=true;
}

on "fullbottle"
{ Game.Interactive=false;
Game.DropItem("fullbottle");
this.Talk("Hey, thanx!");
actor.Talk("Glad you liked it.");
this.Talk("Here, have an apple. It's still fresh...");
actor.Talk("This is it!! Now I can finally solve the Wilhelm tell puzzle, where he's supposed to shoot an arrow throught my head but misses...");
Game.TakeItem("apple");
Game.Interactive=true;
}

The Game.Interactive=false is just so you can't go somewhere or do other things while they're talking. The "this.Talk" means that whoever this script's attached to talks.

Hope this helps..

(edit: I wrote actor.DropItem two times here... changed it to Game.Drop... (I use actor.TakeItem in  my game myself... both works, but Game.TakeItem and Game.DropItem, and so on, is standard)

62
Technical forum / A few questions
« on: October 12, 2004, 09:09:35 PM »
OK. First of all.
I have some graphical effects, invisibility and such,
that I use a few times in my game.
But what I'm thinking of is, if there is a way for the code to
recognize if the player has the hardware acceleration activated or not,
and then I give an alternate graphical solution if it's not enabled.
This would be good for greatness on both modes.
Ok, I know, in some cases it would be almost twice the size of work,
and maybe you'll abandon the non-accelerated mode sometime in the near future, but it would be kind of nice.

Second of all. Is there a way to have both a 'on "LeftClick"' and a "while(true)" in the same script?? I'm attaching scripts, and it works great, but I have so many. I mean, I have a lot of objects where you can leftclick, and at the same time it has to see if a certain variable is something, and then it changes sprite or becomes invisible etc. It's not that I can't handle all the scripts, It's just that it seems so unnecessary to have to scripts for alot of objects.
Blablabla... AND: does two scripts of 2 kb take up more memory (ram or whatever) than one 4 kb script? How many scripts can you have running at the same time? Last I checked I had 60 of them.

Third of all. I had this bmp picture. Then I changed it to a jpg with  compression 6 in photoshop (for the people who knows). Then I recompiled the game. And guess what?... The game files is now over 400 (count em') kb smaller. The pic is about 37 kb in jpg. So sometimes it might be great to choose another file format. Other pictures made the game smaller in bmp format. So there doesn't seem to be a universal great one, but they're better at different things. Less detailed pics with fewer colors were smaller in bmp. And jpg is better at detailed backgrounds and stuff. So it might be a good idea to check out ones graphix as "any kb saved is a good kb".

63
Technical forum / Entity containers scalable??
« on: October 01, 2004, 06:15:24 PM »
I tried to make an entity (entiry container) inside a window to be resized or Scaled.
It just couldn't work.

In the entity's script I added
 this.Scalable=true;
this.Scale=50;

It still didn't work.
I made sure I had SCALABLE=TRUE in the entyty's entity file.
It still didn't work.

What am I doing wrong?
Ordinary entities inside the scenes can be scaled.

This would be really cool cause I'm using pictures during conversations and stuff.
I'm also using it to display what item you're currently using.

So as you can see this would be really neat.

So I'm just asking: can this be done?

64
Technical forum / More inventories, more sleepless nights for Mnemonic
« on: October 01, 2004, 01:19:42 AM »
OK. Some easy questions here (have we heard that one before?)

I just saw that the inventory.def is defined in the default.game file.
Is it possible to change this during run-time.

So that when I open one of my inventories (!) it will be defined as for example cool_stuff.def
and then one inventory can be a scroll bar and another a 5 * 5 squared (is that 5² ??) window.

I'm just asking cause it would be really nice!

Your previous answer, did that mean you can only show one inventory at a time. If that's so it's ok.
However, you (meaning I!) should be able to configure the inventory during playtime.
The question is, can it be done (in an easy way without way to much scripting and stuff)


65
Technical forum / It wooorks!!
« on: September 30, 2004, 03:48:31 PM »
It f***ing works!! ;D

You're the man! ::rock

Now I can have two inventories. Or... *ten*
You're the man! It f***ing works! ( am I repeating myself here? Did I forget to tell you that you're the man?)

Anyways... I suspected you have to do something with the variable, I suspected it all along

Now there's nothing you can't do... the best games lie in the future...
Anything can happen now... it's all a straight line from now on... through the labyrith of time...

66
Technical forum / Re: Some easy questions (newbie)
« on: September 30, 2004, 12:23:41 AM »
I'm sorry, I can't make it work.

To try it out some more I inserted these lines in the street/scene_init.script in the WME demo:

//load our main actor
actor = Game.LoadActor("actors\new_actor\new_actor.actor");
Game.MainObject = actor;

global new_actor;
Game.InventoryObject = new_actor;

This is a new actor I added, the "add actor... generic".

Anyways, it didn't work there either. Even though I even loaded the actor whose inv I wanted to see.

Do I have to do something with the global variable? Or is it all wrong?
I could still see the book and the money (DONT show me the money...)

Here is some code from my own game:
   while(scr==2)
   {
//load our main actor
actor = Game.LoadActor("actors\spells\spells.actor");
Game.MainObject = actor;
Game.InventoryObject = spells;
this.Visible=true;
Game.InventoryVisible=true;
   Sleep(20);
   }
Sleep(20);
}
//It's in a window's script where I loop that if a certain value is so and so it will show the window with the inventory on top it.
//It works splendid. It's just that I can't change that inventory to another persons/objects so that the stuff I have there is hidden and
//replaced by some other stuff.

(I really feel like some looser here when I can't even make one easy piecey line of code to work.
And to trouble you guys so much...
Maybe I haven't learned the syntax and things like that..
This is my first "real" programming language after all.)

67
Technical forum / Re: Some easy questions (newbie)
« on: September 29, 2004, 07:02:40 PM »
But that's what I mean... really.

BTW me forgot to tell ya one little tiny detail... my game is perst-person, which means u don't have care about the dumb actors.

So it doesn't matter if he's called spells or equipment or some other fancy stuff..

I made an actor called spells. So now I want to make his inventory appear as the regular Game.Inventory.
In some code I'll probaby just change between the different actors and make their things appear... *magically*

I just thought that inventories could be held by entities and items and stuff... The documentation almost said so,
but I'll guess this will do too.

So a little help here... please...

68
Technical forum / Multiple inventory galore
« on: September 29, 2004, 03:56:31 PM »
Quote: "Well, the problem is, currently WME supports only one inventory. If you need to display both the inventory AND the spells..."

From the WME documentation: (inside a game/working with the inventory)
quote: "Taking, dropping, destroying and querying items

You generally reference inventory items by their name. If you want to take an item into inventory, use the Game.TakeItem(), for example:

Game.TakeItem("book");
 

This will add the "book" item into inventory. If you are using multiple inventories, you'll need to call the TakeItem method on the actual object you want to take the item, for example OldGuy.TakeItem("book");

Removing item from inventory works in a similar fashion. Only use the Game.DropItem() method instead:

Game.DropItem("book");
 

This command will remove the item from inventory. Although the inventory item is no longer displayed in the inventory, it may be reused later. If you want to remove the item from the game permanently, use the Game.DeleteItem() method.

You can query an item using the Game.GetItem() method. It will return an item object which can be used to set item's attributes.

To query if a certain object is taken by some game object, use the Game.IsItemTaken() method. It will search the inventories of all game objects to see if one of them has the item taken. On the other hand, the game objects provide a HasItem() method, which you can use to ask one concrete object if he has the item.

Example:

// has anyone the book?
var IsBookTaken = Game.IsItemTaken("book");

// has OldGuy the book?
var OldGuyHasBook = OldGuy.HasItem("book");

(...)

Multiple inventories

In WME each object (game, actors, entities) can have its own private inventory. It's mainly useful for games with multiple main characters. In that case you can control whose inventory is currently displayed on screen. This is done by setting the Game.InventoryObject attribute. By default this attribute is set to the Game object, which is just fine for single-inventory games. If you have multiple switching actors you'll want to set this attribute to the current actor."

Well what do you say now? (sorry for being sarcastic)

Maybe you're right in the documention, maybe you're right here when you speak,
but I wanna know which of your statements is true, if it's not too much to ask for. (sorry for being so demanding)

As for the code...

I've made one window that displays the inventory on top if it only if a certain variable is greater than 3 . I'll make that later, and remove the loops too, you don't have to worry too much about them, it's the "spells.InventoryVisible=true;" that doesn't work.
When I use the code for the regular inventory it works just fine.

the "LeftClick"... part is inside an objects script, so that when you "Look" at it the spells entity will take the song spell.
I've figured out a way around that, by using more variables. Like when the spelltake variable is 1, the spells entity will take spell 1 and set it to 0. When it's 2, it will take spell 2 and set it to 0, and so on. U can't do this from another entitys script?
Anyway, it should work.

But the problem is, that I can't make the spells inventory visible.

I thought this engine really rocked when I read that about multiple inventories. And now I can't...
 :'(

69
Technical forum / Inventory stuff (simple question)
« on: September 29, 2004, 12:26:53 AM »
Sorry if I'm doing all my talking in the same thread
 ::hijack

but...
first of all: all my previous problems soved!!  ::rock Even the ones I didn't think I could solve, I fixed them all...

But now my new problem. Ok, I have a (new!) window where I want to display this second inventory. But I can't seem to "load" the inventory of the spells entity. OK, here's the code...

global spells; //?? should I? It might be something about globals but I'm not sure.
//The globals... the globals... the globals is coming to get me... ahhhh...

while(true)
{
while(spells<3)
{
this.Visible = false;
spells.InventoryVisible = false;
Sleep(30);
}
while(spells>3)
{
spells.InventoryVisible = true;
this.Visible = true;
Sleep(30);
}
Sleep(30);
}

I tried Game.spells.InventoryVisible and some other things too... I just couldn't make it work.
And then I want the spells.entity to take an "object" but I'm not sure how to do this really,
from outside it's script (another objects script).
I guess it's a beginners thing.  ;D


on "LeftClick"
{ if(verb=="look")
{
active=1;
spells.TakeItem("songspell");
text="You find a secret spell there... the song spell.";
}
}
That's it.

OK. Have fun. And always bring the good news first...

70
Technical forum / Supersize me.exe
« on: September 27, 2004, 04:49:37 PM »
(to Mnemonic)
Thanx I'll try it.

Now about the  ::thumbup ::rockmusical stuff I "discussed" earlier...
I thought about distiributing some of the music separately (for the "downloaded this 10GB file over a 1 kb per year connection and the download just stopped for the fitieth time in a row"-people) and then I found the information about the packages and that sound really great...

The only problem is.. I distributed the music as a separete file/folder and then compiled the pack's. However...
When I play the exe the music is there... but if I remove the music.dcb the music is still there...
It's stored inside the game.exe or data.dcp somehow...
I wanted it to be handled separately... and then to be removed, distributed and handled like the separate dir/datapack it is.
The music data pack is the same size as the music files btw...
Can't I do this?  :'(

Sorry for troubling you people so much.
And I really like WME so far (good work Mnemonic ::thumbup ::rock)

Ok. That's about it.
see ya!

71
Technical forum / Answered that. Now something new...
« on: September 27, 2004, 11:14:23 AM »
It works. IT WOOOOOORKS!!! ::rock

The problem was that I had still some code left from the wme demo.
I had to remove some lines from the game_daemon script
// display the inventory window
//  if(Game.Interactive && Game.MouseY < 45 && !Game.ResponsesVisible && !WinMenu.Visible)
//Game.InventoryVisible = true;
//  else if(Game.MouseY > 100 || Game.ResponsesVisible || !Game.Interactive) //Game.InventoryVisible = false;
Because they made the inventory window always being closed unless (something???)
Then I just added some code to my windows script so that the inv is only visible when the window is.
I think it wworks with while(true)... too but I havn't tried it.

global scr;

while(scr<10)
{
while(scr<3)
{

this.Visible = false;
Game.InventoryVisible = false;
Sleep(30);
}

while(scr>3)
{
Game.InventoryVisible = true;
this.Visible = true;
Sleep(30);
}
Sleep(30);
}

//Then I just attach I script to a button/entity where I click to make the window and inventory become appear and disappear
//Cool huh?
global scr;

on "leftClick"
 {
if(scr==0)
{ scr=5; }
else
{ scr=0; }
}
//Oh, and you might want to put a line in game.script so that the scr variable is 0 at the beginning
global scr=0;


Now another question...
How can I make a window display text?
Like, I have this window, and when (in an object's script file) i say something like
on "LeftClick"
{ if(verb=="look")
{ actor/this/whatever.Talk("Hey! It's a script line!"); }
}
only I want it said in a window instead of spoken an entity or something.
Should I make an invisible entity inside the window?
Or is there some way to make the text be displayed directly inside a box or whatever?
 ::rock

That's all for now. See ya!

72
Technical forum / More questions. inventory window and musics
« on: September 26, 2004, 03:35:39 PM »

 
Soooo...
I have made a window that appears and disappears when you do something (click somewhere).
But now I want the inventory to be shown in this window. I'm not sure how to do this. Help me out PLEASE!!!  :'(

And now another question.
ogg is all great and all, but what if I wanted 15-20 songs in a game + sounds + graphics + the game.exe ...
then this would be something like 40 or 50 MB at least. But I want my games to be downloadable (by people like myself with only a 56k connection). I know myself that I don't want do download really big files unless it's something really really good (and how do I know it's really really good if I don't download it? I wont! So then I will not play or download this craptastic masterpice almost noone cares about cos they don't play it or download it.
I guess in the future we will have 10 GB per nanosecond connection via satellite directly through our head implants and everything.. but right now it cost a fortune and take forever to download really big games and stuff.
So then it's the question of midi and mod and all that but isn't there a way to make a midi bank feature in this othervise really great engine? So then it loads regular midi files and adds the soundfont or wav/ogg-files of your choice for different instruments.
I'm sure this wont be a problem in the far future, but right now it is.
So U have any ideas how to overcome this obstacle?
Make a game without music? Craaaaaaaaaaap!! :'(

Ok. That's all. Have fun::rock. And remember people what they say: They say do it again and you're history!

73
Technical forum / Re: Some easy questions (newbie)
« on: September 25, 2004, 05:10:31 PM »
 ;D Than :Dks...

It now works to rotate an object..
Though it seems you have to specify it's rotation in advance
//could be zero or anything, but somehow you have to do it
this.Rotate = 0;

var tree = 1;

//somehow this loop here seems to work inside the object script... Cool...
while(tree < 2)
{ tree = tree + 1;
Sleep (20);
if (tree==2)
{
//this tells the object to only rotate 0.05 degrees at a time. It's more smooth that way.
this.Rotate = this.Rotate + 0.05;
this.Rotate = this.Rotate + 0.05;
this.Rotate = this.Rotate + 0.05;
this.Rotate = this.Rotate + 0.05;
this.Rotate = this.Rotate + 0.05;
this.Rotate = this.Rotate + 0.05;
this.Rotate = this.Rotate + 0.05;
tree = 0;
Sleep (10);
}
}

//Now you can all use this to make objects rotate... though you probably already knew this
//It can make some great graphix effects too - used wisely (like water effects)
//(btw, I had to "hack" my scene's .scene-file in notepad to make the object rotable and add ROTABLE=TRUE...
//I couldn't find that option in SceneEdit - only scalable, colorable and interactive.

Well that's all for now  >:(

See ya!  :D

74
Technical forum / Some easy questions (newbie)
« on: September 25, 2004, 01:43:34 PM »
Hi everybody ;)

I'm new at this (programming and everything...)  :o
so I hope you could help me out and getting this to work.

I'm trying to learn how to make a "if var a = 1 then do this"
but i'm not sure if i should put it in the object's script..
and i'm not quite sure "if(a=1)" is a real event, like "LeftClick".
I think that maybe it will only be activated once and then not work anymore.
Should I use "for" or "while" or something instead.
Sorry if this is too talky...
and i'm trying to make some things happen every x seconds. Should I use the date object for that?
or does the "Sleep (100)" work?

I'm new at this so I haven't quite figured out the syntax and all yet...
And then I'm trying to make an object rotate 1 degree at a time = this.Rotate = this.Rotate + 1,
but that doesn't work. Ordinary rotation work.. like "this.Rotate = 180;"

some code:

var tree;
var rotate;
/*
on "LeftClick"
{
this.Rotate = this.Rotate + tree;
}
*/

while (tree<10)
{ tree = tree + 1;
Sleep (200);
}

if (tree=10)
{ rotate = this.Rotate + 1;
this.Rotate = rotate;
tree = 1;
Sleep (100);
}

Thanx and everything

Pages: 1 ... 3 4 [5]

Page created in 0.049 seconds with 23 queries.