Page 1 of 1

The ex-girlfriend motivation (/spawn)

Posted: Sun Jul 12, 2015 10:55 am
by Plague
I have tried this several times.. still I can not make a spawn that is permanent. I was following the guide at http://eq2emulator.net/wiki/index.php/Admins:Content I was in /zone 1 "GMhall"
I started with the command "/spawn create npc 203 1 50 'Lady Vox' 1 32". I played around with this command figuring out the ranges of each entry, until I came up with one I felt suited the Mob I was trying to make.

/spawn create npc 170 10 30 'Beth' 7 40
Is there a list of the classes and there corresponding number for /spawn create?

Beth being an ex-girlfriend and a bit of a boar I rather relished the opportunity to kill her ... repeatedly.

I then experimented with the "/spawn move" command which worked perfectly fine especially for anyone who played around in house design on the live servers.

"/spawn set list" was interesting tho I still don't know what more then half the commands do. Assuming based on their descriptions they give the model I'm working on specific looks and or armor it is wearing.
"/spawn set suffix" I gave her a nice one "The Ugly"
"/spawn set sub_title" Again inspired by her "A Bad Decision"

Then I moved to the "/spawn add" command and tried "/spawn add new "Beth"
It assigned NPC id 10011 and a spawn group of 584357 and a percentage off 100%
/reload spawns ok, she depopped and then repopped correctly. So I killed her in game with a handy spell or other and wait for game time repop and not knowing I assumed the repop was 15min or so. She does not repop after 30 min so I again /reload spawn and she is back. I don't know how to make her a permanent spawn, or as the case may be to respawn after a certain time.

Now to the part I really don't understand. Well really I don't understand any of the .lua for quests, conversations, movement, etc
"/spawn set spawn_script 'spawnscripts.lua' "where I am assuming the spawnscripts.lua part is the name of a script already made.
I am assuming the spawnscripts have to be made in the database via a SQL editor. Not wanted to destroy my database I figured I would ask questions here before I simply copy my database to a safe place and start experimenting. Any advice on the matter would be welcomed. I seem to have a handle now on making spawns, even if it takes me time to go through all models to find the one I want. I just can not get them to do anything other then stand there.

Re: The ex-girlfriend motivation (/spawn)

Posted: Sun Jul 12, 2015 2:58 pm
by Cynnar
Plague wrote: /reload spawns ok, she depopped and then repopped correctly. So I killed her in game with a handy spell or other and wait for game time repop and not knowing I assumed the repop was 15min or so. She does not repop after 30 min so I again /reload spawn and she is back. I don't know how to make her a permanent spawn, or as the case may be to respawn after a certain time.
There is a respawn timer that controls the respawn rate. I don't know how to change it from command line due to using web db editor on the server more than I make local server changes. Jab will have to answer this one.
Plague wrote: Now to the part I really don't understand. Well really I don't understand any of the .lua for quests, conversations, movement, etc
"/spawn set spawn_script 'spawnscripts.lua' "where I am assuming the spawnscripts.lua part is the name of a script already made. I am assuming the spawnscripts have to be made in the database via a SQL editor.
/spawn set spawn_script puts in the db the current target will use spawnscripts.lua. So you do not have to add using SQL editor. The spawnscripts are stored in your world folder under SpawnScripts. Inside that folder is zone folders. If there is already a folder for the zone you are working on then the spawnscripts.lua goes in there. If not you will need to create one, like GMHall, to put spawn scripts in that belong to the spawns in that zone. Here is an example using your ex-girlfriend spawn.
With Beth targeted
/spawn set spawn_script 'SpawnScripts/GMhall/Beth.lua'
The part on blue points to the folder where the .lua script is located, and the red is the name of the .lua script you want to use. Usually the spawn scripts are named after the spawn it is associated with. Makes it easier to know what scripts go with what spawns

This will insert into the db that Beth will use Beth.lua
Now you must /reload spawnscripts and /reload spawns for the changes to take effect in the game.
Plague wrote:Not wanted to destroy my database I figured I would ask questions here before I simply copy my database to a safe place and start experimenting.
That is a good call. It is better to ask especially when trying to use some of the tutorials. Most of them are outdated. Something o do, and may not be for everyone is add a second world db to mysql. That way I have one to rollback to if I do mess the main one up. Always a good idea to have a backup.

Plague wrote: I just can not get them to do anything other then stand there.
This is where lua scripting comes into play. I'm still learning it, but can help some if you need me to.

Re: The ex-girlfriend motivation (/spawn)

Posted: Sun Jul 12, 2015 3:09 pm
by Jabantiz
There is this wiki page that was corrupted, I just restored it but it does have the class id's.

There is a "/spawn set respawn" that you can use to adjust the respawn time.

LUA is a physical file, no need to edit the DB, when use "/spawn set spawn_script <path to lua>" it handles the DB portion for you, after you use that command all you need to do is "/reload spawnscripts" followed by a "/reload spawns" and it should work. There are lua scripting tutorials in the tutorial forum

EDIT: Cynnar beat me with more details

Re: The ex-girlfriend motivation (/spawn)

Posted: Sun Jul 12, 2015 3:15 pm
by Cynnar
See I get all long winded and just make things more complicated than they actually are. Glad you are here Jab. :)

Re: The ex-girlfriend motivation (/spawn)

Posted: Sun Jul 12, 2015 6:05 pm
by Plague
Great post http://eq2emulator.net/phpBB3/viewtopic.php?f=9&t=3095 by Jabantiz. Been reading older posts all day. I read them all once but as I learn new things I find thanks to you its a good idea to re-read them. Came up with the following for my little Beth.

Code: Select all

function hailed(NPC, Spawn)

   -- have the NPC face the player
     FaceTarget(NPC, Spawn)

   -- create the conversation
   conversation = CreateConversation()

   -- set the 3 player options
   AddConversationOption(conversation, "Your as ugly as I remember.", "Choice1")
   AddConversationOption(conversation, "I'm sorry it was all my fault.", "Choice2")
   AddConversationOption(conversation, "I don't have time for this.")

   -- set the npc dialog and start the conversation
   StartConversation(conversation, NPC, Spawn, "Why have you come to bother me " .. GetName(Spawn) .. "?")
end

-- This is the function called by the first choice
function Choice1(NPC, Spawn)

   -- face the target
   FaceTarget(NPC, Spawn)

   -- need to create another conversation
   conversation = CreateConversation()

   -- add the player option
   AddConversationOption(conversation, "Good Bye for good this time.")

   -- set NPC dialog and start the conversation
   StartConversation(conversation, NPC, Spawn, "I'm going to kill you!")
end

-- This is the function called by the second choice
function Choice2(NPC, Spawn)

   -- face the target
   FaceTarget(NPC, Spawn)

   -- need to create another conversation
   conversation = CreateConversation()

   -- add the player option
   AddConversationOption(conversation, "As a guy it is always my fault regardless if it is true or not. Good Bye.")

   -- set NPC dialog and start the conversation
   StartConversation(conversation, NPC, Spawn, "So you admit it!")
end
Still reading the list of available commands from this list http://eq2emulator.net/phpBB3/viewtopic.php?f=30&t=633 but I don't see one that will cause the MOB (Beth) to go agro and attack. I would like her to attack if the first option is chosen.
Well I see server is up again perhaps ill go crash it again I'm getting good at that. And this last time I never cast a pet, just picked up some wood to burn the orcs tents down in frost fang sea.

Re: The ex-girlfriend motivation (/spawn)

Posted: Sun Jul 12, 2015 6:15 pm
by Jabantiz
Glad you found that post helpful.

For a complete list of all commands this wiki is the best as I keep that as up to date as possible. For forcing the attack there is the Attack() command.

And my attempt to fix the pet crash made it worse so the server is running a modified fix now, this is going to be a difficult bug to track down.

Re: The ex-girlfriend motivation (/spawn)

Posted: Sun Jul 12, 2015 11:45 pm
by Plague
Finished beating up my Ex had some fun experimenting the the scripts ended up with this.

Code: Select all

function hailed(NPC, Spawn)

       -- have the NPC face the player
         FaceTarget(NPC, Spawn)

       -- create the conversation
       conversation = CreateConversation()

       -- set the 3 player options
       AddConversationOption(conversation, "Your as ugly as I remember.", "Choice1")
       AddConversationOption(conversation, "I'm sorry it was all my fault.", "Choice2")
       AddConversationOption(conversation, "I don't have time for this.")

       -- set the npc dialog and start the conversation
       StartConversation(conversation, NPC, Spawn, "Why have you come to bother me " .. GetName(Spawn) .. "?")
    end

    -- This is the function called by the first choice
    function Choice1(NPC, Spawn)

       -- face the target
       FaceTarget(NPC, Spawn)

       -- need to create another conversation
       conversation = CreateConversation()

       -- add the player option
       AddConversationOption(conversation, "Good Bye for good this time.")

       -- set NPC dialog and start the conversation
       StartConversation(conversation, NPC, Spawn, "I'm going to kill you!")
       Attack(NPC, Spawn)
    end

    -- This is the function called by the second choice
    function Choice2(NPC, Spawn)

       -- face the target
       FaceTarget(NPC, Spawn)

       -- need to create another conversation
       conversation = CreateConversation()

       --set the 2 player options
       AddConversationOption(conversation, "As a guy it is always my fault regardless if it is true or not. Good Bye.","Choice3")
       AddConversationOption(conversation, "On second thought it IS your fault!","Choice4")       

       -- set NPC dialog and start the conversation
       StartConversation(conversation, NPC, Spawn, "So you admit it!")
    end


    -- This is the function called by the third choice
    function Choice3(NPC, Spawn)

       -- face the target
       FaceTarget(NPC, Spawn)

       -- need to create another conversation
       conversation = CreateConversation()

       -- add the player option
       AddConversationOption(conversation, "Good Bye for good this time.")
    end


    -- This is the function called by the fourth choice
    function Choice4(NPC, Spawn)

       -- face the target
       FaceTarget(NPC, Spawn)
       
       -- need to create another conversation
       conversation = CreateConversation()

       -- set NPC dialog and start the conversation
       StartConversation(conversation, NPC, Spawn, "I'm going to kill you!")
       
       Attack(NPC, Spawn)
     end
Started working with /spawn equipment command. trying to put item number 135696 from the items table into slot 3 which I figured out was legs. /spawn equipment 3 135696 225 255 255 255 255 255 not wanting to mess with colors now I left them 255. Seems that turns into a giant tombstone tho. I'm guessing something simple I overlooked being tired. I was about to look if there was a way to set the appearance with a .lua script but its 2:40am and I am about to pass out. Still from knowing nothing to killing my Ex a ton, was not a bad day.

Re: The ex-girlfriend motivation (/spawn)

Posted: Mon Jul 13, 2015 12:41 am
by Jabantiz
Grats on making your first script!


I am a bit rusty with the /spawn equipment command but I believe it takes a model id and not an item id. Looking in `item_appearances` table for the item id you provided I got 5821 so try

Code: Select all

/spawn equipment 7 5821 255 255 255 255 255 255
and let me know if it works. Also 7 is the slot id for legs.

Re: The ex-girlfriend motivation (/spawn)

Posted: Mon Jul 13, 2015 7:32 am
by Plague
Ahhh right there it is in the post. I guess I was just to tired last night to read it correctly. Every time I ask a question tho I get a handy reference list to bookmark too! Haha placing pants on the chest slot actually works... well mostly the ugly brown pants naked models wear were still visible. Think today I will mess with/learn the MovementLoopAddLocation then I can have spawns that move around instead of standing still. There are so many possible options in .lua. Maybe best if I just pick a zone and try to populate some of the mobs/NPC and figure out how to make them do what they do on live with the many options.

Re: The ex-girlfriend motivation (/spawn)

Posted: Mon Jul 13, 2015 5:27 pm
by Jabantiz
Our lua allows for a lot of customization, it is even possible to override the NPC's AI with a lua script, I found it best to just play around and see what I could come up with.

We would also welcome the help if you want to populate a zone like live and script it on the emu server, let Cynnar or me know if you are interested in that.

Re: The ex-girlfriend motivation (/spawn)

Posted: Tue Jul 14, 2015 11:09 am
by Cynnar
There is a movement loop generator to help create movement. I have not used it yet. There is also a movement script in your World/SpawnScripts/Generic think the name is something like movement_circle or something along those lines.