Saving gameobjects spawns, creatures C++ menu

User Tag List

Results 1 to 5 of 5
  1. #1
    LJN's Avatar Member
    Reputation
    273
    Join Date
    Jun 2007
    Posts
    731
    Thanks G/R
    0/0
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Saving gameobjects spawns, creatures C++

    Is there a way to save any spawns into the database using C++ or lua. I do know you can spawn creatures using lua but if you kill them or restart the server they are gone. So, is there any way to save anything. Vendor items, gameobject spawns, creature spawns, waypoints.

    +repx3 if you can help me.
    Last edited by LJN; 01-02-2009 at 11:08 PM.
    ahhhh

    Saving gameobjects spawns, creatures C++
  2. #2
    Aznex's Avatar Contributor
    Reputation
    128
    Join Date
    Feb 2008
    Posts
    770
    Thanks G/R
    0/0
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Do U wanna use C++ to insert spawned stuff to the DB?

    or are u just looking for a way to save command spawned stuff after a restart?
    Last edited by Aznex; 01-02-2009 at 04:43 PM.

  3. #3
    LJN's Avatar Member
    Reputation
    273
    Join Date
    Jun 2007
    Posts
    731
    Thanks G/R
    0/0
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    What I want to do. (sorry I forgot to add this) but when you complete a quest or kill a creature then NPC's will spawn and save into the database.
    ahhhh

  4. #4
    Aznex's Avatar Contributor
    Reputation
    128
    Join Date
    Feb 2008
    Posts
    770
    Thanks G/R
    0/0
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Believe U can use something like WorldDatabase.Execute("INSERT INTO creature_spawns" ...andso on");
    return true;

  5. #5
    LJN's Avatar Member
    Reputation
    273
    Join Date
    Jun 2007
    Posts
    731
    Thanks G/R
    0/0
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I did find this in creatures.cpp

    Code:
    ss.rdbuf()->str("");
    	ss << "\nINSERT INTO creatures (id, mapId, zoneId, name_id, positionX, positionY, positionZ, orientation, moverandom, running, data) VALUES ( "
    		<< m_sqlid << ", "
    		<< GetMapId() << ", "
    		<< GetZoneId() << ", "
    		<< GetUInt32Value(OBJECT_FIELD_ENTRY) << ", "
    		<< m_position.x << ", "
    		<< m_position.y << ", "
    		<< m_position.z << ", "
    		<< m_position.o << ", "
    		<< GetAIInterface()->getMoveType() << ", "
    		<< GetAIInterface()->getMoveRunFlag() << ", '";
    	for( uint16 index = 0; index < m_valuesCount; index ++ )
    		ss << GetUInt32Value(index) << " ";
    
    	ss << "' )";
    	fwrite(ss.str().c_str(),1,ss.str().size(),OutFile);
    	fclose(OutFile);*/
    }


    Code:
    {
    	if(!spawnid)
    		spawnid = objmgr.GenerateCreatureSpawnID();
    	 
    	std::stringstream ss;
    	ss << "REPLACE INTO creature_spawns VALUES("
    		<< spawnid << ","
    		<< GetEntry() << ","
    		<< GetMapId() << ","
    		<< m_position.x << ","
    		<< m_position.y << ","
    		<< m_position.z << ","
    		<< m_position.o << ","
    		<< m_aiInterface->getMoveType() << ","
    		<< m_uint32Values[UNIT_FIELD_DISPLAYID] << ","
    		<< m_uint32Values[UNIT_FIELD_FACTIONTEMPLATE] << ","
    		<< m_uint32Values[UNIT_FIELD_FLAGS] << ","
    		<< m_uint32Values[UNIT_FIELD_BYTES_0] << ","
    		<< m_uint32Values[UNIT_FIELD_BYTES_1] << ","
    		<< m_uint32Values[UNIT_FIELD_BYTES_2] << ","
    		<< m_uint32Values[UNIT_NPC_EMOTESTATE] << ",0,";
    		/*<< ((this->m_spawn ? m_spawn->respawnNpcLink : uint32(0))) << ",";*/
    
    	if(m_spawn)
    		ss << m_spawn->channel_spell << "," << m_spawn->channel_target_go << "," << m_spawn->channel_target_creature << ",";
    	else
    		ss << "0,0,0,";
    
    	ss << uint32(GetStandState()) << ","
    		<< m_uint32Values[UNIT_FIELD_MOUNTDISPLAYID] << "," 
    		<< m_uint32Values[UNIT_VIRTUAL_ITEM_SLOT_ID] << ","
    		<< m_uint32Values[UNIT_VIRTUAL_ITEM_SLOT_ID_1] << ","
    		<< m_uint32Values[UNIT_VIRTUAL_ITEM_SLOT_ID_2] << ")";
    	
    	WorldDatabase.Execute(ss.str().c_str());
    }
    Last edited by LJN; 01-02-2009 at 05:24 PM.
    ahhhh

Similar Threads

  1. Add new Column to Creature and Gameobject Spawn DB
    By tagala in forum WoW EMU Questions & Requests
    Replies: 4
    Last Post: 08-18-2009, 12:50 AM
  2. Saving gameobjects
    By Yann101 in forum World of Warcraft Emulator Servers
    Replies: 11
    Last Post: 02-24-2008, 02:31 AM
  3. Spawning creatures in ascent (it was annoying to figure out)
    By stray123 in forum WoW EMU Guides & Tutorials
    Replies: 2
    Last Post: 12-18-2007, 12:42 AM
  4. Gameobject spawning..
    By Autumnbearbravehunter in forum World of Warcraft Emulator Servers
    Replies: 3
    Last Post: 10-11-2007, 08:01 PM
  5. Gameobjects spawn table?
    By Equ1N0X in forum World of Warcraft Emulator Servers
    Replies: 0
    Last Post: 09-14-2007, 04:10 PM
All times are GMT -5. The time now is 12:16 PM. Powered by vBulletin® Version 4.2.3
Copyright © 2024 vBulletin Solutions, Inc. All rights reserved. User Alert System provided by Advanced User Tagging (Pro) - vBulletin Mods & Addons Copyright © 2024 DragonByte Technologies Ltd.
Digital Point modules: Sphinx-based search