Thread: [Please Help] Hyperion, write to xml file

Results 1 to 3 of 3
  1. #1 [Please Help] Hyperion, write to xml file 
    Registered Member

    Join Date
    Mar 2009
    Posts
    430
    Thanks given
    5
    Thanks received
    6
    Rep Power
    89
    Hello, i would like to ask some help me converting a ::npc spawn command.

    So, heres the command i have right now:
    Code:
    if(command.equals("npc")) {
    NPC npc = NPC.create(NPCDefinition.forId(Integer.parseInt(args[1])), player.getLocation(), null, null);
    World.getWorld().getNPCs().add(npc);
    }
    I need to convert it so that it will also by spawning a npc save it's information in file:
    Code:
    data/npcSpawns.xml
    in this format:
    Code:
    <list>
    	<npcSpawn>
    	  <npcId>50</npcId> <!--The npc id to spawn.-->
    	  <walkingType>2</walkingType> <!--The walking type-->
    	  <spawnLocation> <!--The location to spawn the NPC.-->
    		<x>2272</x>
    		<y>4697</y>
    		<z>0</z>
    	  </spawnLocation>
    	  <minLocation> <!--The lowest location you can walk into..-->
    		<x>2261</x>
    		<y>4685</y>
    		<z>0</z>
    	  </minLocation>
    	  <maxLocation> <!--The highest location you can walk into..-->
    		<x>2282</x>
    		<y>4706</y>
    		<z>0</z>
    	  </maxLocation>
    	</npcSpawn>
    </list>
    I hope someone knows how to do it, bcuz i have no clue on how to do that, thanks before.
    please give me atleast a idea how it should look like...
    Reply With Quote  
     

  2. #2  
    xxxCutiexxx
    Guest
    bufferedwriter?
    Reply With Quote  
     

  3. #3  
    Registered Member
    Mister Maggot's Avatar
    Join Date
    Dec 2008
    Posts
    7,227
    Thanks given
    3,283
    Thanks received
    2,875
    Rep Power
    5000
    z isn't a good representation of height...

    Anyway; not really... It'd be a big program tho, to load the file, erase last line, then write the rest in there.
    Reply With Quote  
     


Thread Information
Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)


User Tag List

Posting Permissions
  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •