Jump to content

Some to explain


Wei

Recommended Posts

I wanna make the vehicle system based on the xml.

So can you explain me how can I:

So when player bought a vehicle. It puts it in the xml. I know that. But how can I make that player buys a secund vehicle it puts to the new node.

Like:

i have that: ( when player buy the first car )

411

but when the player buy the secund one does like this:

411

and continue like that

411

411

411

to infinity.

Thanks

Link to comment
Guest Guest4401

I couldn't exactly understand what you want. Maybe this: ?

xmlCreateChild(theFile,"blazyVehicleID"..#xmlNodeGetChildren(theFile)) 

Link to comment

@blazy,

Are you sure you want to use this format of the file where each node is named by numbers? There is more hassle when you delete one of them and want to add another one. Unless you're sure you don't want to delete any of the vehicles.

First, you need to open the file and then xmlCreateChild to add another node. This function returns the newly created node and then you can use xmlNodeSetValue to set its value of vehicle ID.

You'll probably want to extend your system and make it save vehicle colour, upgrades and its health or other information, in that case, you better use node attributes instead of node values or even better, save the data in SQL or MySQL instead.

Link to comment

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...