Please login or register.

Login with username, password and session length
Advanced search  

News:

Latest WME version: WME 1.9.1 (January 1st, 2010) - download

Pages: 1 2 [All]

Author Topic: ok maybe i am dumb... (inventory question)  (Read 11462 times)

0 Members and 1 Guest are viewing this topic.

fabiobasile

  • Occasional poster
  • **
  • Karma: 0
  • Offline Offline
  • Gender: Male
  • Posts: 74
    • View Profile
    • my brand new website!!
ok maybe i am dumb... (inventory question)
« on: March 20, 2006, 09:56:50 AM »

i am a newbie, i never was into programming until i realized it would have been an interesting way for me to actually breathe some life in what i do primarily which is 3D animation. My dream and my passion has always been to make an adventure game Fallout style.

I have been writing the story for my game, my wife loves it so i decided it was good enough for me to start translating it into rendered images and start thinking of how to put everything together into a game... until i bumped into WME. Suddenly i had the feeling that scripting wouldn't have been so hard since at least some of the hassle is taken care of by the excellent GUI, still i have to come to terms with the truth: i am not a programmer, hence i still have a lot to learn, so whoever feels like helping me out without being too judgemetal is welcome to speak up.

If any of you guys ever played either Fallout 1 or 2, it is my intention to create something based on the same principle, the character is a survivor from a nuclear holocaust, he must wander the wasteland scavenging for food and watching his own back from all sorts of low-lives. The map is isometric which already works perfectly, the walls and paths are set and ready and all the graphics is ready too. The only problem is the inventory. I had a look at the documentation and the problem is that althou it gives out a wealth of information and sample codes, i felt lost because i had no idea which files exactly i was supposed to insert the code into.

What i would like to know is some basic steps to set up a very simple inventory, nothing fancy, all i want is:

- to scatter objects on the map,

- then clicking on them and seeing my character walking up to them,

- triggering the animation that makes him look like he is picking up something

- and then see the object disappearing from the map and appearing in the inventory


Of course all those objects will have different properties and it would be cool to create something i could use as money...but for now i would be just as happy seeing my character picking up stuff and store it in the inventory and then being able to drop them too...

Thanks in advance,


                    Fabio
Logged
What would i do with a million dollar? I'd give it to what's left of Black Isle/Interplay and tell them to finish the damn game!!!

Mnemonic

  • WME developer
  • Administrator
  • Addicted to WME forum
  • *
  • Karma: 41
  • Offline Offline
  • Gender: Male
  • Posts: 5683
    • View Profile
    • Dead:Code Site
Re: ok maybe i am dumb... (inventory question)
« Reply #1 on: March 20, 2006, 10:53:48 AM »

Woohoo, a Fallout-like adventure. Now that's something I'd love to play :)

To your question.. In WME you define a set of inventory items in the items.items file. The structure of that file should be easy to understand and it's described in the documentation. These definitions describe items to be displayed in the inventory window, NOT in the scenes. In scenes, the items are represented by entities, just like any other scene objects (I suppose you're already familiar with entities..?).
So, if you want to place some intem into scene, simply create a scene entity. To make the actor walk to the item and pick it up, edit the entity's script and write something like:

Code: [Select]
on "LeftClick"
{
  // walk to the item
  actor.GoToObject(this);

  // play some fancy animation
  actor.PlayAnim("some_taking_item_animation.sprite");

  // and actually take the item
  Game.TakeItem(this.Item);

  // after you call this, the entity will automatically disappear from the scene
  // and land in actor's inventory
}

Now, to make this really work, you need to link the scene entity with the actual item definition. To do so, in SceneEdit, in entity's properties fill the "Item" field and fill-in the name of the item you want to link to this entity.

And that's it.
« Last Edit: March 20, 2006, 12:05:46 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

fabiobasile

  • Occasional poster
  • **
  • Karma: 0
  • Offline Offline
  • Gender: Male
  • Posts: 74
    • View Profile
    • my brand new website!!
Re: ok maybe i am dumb... (inventory question)
« Reply #2 on: March 20, 2006, 07:55:27 PM »

sounds like a good start,  :D I hope of being able to post some screenshots soon! Well actually i do have an initial shot but for now i prefer to wait till at least the inventory works... wish me luck! lol  ::thumbup
Logged
What would i do with a million dollar? I'd give it to what's left of Black Isle/Interplay and tell them to finish the damn game!!!

fabiobasile

  • Occasional poster
  • **
  • Karma: 0
  • Offline Offline
  • Gender: Male
  • Posts: 74
    • View Profile
    • my brand new website!!
Re: ok maybe i am dumb... (inventory question)
« Reply #3 on: March 20, 2006, 08:23:31 PM »

ok here is what i did: the item is called "button" and i have created a "button.script" for it with the following code:

-----------------------------------------------------------------------------
on "LeftClick"
{
  // walk to the item
  actor.GoToObject(this);

  // and actually take the item
  Game.TakeItem(this.Item);

  // after you call this, the entity will automatically disappear from the scene
  // and land in actor's inventory
}

------------------------------------------------------------------------------
when i run the game nothing happens, the button simply doesn't work, it can't be picked up and it can't be looked at either. Then when i check the syntax in the project manager it says:

"Line 4: Method is called for 'actor' which is not defined"
Logged
What would i do with a million dollar? I'd give it to what's left of Black Isle/Interplay and tell them to finish the damn game!!!

Mnemonic

  • WME developer
  • Administrator
  • Addicted to WME forum
  • *
  • Karma: 41
  • Offline Offline
  • Gender: Male
  • Posts: 5683
    • View Profile
    • Dead:Code Site
Re: ok maybe i am dumb... (inventory question)
« Reply #4 on: March 20, 2006, 09:24:31 PM »

Every script should start with this line:

#include "scripts\base.inc"

It defines some global stuff, such as the 'actor' variable, which references your main hero.

Also note that the script I posted above is intended to be attached to a scene entity, representing the item in scene (I'm confused about the name 'button' here..). When you're adding a new script to a scene entity, SceneEdit should offer you a couple of template scripts. Use the "scene object" template, because it already contains a pre-generated skeleton code.
Logged
Yes, I do have a twitter account
Please don't send me technical questions in private messages, use the forum. ::wave

fabiobasile

  • Occasional poster
  • **
  • Karma: 0
  • Offline Offline
  • Gender: Male
  • Posts: 74
    • View Profile
    • my brand new website!!
Re: ok maybe i am dumb... (inventory question)
« Reply #5 on: March 21, 2006, 01:54:35 AM »

"button" is the name of the scene entity that i created in the scene edit it is composed by two images of a button being pressed and released and a sprite which i assembled together from those two images, button.script is a script which is in /items and which i have attached to the button entity from the scene editor...
Logged
What would i do with a million dollar? I'd give it to what's left of Black Isle/Interplay and tell them to finish the damn game!!!

fabiobasile

  • Occasional poster
  • **
  • Karma: 0
  • Offline Offline
  • Gender: Male
  • Posts: 74
    • View Profile
    • my brand new website!!
Re: ok maybe i am dumb... (inventory question)
« Reply #6 on: March 21, 2006, 02:19:42 AM »

Ok, after tampering with the item's script for a bit i came up with the following code which allowed my character to walk up to the item after i clicked on the item and after that the item disappears and reappears in the inventory:

-------------------------------------------------------------
#include "scripts\base.inc"


////////////////////////////////////////////////////////////////////////////////
on "LookAt"
{
  actor.GoToObject(this);
  actor.Talk("Blah");
}

////////////////////////////////////////////////////////////////////////////////
on "Talk"
{
  actor.GoToObject(this);
  actor.Talk("Blah");
}


////////////////////////////////////////////////////////////////////////////////
on "LeftClick"
{
  // walk to the item
  actor.GoToObject(this);

  // and actually take the item
  Game.TakeItem("button");

  // after you call this, the entity will automatically disappear from the scene
  // and land in actor's inventory
}

////////////////////////////////////////////////////////////////////////////////

---------------------------------------------------------------------------

now, is there a way i can drop the item anywhere on the floor or at least at some specific location?
Logged
What would i do with a million dollar? I'd give it to what's left of Black Isle/Interplay and tell them to finish the damn game!!!

fabiobasile

  • Occasional poster
  • **
  • Karma: 0
  • Offline Offline
  • Gender: Male
  • Posts: 74
    • View Profile
    • my brand new website!!
screenshots!
« Reply #7 on: March 21, 2006, 09:57:47 AM »

this is the first shot with background, shadow layer, lighting layer and flashing lights (well you can't see them but i assure you they DO flash!! lol



this is the last shot with background rendered with volumetric lights, overlay blurred roof layer and all the layers above mentioned



i know there is not much to play around coz i just started it, but what do you guys think of the overall look of the picture? I'm currently working on all the rest of the props, computers, trash, a few corpses, blood and some more wreackage which i will post hopefully soon!!
Logged
What would i do with a million dollar? I'd give it to what's left of Black Isle/Interplay and tell them to finish the damn game!!!

fabiobasile

  • Occasional poster
  • **
  • Karma: 0
  • Offline Offline
  • Gender: Male
  • Posts: 74
    • View Profile
    • my brand new website!!
more shots...
« Reply #8 on: March 21, 2006, 06:26:28 PM »

a rusty overlay roof this time...

Logged
What would i do with a million dollar? I'd give it to what's left of Black Isle/Interplay and tell them to finish the damn game!!!

Mnemonic

  • WME developer
  • Administrator
  • Addicted to WME forum
  • *
  • Karma: 41
  • Offline Offline
  • Gender: Male
  • Posts: 5683
    • View Profile
    • Dead:Code Site
Re: ok maybe i am dumb... (inventory question)
« Reply #9 on: March 21, 2006, 07:49:13 PM »

Nice, nice, looks very promising. So you're aiming for the top-down view, interesting. I don't think anyone did that in WME before.

As for dropping items, calling:

Game.DropItem("some_item_name");

will remove the item from inventory and it will re-enable the scene entity linked to that item. You can then position the entity by setting its X and Y properties.
Logged
Yes, I do have a twitter account
Please don't send me technical questions in private messages, use the forum. ::wave

fabiobasile

  • Occasional poster
  • **
  • Karma: 0
  • Offline Offline
  • Gender: Male
  • Posts: 74
    • View Profile
    • my brand new website!!
Re: ok maybe i am dumb... (inventory question)
« Reply #10 on: March 21, 2006, 07:59:47 PM »

thanks   :)

I thought it might be easier to manage from the top because in that way i can create the illusion of depth without relying so much on masks and transparencies for the walls and also i can add more detail like wires and electronics on top over the player without cluttering the scene...

So, basically all i have to do is to insert Game.DropItem('the item i wanna drop form the inventory') in the script of the item? Or into game.script?  Sorry but when i read "calling:" i am never sure what that means exactly yet...  :P


Thanks again for the feedback btw!  ::rock
Logged
What would i do with a million dollar? I'd give it to what's left of Black Isle/Interplay and tell them to finish the damn game!!!

fabiobasile

  • Occasional poster
  • **
  • Karma: 0
  • Offline Offline
  • Gender: Male
  • Posts: 74
    • View Profile
    • my brand new website!!
more shots...with props
« Reply #11 on: March 21, 2006, 09:54:37 PM »



some computers, a soda can on the floor, two chairs... more to come :)

I have decided to test myself by adding a trash bin and get the character to pick up the can and throw it in the bin... urgh, more complicated! lol This programming thing is getting fun thou... :P
Logged
What would i do with a million dollar? I'd give it to what's left of Black Isle/Interplay and tell them to finish the damn game!!!

odnorf

  • w00t?
  • Global Moderator
  • Addicted to WME forum
  • *
  • Karma: 7
  • Offline Offline
  • Gender: Male
  • Posts: 1456
  • Lamp dog!
    • View Profile
Re: ok maybe i am dumb... (inventory question)
« Reply #12 on: March 22, 2006, 07:58:58 AM »

Looks very interesting.
I have one question. Are you using many small scenes or a big one which scrolls as the character moves. If it's the second how big is it? Doesn't it slow down the rendering a lot?
Logged
fl*p

fabiobasile

  • Occasional poster
  • **
  • Karma: 0
  • Offline Offline
  • Gender: Male
  • Posts: 74
    • View Profile
    • my brand new website!!
Re: ok maybe i am dumb... (inventory question)
« Reply #13 on: March 22, 2006, 08:54:28 AM »

well the background is one big .jpg 2000x2000 which is the total map size, fortunately Maya can optimize the jpg down to a reasonable size at render stage, then i made a transparent png by blurring and desaturating a copy of the original map for the shadow map which creates the illusion of having darker and lighter areas, then the third layer consists of another transparent png which is the "roof", the rusty metal frame over everything. The character's animations are made of ten frames per animation 200x200 .bmp, "stand" "walk" "talk" "take" but i am planning to use png since the pictures will be smaller and i won't have to juggle between 255,0,255 and 255,0,246, which is a pain coz Maya doesn't allow me for some reason to use full 255 and WME has the default transparent colour set to 255, good thing i had a little utility called "colorCop" at hand, everything else is png transparent images which i used for the sprites of the scene items and the flashing lights of the computer monitors and the neon lights under the roof frame.

The scene plays fine for now on an AMD Opteron 1400Mhz 4Gb DDR ECC on an Asus SK8N server board and an nVidia Quadro FX500, but i have tested it on a friend's computer, an AMD Athlon 1400Mhz on an Asus 7ZXR 512 Mb with a GeForce 4 and it plays fine too, i take it it will improve even further as i will implement more .png instead of bmp.
Logged
What would i do with a million dollar? I'd give it to what's left of Black Isle/Interplay and tell them to finish the damn game!!!

Mnemonic

  • WME developer
  • Administrator
  • Addicted to WME forum
  • *
  • Karma: 41
  • Offline Offline
  • Gender: Male
  • Posts: 5683
    • View Profile
    • Dead:Code Site
Re: ok maybe i am dumb... (inventory question)
« Reply #14 on: March 22, 2006, 10:03:03 AM »

Are you planning to render the character with shadow? IMO the screenshots are screaming for it :)
Logged
Yes, I do have a twitter account
Please don't send me technical questions in private messages, use the forum. ::wave

odnorf

  • w00t?
  • Global Moderator
  • Addicted to WME forum
  • *
  • Karma: 7
  • Offline Offline
  • Gender: Male
  • Posts: 1456
  • Lamp dog!
    • View Profile
Re: ok maybe i am dumb... (inventory question)
« Reply #15 on: March 22, 2006, 10:08:58 AM »

......but i am planning to use png since the pictures will be smaller and i won't have to juggle between 255,0,255 and 255,0,246, which is a pain coz Maya doesn't allow me for some reason to use full 255 and WME has the default transparent colour set to 255.........

You can change the default trasperent color to any value you want. But still png with alpha channel is a wise solution because this way the character will look better (not jerky edges).
Logged
fl*p

fabiobasile

  • Occasional poster
  • **
  • Karma: 0
  • Offline Offline
  • Gender: Male
  • Posts: 74
    • View Profile
    • my brand new website!!
Re: ok maybe i am dumb... (inventory question)
« Reply #16 on: March 22, 2006, 06:13:49 PM »

that would be cool and not too difficult to do either, i guess i gotta figure out a way to re-process the animation images of the character so that i can include a shadow in each of them, making the background transparent and saving them all as png... it would be cool to have at hand a utility that can search automatically for text in all the *.sprite files under /actor/ and changes the extensions from .bmp to .png!
Logged
What would i do with a million dollar? I'd give it to what's left of Black Isle/Interplay and tell them to finish the damn game!!!

Mnemonic

  • WME developer
  • Administrator
  • Addicted to WME forum
  • *
  • Karma: 41
  • Offline Offline
  • Gender: Male
  • Posts: 5683
    • View Profile
    • Dead:Code Site
Re: ok maybe i am dumb... (inventory question)
« Reply #17 on: March 22, 2006, 06:27:35 PM »

it would be cool to have at hand a utility that can search automatically for text in all the *.sprite files under /actor/ and changes the extensions from .bmp to .png!
UltraEdit has the "replace in files" feature, to name one.
Logged
Yes, I do have a twitter account
Please don't send me technical questions in private messages, use the forum. ::wave

odnorf

  • w00t?
  • Global Moderator
  • Addicted to WME forum
  • *
  • Karma: 7
  • Offline Offline
  • Gender: Male
  • Posts: 1456
  • Lamp dog!
    • View Profile
Re: ok maybe i am dumb... (inventory question)
« Reply #18 on: March 22, 2006, 08:06:11 PM »

Pspad http://www.pspad.com/en/index.html also has this feature (and it's free)
Logged
fl*p

fabiobasile

  • Occasional poster
  • **
  • Karma: 0
  • Offline Offline
  • Gender: Male
  • Posts: 74
    • View Profile
    • my brand new website!!
Re: ok maybe i am dumb... (inventory question)
« Reply #19 on: March 23, 2006, 04:26:41 AM »

Thanks! I went for PsPad and it works GREAT!

Also i have converted all the animation pics into png and added the character's shadow and here is the result:



Well i guess you have to make an effort to actually see the shadow, but when i started the batch procedure in Photoshop i realized it too late... oh well i'll fix it next.
Logged
What would i do with a million dollar? I'd give it to what's left of Black Isle/Interplay and tell them to finish the damn game!!!

fabiobasile

  • Occasional poster
  • **
  • Karma: 0
  • Offline Offline
  • Gender: Male
  • Posts: 74
    • View Profile
    • my brand new website!!
fixed!
« Reply #20 on: March 23, 2006, 09:37:31 AM »

ok shadows fixed and a few more gizmos added... comments welcome! :)

Logged
What would i do with a million dollar? I'd give it to what's left of Black Isle/Interplay and tell them to finish the damn game!!!

Mnemonic

  • WME developer
  • Administrator
  • Addicted to WME forum
  • *
  • Karma: 41
  • Offline Offline
  • Gender: Male
  • Posts: 5683
    • View Profile
    • Dead:Code Site
Re: ok maybe i am dumb... (inventory question)
« Reply #21 on: March 24, 2006, 02:07:19 PM »

Yes, much better :)
Logged
Yes, I do have a twitter account
Please don't send me technical questions in private messages, use the forum. ::wave

fabiobasile

  • Occasional poster
  • **
  • Karma: 0
  • Offline Offline
  • Gender: Male
  • Posts: 74
    • View Profile
    • my brand new website!!
soundtrack...
« Reply #22 on: March 24, 2006, 04:53:51 PM »

i was actually kind of thinking of a possible soundtrack style, maybe "Van Der Graaf Generator" would be cool because of the particular time frame between 1974 and 78 and the style of the music very instrumental that transport you very much in another time and space... Anyone ever heard of this UK band?

http://www.vandergraafgenerator.co.uk/
Logged
What would i do with a million dollar? I'd give it to what's left of Black Isle/Interplay and tell them to finish the damn game!!!
Pages: 1 2 [All]
 

Page created in 0.046 seconds with 20 queries.