EQEmulator Forums

EQEmulator Forums (https://www.eqemulator.org/forums/index.php)
-   Quests::Q&A (https://www.eqemulator.org/forums/forumdisplay.php?f=599)
-   -   NPC default appearance (https://www.eqemulator.org/forums/showthread.php?t=36405)

jdoran 02-03-2013 08:19 PM

NPC default appearance
 
This seems like a trivial question, but I haven't found the answer yet. I would like to create a (lootable) dead body, and would like to set the default appearance for the NPC if possible.

Now I could do this in Perl with setanim(3), but I'm betting this information is stored somewhere in the database. The animation field in the spawn2 table doesn't seem to do the trick (mob stands there, tried 3 and 16 as the animation value).

If NPC appearance is in the database, I would very much like to know where.

Zamthos 02-03-2013 08:25 PM

Do you just want it to lay there like a trampled slave? If so, code below:

Link to guide here: NPC Appearances

Code:

sub EVENT_SPAWN
{
        quest::settimer("dead",1);
}

sub EVENT_TIMER
{
        if($timer = "dead")
        {
                $npc->SetAppearance(3);
                quest::stoptimer("dead");
        }
}


jdoran 02-03-2013 08:30 PM

Thanks, but I'm wondering if there is a way to set this in the database. I have a Perl solution already, I just don't want to create Perl scripts for a bunch of new mobs just so they can be dead.

A lot of appearance-related information is already kept, I am figuring this must be as well.

c0ncrete 02-03-2013 08:39 PM

i don't think it's stored in the database anywhere. otherwise, there wouldn't be scripts that set appearance periodically like in tutorialb.

(maybe this would be something that lua would be ideal for?)

regardless, you don't have to set individual scripts for every npc you want to change appearance like this. just use the zone's default.pl or the global_npc.pl in the templates folder.

joligario 02-03-2013 08:57 PM

Did you check the animation field in spawn2?

jdoran 02-03-2013 09:29 PM

animation in spawn2 mentioned in original post, had no effect. (Server was restarted between changes -- so new shared memory region created)

I'll look into the defaults, but worry that I'm going to mess things up.

One odd feature (to me) of SetAppearance is that an untargetable mob (bodytype=11) does not appear to do anything when the appearance is set to dead. Changing the bodytype to normal restores the death animation. This does get in the way of creating untargetable corpses. (I guess I don't really *Need* this, but having corpses with full HP bars just seems wrong)

The wiki mentions $npc->SetTargetable, but this is not in any of the Perl XS stuff for the zone. So much for killing the mob then changing its targetability.

And I was hoping this would be easy.

I'll see if I can find corpse expiration code somewhere, maybe I can create a real corpse that doesn't expire.

c0ncrete 02-03-2013 09:44 PM

SetTargetable is defined in perl_mob.cpp.

jdoran 02-03-2013 10:18 PM

Not in my source tree, and "svn diff" shows that I am up to date.
(I did an svn diff of everything in zone, just in case someone checked in something since my last merge).

Perhaps you meant SetTarget which is different.

lerxst2112 02-03-2013 10:19 PM

perl_mob.cpp, line 7592
Code:

XS(XS_Mob_SetTargetable); /* prototype to pass -Wmissing-prototypes */
XS(XS_Mob_SetTargetable)
{
        dXSARGS;
        if (items != 2)
                Perl_croak(aTHX_ "Usage: Mob::SetTargetable(THIS, on)");
        {
                Mob *                THIS;
                bool on = (bool)SvTRUE(ST(1));

                if (sv_derived_from(ST(0), "Mob")) {
                        IV tmp = SvIV((SV*)SvRV(ST(0)));
                        THIS = INT2PTR(Mob *,tmp);
                }
                else
                        Perl_croak(aTHX_ "THIS is not of type Mob");
                if(THIS == NULL)
                        Perl_croak(aTHX_ "THIS is NULL, avoiding crash.");

                THIS->SetTargetable(on);
        }
        XSRETURN_EMPTY;
}


joligario 02-03-2013 11:46 PM

Quote:

Originally Posted by jdoran (Post 217600)
animation in spawn2 mentioned in original post, had no effect.

Sorry, my response was incomplete. I meant to check that you got the right value in spawn2.

jdoran 02-04-2013 01:47 PM

Quote:

Originally Posted by lerxst2112 (Post 217608)
perl_mob.cpp, line 7592
Code:

XS(XS_Mob_SetTargetable); /* prototype to pass -Wmissing-prototypes */

etc.


This is troublesome. My copy does not include this, so I am not running the same source as everyone else. Looking at the svn files, I see that the repository I am using is projecteqemu.googlecode.com. I'll look into what it will take to migrate to the proper repository.

(This also explains why the wiki and the source did not always agree)

Sorry for the confusion, but thanks for helping me clear this up.

lerxst2112 02-04-2013 03:16 PM

https://projecteqemu.googlecode.com/svn is the correct repository. Make sure you are using the trunk and not some random branch.

jdoran 02-04-2013 03:47 PM

Ugh that's even worse news... I thought I had an explanation.

From "svn info"

URL: http://projecteqemu.googlecode.com/s...EmuServer/zone
Repository Root: http://projecteqemu.googlecode.com/svn
Repository UUID: 1db01234-8a6e-11dd-8937-b3a01dae0fbe

Browsing the repository via the web shows the code is not in sync.
"svn diff" lists nothing for perl_mob.cpp, but does show my changes in
other files.

I guess I should just check out a clean copy and merge my changes by hand. I've never seen svn do anything like this, but I'm not sure I want to dig into it too far.

lerxst2112 02-04-2013 04:12 PM

Unless I'm mistaken, `svn diff` shows what's different between your local repository and the remote repository at whatever revision you last updated to.

You need to use `svn update` to actually update to the latest revision.

You may simply have old code since you haven't updated.

sorvani 02-04-2013 08:23 PM

Quote:

Originally Posted by lerxst2112 (Post 217674)
Unless I'm mistaken, `svn diff` shows what's different between your local repository and the remote repository at whatever revision you last updated to.

You need to use `svn update` to actually update to the latest revision.

You may simply have old code since you haven't updated.

This is the correct answer.


All times are GMT -4. The time now is 11:36 AM.

Powered by vBulletin®, Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.