LoginLogin

Chest On Open Map

Root / Programming Questions / [.]

Z_E_R_OCreated:
I'm working on a bigger project, I'm using the open world map editor. I now know how to set boarders like trees, But how would I add treasure chest using BG functions. Any help would be great. :)

ok idk also what's the key for the open world map editor? okay here's a joke: Head Admin
powerswatches ova u Send messages in Staff chatroom Make announcement threads in the forums Make chat announcements across all rooms Ban users from chat up to 1 day Edit or delete comments Edit or delete forum posts Close or reopen polls Close or reopen threads Rename threads Move threads Sticky threads Edit submitted pages Promote pages to the front page Block users from chat up to 1 week Block users from website up to 1 week Delete threads Delete user submitted pages A bit of control over the chat server Set the alert banner at top of website Give out certain badges Retrieve special information from the server Block user's avatar Grant lower stars to other users Block users from website for any time Change usernames Supreme control over chat server Hide your powers Elevated power Can die Can permaban peeps

ok idk also what's the key for the open world map editor? okay here's a joke: Head Admin
powerswatches ova u Send messages in Staff chatroom Make announcement threads in the forums Make chat announcements across all rooms Ban users from chat up to 1 day Edit or delete comments Edit or delete forum posts Close or reopen polls Close or reopen threads Rename threads Move threads Sticky threads Edit submitted pages Promote pages to the front page Block users from chat up to 1 week Block users from website up to 1 week Delete threads Delete user submitted pages A bit of control over the chat server Set the alert banner at top of website Give out certain badges Retrieve special information from the server Block user's avatar Grant lower stars to other users Block users from website for any time Change usernames Supreme control over chat server Hide your powers Elevated power Can die Can permaban peeps
Oh, Im just using the standard mp editor

super snip galaxy AND TYPO FIX Im just using the standard map editor
b-b-b-but you said
super snip galaxy 2 I'm using the open world map editor. super snip 3D LAND

I'm using the standard map editor.
...But you said:
I'm using the open world map editor.
It's the same thing in the end

XD I don't even know what's going on at this point XD

XD I don't even know what's going on at this point XD
no-one does. i haz helped you by request of lumage

So what are you doing? Are you trying to put a treasure chest with effects in a map in sb and maybe animate it?

So what are you doing? Are you trying to put a treasure chest with effects in a map in sb and maybe animate it?[/quoteI Yes, I'm not sure how to though.I have trouble randomly generating items.

So what are you doing? Are you trying to put a treasure chest with effects in a map in sb and maybe animate it?
Yes, I'm not sure how to though.I have trouble randomly generating items.
Can you please describe in depth how you are having trouble? It helps us help you when you do.

So what are you doing? Are you trying to put a treasure chest with effects in a map in sb and maybe animate it?
Yes, I'm not sure how to though.I have trouble randomly generating items.
Can you please describe in depth how you are having trouble? It helps us help you when you do.
Yes I can :) Basically i'm using bgload for all layers, I'm setting the bg layer to move, and then i'm trying to place a BG Tile on the map I have it to where Layer 1 is the boundary. Now i am trying to add chest in random places on the map, but I want them to do the same thing, Open and give the player a random item.

Its Bg Tile 864

Randomly generate the chests and go through your map checking each tile. If your character or whatever interacts with it, generate a random item id. You can randomly generate them by using nested loops and using the I and J incrementors of the loops as x and y coordinates. Based on a random number (if rnd==123 etc) you can then bgput tile on the coordinates each inner loop iteration. Higher conditional numbers make the spawn rarer.

Randomly generate the chests and go through your map checking each tile. If your character or whatever interacts with it, generate a random item id. You can randomly generate them by using nested loops and using the I and J incrementors of the loops as x and y coordinates. Based on a random number (if rnd==123 etc) you can then bgput tile on the coordinates each inner loop iteration. Higher conditional numbers make the spawn rarer.
my SB doesn't have the new dlc that allows you to make nested DEFs and loops so i can't test this this is a joke
Then what's the point wasting everyone's time? Anyways http://smilebasicsource.com/page?pid=958 can help with movement and maybe interaction @Z_E_R_O.

Randomly generate the chests and go through your map checking each tile. If your character or whatever interacts with it, generate a random item id. You can randomly generate them by using nested loops and using the I and J incrementors of the loops as x and y coordinates. Based on a random number (if rnd==123 etc) you can then bgput tile on the coordinates each inner loop iteration. Higher conditional numbers make the spawn rarer.
my SB doesn't have the new dlc that allows you to make nested DEFs and loops so i can't test this this is a joke
Then what's the point wasting everyone's time? Anyways http://smilebasicsource.com/page?pid=958 can help with movement and maybe interaction @Z_E_R_O.
Thanks for all the help, sorry for all the questions :)

No problem ;)

Randomly generate the chests and go through your map checking each tile. If your character or whatever interacts with it, generate a random item id. You can randomly generate them by using nested loops and using the I and J incrementors of the loops as x and y coordinates. Based on a random number (if rnd==123 etc) you can then bgput tile on the coordinates each inner loop iteration. Higher conditional numbers make the spawn rarer.
An alternative more efficient way would be to keep a pseudo-2d array full of coordinates of the chests on the map. Then to loop through this list instead of the entire BG layer. Like this maybe:
dim chests[0]
def addchest x,y,contents ' adds chest with contents to array
 push chests,x
 push chests,y
 push chests,contents
end
Every frame you can loop through the chests array like this:
for i=0 to len(chests)-1 step 3 'loops through chests array
 'chests[i] = x
 'chests[i+1] = y
 'chests[i+2] = contents
 if collisionwithplayer(chests[i],chests[i+1]) then 'checks collision between player and chest
  animatechest chests[i], chests[i+1] 'animates chest opening
  giveplayeritem chests[i+2] 'gives player item
 endif
next
Much more efficient than looping through the entire BG tile layer of course.

Randomly generate the chests and go through your map checking each tile. If your character or whatever interacts with it, generate a random item id. You can randomly generate them by using nested loops and using the I and J incrementors of the loops as x and y coordinates. Based on a random number (if rnd==123 etc) you can then bgput tile on the coordinates each inner loop iteration. Higher conditional numbers make the spawn rarer.
An alternative more efficient way would be to keep a pseudo-2d array full of coordinates of the chests on the map. Then to loop through this list instead of the entire BG layer. Like this maybe:
dim chests[0]
def addchest x,y,contents ' adds chest with contents to array
 push chests,x
 push chests,y
 push chests,contents
end
Every frame you can loop through the chests array like this:
for i=0 to len(chests)-1 step 3 'loops through chests array
 'chests[i] = x
 'chests[i+1] = y
 'chests[i+2] = contents
 if collisionwithplayer(chests[i],chests[i+1]) then 'checks collision between player and chest
  animatechest chests[i], chests[i+1] 'animates chest opening
  giveplayeritem chests[i+2] 'gives player item
 endif
next
Much more efficient than looping through the entire BG tile layer of course.
Ffs, Thank you so much. it worked perfectly.

-snip- Ffs, Thank you so much. it worked perfectly.
ffs? sorry I don't use internet slang as often as I should.

-snip- Ffs, Thank you so much. it worked perfectly.
ffs? sorry I don't use internet slang as often as I should.
i don't understand that internet slang either and i use internet slang often lol