playMaker

Author Topic: Inventory : take/ put gameobject [SOLVED]  (Read 1577 times)

TheRagMan

  • Playmaker Newbie
  • *
  • Posts: 10
    • View Profile
Inventory : take/ put gameobject [SOLVED]
« on: September 06, 2012, 07:06:19 AM »
i was trying to set up a game action where i can take and put object around(not drag)

the synth logic was this:
if push E and trigger obj tag "object" store in var and destroy obj
if push F create obj in var

it doesnt work eheheh... i believe that the VAR get corrupted after i destroy the original object cause it works without the destroyself..i can clone.
Can anyone explain me the logic behind this? what's the problem?a gameobject var doesnt store all of an object? i cant believe that's just a link.. :/ Thx in advance
« Last Edit: September 19, 2012, 02:59:59 AM by TheRagMan »

jeanfabre

  • Administrator
  • Hero Member
  • *****
  • Posts: 12342
  • Official Playmaker Support
    • View Profile
Re: take/ put gameobject
« Reply #1 on: September 07, 2012, 02:20:33 AM »
Hi,

 if you delete a gameObject, any reference to it will become null. This is the expected behavior

Could you explain a bit more in details what you want to achieve, then we'll be able to assist better.

bye,

 Jean

TheRagMan

  • Playmaker Newbie
  • *
  • Posts: 10
    • View Profile
Re: take/ put gameobject
« Reply #2 on: September 07, 2012, 01:48:36 PM »
-Take an object from the floor
-Put the object on the floor :)

i just want an inventory, i was trying with  a G.object var as inventory slot and a simple cut & paste logic.

jeanfabre

  • Administrator
  • Hero Member
  • *****
  • Posts: 12342
  • Official Playmaker Support
    • View Profile
Re: take/ put gameobject
« Reply #3 on: September 10, 2012, 01:46:42 AM »
HI,

 ok, I think the problem is that your representation of the object should not be the actual reference in your system.

 you need to maintain a reference in your game, and when the user is picking an object, store this reference instead of the visual representaiton of it ( the gameObject lying on the floor).

 Then if you delete the object, no problem, it was just a visual representation of it.

 But as is it's difficult to give you more details, since I am not sure what kind of data you want to convey when picking an object or playing an object.

bye,

 Jean

TheRagMan

  • Playmaker Newbie
  • *
  • Posts: 10
    • View Profile
Re: take/ put gameobject
« Reply #4 on: September 10, 2012, 06:01:51 AM »
Oh...Ok... the difference between  reference and representation explain...a lot. 
I'm just using bootcamp as test field and trying to do some interactions with junk.
i'have no big plans just learning some basic standard dynamics.. as figure out how to take/leave an object from the floor.
 so... can u give me an url with some info? and maybe just tell me the right logic behind a clean simple inventory sys?
how can i store the reference of the obj? is it wrong the " store,destroy, create" logic?
thx in advance.

jeanfabre

  • Administrator
  • Hero Member
  • *****
  • Posts: 12342
  • Official Playmaker Support
    • View Profile
Re: take/ put gameobject
« Reply #5 on: September 11, 2012, 02:30:07 AM »
HI,

 I am in the middle of travelling, can you bump this thread next week, and I will reply with a concrete example.

bye,

 Jean

TheRagMan

  • Playmaker Newbie
  • *
  • Posts: 10
    • View Profile
Re: take/ put gameobject
« Reply #6 on: September 17, 2012, 06:30:09 AM »
bumped as requested. thx again.

jeanfabre

  • Administrator
  • Hero Member
  • *****
  • Posts: 12342
  • Official Playmaker Support
    • View Profile
Re: take/ put gameobject
« Reply #7 on: September 18, 2012, 04:34:11 AM »
Hi,

 Here we go, thanks for bumping this.

 I updated ArrayMaker package and included a new inventory scene.

 basically, study this, and come back to me if you have questions, this is using quite advanced technics and tricks, so don't worry if you don't fully grasp everything on the first run, come back to me if you need clarifications on the features and how they work,

https://hutonggames.fogbugz.com/default.asp?W715

 bye,

 Jean