RPG Question

Hi Everyone, I am starting to build my RPG game and I have a question on how to handle a few things.

The game will consist of many scenes where the hero can move back and forth from. I am using Jamie Cross RPG–Connecting the Rooms of a Dungeon technique to move back and forth from the scenes.

Question 1

The hero will be able to pick up gems, heath and other items in the scenes the game. But one problem I am running into is once the hero picks up the item, then goes to the next scene, then back to the previous scene the items have reappeared.

Is their a way to put a timer on the item once picked up, so it can not be picked up again for a certain amount of time.

Question 2

I will also have several enemies, so will drop items when killed. Is their a way to have the enemies randomly drop items when destroyed?

Thanks in advance!

Comments

  • IceboxIcebox Member Posts: 1,485
    edited June 2016

    @quinn221 said:
    But one problem I am running into is once the hero picks up the item, then goes to >the next scene, then back to the previous scene the items have reappeared.

    You can solve this with a game boolean game.AAA attribute , if item overlaps or collides with hero change game.AAA to true , if game.AAA is true destroy.

    Is their a way to put a timer on the item once picked up, so it can not be picked up again for a certain amount of time.

    if game.AAA is true , after 5 min spawn the item and change game.AAA back to false

    I will also have several enemies, so will drop items when killed. Is their a way to have the enemies randomly drop items when destroyed?

    spawn to a self.integer attribute , give the enemy actor an integer attribute call it BBB

    change attribute self.BBB to random(1,3)

    if self.BBB = 1 spawn item 1
    if self.BBB = 2 spawn item 2
    if self.BBB = 3 spawn item 3

  • SocksSocks London, UK.Member Posts: 12,822

    @Icebox said:
    change attribute self.BBB to random(1,3)

    if self.BBB = 1 spawn item 1
    if self.BBB = 2 spawn item 2
    if self.BBB = 3 spawn item 3

    A slightly more efficient structure would be:

    if self.BBB = 1 spawn item 1
    --Otherwise if BBB = 2 spawn item 2
    ----Otherwise spawn item 3

  • quinn221quinn221 Member Posts: 280

    Thanks @Icebox and @Socks

  • quinn221quinn221 Member Posts: 280

    @Icebox said:

    @quinn221 said:
    But one problem I am running into is once the hero picks up the item, then goes to >the next scene, then back to the previous scene the items have reappeared.

    You can solve this with a game boolean game.AAA attribute , if item overlaps or collides with hero change game.AAA to true , if game.AAA is true destroy.

    Is their a way to put a timer on the item once picked up, so it can not be picked up again for a certain amount of time.

    if game.AAA is true , after 5 min spawn the item and change game.AAA back to false

    I will also have several enemies, so will drop items when killed. Is their a way to have the enemies randomly drop items when destroyed?

    spawn to a self.integer attribute , give the enemy actor an integer attribute call it BBB

    change attribute self.BBB to random(1,3)

    if self.BBB = 1 spawn item 1
    if self.BBB = 2 spawn item 2
    if self.BBB = 3 spawn item 3

    @Icebox Just a followup on this, Will I need to make a game attribute for everyone of my Gems in order for it not to reappear when switching scenes?

  • IceboxIcebox Member Posts: 1,485

    @quinn221 said:
    @Icebox Just a followup on this, Will I need to make a game attribute for everyone of my Gems in order for it not to reappear when switching scenes?

    You can do it with a table , or someone might have a better method.

    Create a table (TB_GEMS) , Rows will be the number of gems lets say you have 10 gems so create 10 rows , and let the column be an integer. (only one column)

    In your gem actor , create a self integer attribute call it self.Row ( give each gem a self.row number)

    if overlaps or collides with hero
    change table value TB_GEMS
    Row: self.row
    Column: 1 value : 1

    Create a rule
    if numeric expression TableCellValue(TB_GEMS,self.row,1) = 1
    destroy

    I think this should work. Dont forget to give each gem actor a self.row number to determine which row it should look at.

  • quinn221quinn221 Member Posts: 280

    @Icebox said:

    @quinn221 said:
    @Icebox Just a followup on this, Will I need to make a game attribute for everyone of my Gems in order for it not to reappear when switching scenes?

    You can do it with a table , or someone might have a better method.

    Create a table (TB_GEMS) , Rows will be the number of gems lets say you have 10 gems so create 10 rows , and let the column be an integer. (only one column)

    In your gem actor , create a self integer attribute call it self.Row ( give each gem a self.row number)

    if overlaps or collides with hero
    change table value TB_GEMS
    Row: self.row
    Column: 1 value : 1

    Create a rule
    if numeric expression TableCellValue(TB_GEMS,self.row,1) = 1
    destroy

    I think this should work. Dont forget to give each gem actor a self.row number to determine which row it should look at.

    Awesome!

  • MentalDonkeyGamesMentalDonkeyGames Member Posts: 1,276

    @quinn221 said:

    @Icebox said:

    @quinn221 said:
    @Icebox Just a followup on this, Will I need to make a game attribute for everyone of my Gems in order for it not to reappear when switching scenes?

    You can do it with a table , or someone might have a better method.

    Create a table (TB_GEMS) , Rows will be the number of gems lets say you have 10 gems so create 10 rows , and let the column be an integer. (only one column)

    In your gem actor , create a self integer attribute call it self.Row ( give each gem a self.row number)

    if overlaps or collides with hero
    change table value TB_GEMS
    Row: self.row
    Column: 1 value : 1

    Create a rule
    if numeric expression TableCellValue(TB_GEMS,self.row,1) = 1
    destroy

    I think this should work. Dont forget to give each gem actor a self.row number to determine which row it should look at.

    Awesome!

    To add to this. If you have multiple rooms with gems, you can put multiple columns in the table and have each column represent a different room. Col 1 = room 1, Col 2 = room2 etc...

    Easy way would be to keep track of what room you're in with an integer game attribute, and use that attribute to determine the column in the rule that destroys the gem if it's collected.

    So if you're in room1, change game.room to 1, if at room 2, change game.room to 2 etc...

    And the expression would be: TableCellValue(TB_GEMS,self.row,game.room)

    Mental Donkey Games
    Website - Facebook - Twitter

  • quinn221quinn221 Member Posts: 280

    @Icebox said:

    @quinn221 said:
    @Icebox Just a followup on this, Will I need to make a game attribute for everyone of my Gems in order for it not to reappear when switching scenes?

    You can do it with a table , or someone might have a better method.

    Create a table (TB_GEMS) , Rows will be the number of gems lets say you have 10 gems so create 10 rows , and let the column be an integer. (only one column)

    In your gem actor , create a self integer attribute call it self.Row ( give each gem a self.row number)

    if overlaps or collides with hero
    change table value TB_GEMS
    Row: self.row
    Column: 1 value : 1

    Create a rule
    if numeric expression TableCellValue(TB_GEMS,self.row,1) = 1
    destroy

    I think this should work. Dont forget to give each gem actor a self.row number to determine which row it should look at.

    I gave it a try but did not work... when I leave the scene and comeback the gems is back.

    Your logic makes sense not sure why it wont work for me. I have attached my screen shot of the table, locked actor and unlocked actor. Let me know if I misunderstood something..

    https://www.dropbox.com/s/tszusr4gg1zi4ie/Screenshot.zip?dl=0

  • MentalDonkeyGamesMentalDonkeyGames Member Posts: 1,276
    edited August 2016

    @quinn221 said:

    @Icebox said:

    @quinn221 said:
    @Icebox Just a followup on this, Will I need to make a game attribute for everyone of my Gems in order for it not to reappear when switching scenes?

    You can do it with a table , or someone might have a better method.

    Create a table (TB_GEMS) , Rows will be the number of gems lets say you have 10 gems so create 10 rows , and let the column be an integer. (only one column)

    In your gem actor , create a self integer attribute call it self.Row ( give each gem a self.row number)

    if overlaps or collides with hero
    change table value TB_GEMS
    Row: self.row
    Column: 1 value : 1

    Create a rule
    if numeric expression TableCellValue(TB_GEMS,self.row,1) = 1
    destroy

    I think this should work. Dont forget to give each gem actor a self.row number to determine which row it should look at.

    I gave it a try but did not work... when I leave the scene and comeback the gems is back.

    Your logic makes sense not sure why it wont work for me. I have attached my screen shot of the table, locked actor and unlocked actor. Let me know if I misunderstood something..

    https://www.dropbox.com/s/tszusr4gg1zi4ie/Screenshot.zip?dl=0

    Put the "destroy" rule outside of the "overlaps or collides" rule and it should work.

    Currently it's checking for the destroy conditions while your character is touching it. So when you come back to the room, it won't be destroyed.

    Mental Donkey Games
    Website - Facebook - Twitter

  • quinn221quinn221 Member Posts: 280

    @MentalDonkeyGames said:

    @quinn221 said:

    @Icebox said:

    @quinn221 said:
    @Icebox Just a followup on this, Will I need to make a game attribute for everyone of my Gems in order for it not to reappear when switching scenes?

    You can do it with a table , or someone might have a better method.

    Create a table (TB_GEMS) , Rows will be the number of gems lets say you have 10 gems so create 10 rows , and let the column be an integer. (only one column)

    In your gem actor , create a self integer attribute call it self.Row ( give each gem a self.row number)

    if overlaps or collides with hero
    change table value TB_GEMS
    Row: self.row
    Column: 1 value : 1

    Create a rule
    if numeric expression TableCellValue(TB_GEMS,self.row,1) = 1
    destroy

    I think this should work. Dont forget to give each gem actor a self.row number to determine which row it should look at.

    I gave it a try but did not work... when I leave the scene and comeback the gems is back.

    Your logic makes sense not sure why it wont work for me. I have attached my screen shot of the table, locked actor and unlocked actor. Let me know if I misunderstood something..

    https://www.dropbox.com/s/tszusr4gg1zi4ie/Screenshot.zip?dl=0

    Put the "destroy" rule outside of the "overlaps or collides" rule and it should work.

    Currently it's checking for the destroy conditions while your character is touching it. So when you come back to the room, it won't be destroyed.

    Thanks...I can't believe I did not catch that.

Sign In or Register to comment.