Author Topic: Inventory Blues  (Read 3152 times)

0 Members and 1 Guest are viewing this topic.

Offline jtyler125

Inventory Blues
« on: March 07, 2007, 05:11:46 PM »
Ok can someone put up a sample simple script showing how to make an object in my inventory appear on the screen after I say put key on table for example.  And then it comes out of my inventory...I need this to finish my game.


Life is getting better all the time.
Groundhog Day Competition New Year's Competition

Offline troflip

Inventory Blues
« Reply #1 on: March 07, 2007, 05:46:03 PM »
I'm just winging this, since I'm at work now and can't test it... but given your inventory key is identified with INV_KEY,  I think it might look like:

In your room, define a key Prop:
Code: [Select]
(instance keyOnTable of Prop
    (properties
        x 100
        y 130
        view 100
    )
)

In your room's init method:
Code: [Select]
// If the inventory key is owned by this room, make the "key on table" visual show up:
(var invItem)
(= invItem (send gInv:at(INV_KEY)))
(if (send invItem:ownedBy(gRoomNumber))
    (keyOnTable:init())
)

Then in the RoomScript's handleEVent method:
Code: [Select]
(if (Said('put/key/table'))
    (if (send gEgo:has(INV_KEY))
        (send gEgo:put(INV_KEY gRoomNumber)) // Give inventory key from the ego to the room
        (keyOnTable:init())                  // Make the "key on table" visual show up
    )
    (else
        Print("You don't have the key")
    )
)
Check out my website: http://icefallgames.com
Groundhog Day Competition

Offline jtyler125

Inventory Blues
« Reply #2 on: March 07, 2007, 09:02:43 PM »
Thanks Tro,

I actually banged out a yucky way to make it work using what was up there already and it seems to work good enough for now.

Now I need to make a deathhandler come up when I try to leave the room unless I have a certain amount of points any takers on what that script might look like:

Thanks,
JT
Life is getting better all the time.
Groundhog Day Competition New Year's Competition


SMF 2.0.19 | SMF © 2021, Simple Machines
Simple Audio Video Embedder

Page created in 0.03 seconds with 22 queries.