Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

DarkBASIC Professional Discussion / load in objects in game

Author
Message
Daniel wright 2311
User Banned
Posted: 26th Aug 2010 23:01 Edited at: 26th Aug 2010 23:04
ok so I made some code that loads in objects on the fly, I can position them where i want and save there positions, but It does not work every time, some times i get an error as object already exsits but not every time. any way if i try to texture the objects it does not work. please help, sorry for so many threads its just I have alot of questions today about difrent things. here is my code, thanks



then if i texture it it gives me an error



Your signature has been erased by a mod please reduce it to 600 x 120.
Daniel wright 2311
User Banned
Posted: 26th Aug 2010 23:19 Edited at: 26th Aug 2010 23:20
i tryed this but still gives me a object already exists error becouse of the texture, now without the texture they all load fine.



Your signature has been erased by a mod please reduce it to 600 x 120.
MASTER OF PUPPETS
22
Years of Service
User Offline
Joined: 9th Jun 2004
Location: Trapped Under Ice
Posted: 27th Aug 2010 01:02 Edited at: 27th Aug 2010 01:06
for i = 20000 to 30000
inc i
next i
???
ok,

the for i = blah
and next i
creates a loop that counts between 20000 to 30000 every time the program gets to it.
by putting "inc i" you are essentially making it skip 1 number every time.

maybe try this...


what this code does is... makes it so that your new object starts at 20000 and goes from there. when making new objects on the fly in mid-game, it is usually important to check if the object (or object label) already exists.

...and if that doesn't work then please post more or all of your code so i can see why. hope that helps

metal is not music but a way of life...all hail to the reigning king METALLICA!!! [EDIT] ...well... up until "Load" came out.
Daniel wright 2311
User Banned
Posted: 27th Aug 2010 01:54 Edited at: 27th Aug 2010 01:55
@MASTER OF PUPPETS

this is not positioning my objects, its mostly loading them but not positioning them.

Your signature has been erased by a mod please reduce it to 600 x 120.
MASTER OF PUPPETS
22
Years of Service
User Offline
Joined: 9th Jun 2004
Location: Trapped Under Ice
Posted: 27th Aug 2010 02:04 Edited at: 27th Aug 2010 02:06


putting the position object stuff outside the if/then for the button may work

if it doesn't please post all your code so i can see what is wrong

metal is not music but a way of life...all hail to the reigning king METALLICA!!! [EDIT] ...well... up until "Load" came out.
Daniel wright 2311
User Banned
Posted: 27th Aug 2010 02:17
no, this did not do it either, I think i just give up on this one to be honest.the more i try to do it the more i mess up.

Your signature has been erased by a mod please reduce it to 600 x 120.
Mobiius
Valued Member
23
Years of Service
User Offline
Joined: 27th Feb 2003
Location: The Cold North
Posted: 27th Aug 2010 09:46
Come on guys...
Quote: "position object i, object position x( 2 ) , 5, object position z( 2 )"

you're positioning every object at the same position as object 2.

My signature is NOT a moderator plaything! Stop changing it!
Daniel wright 2311
User Banned
Posted: 27th Aug 2010 10:06
Quote: "you're positioning every object at the same position as object 2."


wich is the cameras object so where ever the camera is the object will fall.

Your signature has been erased by a mod please reduce it to 600 x 120.
BillR
23
Years of Service
User Offline
Joined: 19th Mar 2003
Location: United States
Posted: 27th Aug 2010 10:21 Edited at: 27th Aug 2010 10:28
In your first post
Change the texture line from this

to this


In your second post
add if object exist...
Daniel wright 2311
User Banned
Posted: 27th Aug 2010 10:34
@BillR

it works and i do thank you, now i can set up all my objects, place them where i want the save that file.

Your signature has been erased by a mod please reduce it to 600 x 120.
Daniel wright 2311
User Banned
Posted: 27th Aug 2010 11:00
now I just have to figure out how to save them to file them load them back in, they are only placed in memory and not loaded manuly.Im shure it will all work out.

Your signature has been erased by a mod please reduce it to 600 x 120.
BillR
23
Years of Service
User Offline
Joined: 19th Mar 2003
Location: United States
Posted: 27th Aug 2010 11:10 Edited at: 27th Aug 2010 11:12
Try this code to get an idea how to use a function
Also cloning is faster than loading every object when they are the same object. Load the first one, then clone other copies.
Mobiius
Valued Member
23
Years of Service
User Offline
Joined: 27th Feb 2003
Location: The Cold North
Posted: 27th Aug 2010 15:10
Quote: "texture object i,19 "

I did notice that, but forgot to mention it! D'Oh! lol

My signature is NOT a moderator plaything! Stop changing it!
Daniel wright 2311
User Banned
Posted: 27th Aug 2010 20:42
@BillR

I know how to write functions and use them, I like the idea that the program dont use them unless called. it saves memory, but I do like the function you wrote here,but it does not apply to what im doing as Im just using this as an easy way to get positions, save them, then load my modles to the saved locations. it does speed things up.thanks for all your help

@Mobiius

if you see my first 2 postes, you will see that "texture object i,19 " is right, it was MASTER OF PUPPETS who changed it.

Your signature has been erased by a mod please reduce it to 600 x 120.

Login to post a reply

Server time is: 2026-07-23 12:10:31
Your offset time is: 2026-07-23 12:10:31