Go Back   EQEmulator Home > EQEmulator Forums > Quests > Quests::Q&A

Quests::Q&A This is the quest support section

Reply
 
Thread Tools Display Modes
  #1  
Old 02-03-2013, 08:19 PM
jdoran
Hill Giant
 
Join Date: Jul 2012
Posts: 212
Default 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.
Reply With Quote
  #2  
Old 02-03-2013, 08:25 PM
Zamthos
Discordant
 
Join Date: Jan 2013
Posts: 284
Default

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");
	}
}

Last edited by Zamthos; 02-03-2013 at 08:30 PM.. Reason: Posted link to guide.
Reply With Quote
  #3  
Old 02-03-2013, 08:30 PM
jdoran
Hill Giant
 
Join Date: Jul 2012
Posts: 212
Default

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.
Reply With Quote
  #4  
Old 02-03-2013, 08:39 PM
c0ncrete's Avatar
c0ncrete
Dragon
 
Join Date: Dec 2009
Posts: 719
Default

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.
__________________
I muck about @ The Forge.
say(rand 99>49?'try '.('0x'.join '',map{unpack 'H*',chr rand 256}1..2):'incoherent nonsense')while our $Noport=1;
Reply With Quote
  #5  
Old 02-03-2013, 08:57 PM
joligario's Avatar
joligario
Developer
 
Join Date: Mar 2003
Posts: 1,498
Default

Did you check the animation field in spawn2?
Reply With Quote
  #6  
Old 02-03-2013, 09:29 PM
jdoran
Hill Giant
 
Join Date: Jul 2012
Posts: 212
Default

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.
Reply With Quote
  #7  
Old 02-03-2013, 09:44 PM
c0ncrete's Avatar
c0ncrete
Dragon
 
Join Date: Dec 2009
Posts: 719
Default

SetTargetable is defined in perl_mob.cpp.
__________________
I muck about @ The Forge.
say(rand 99>49?'try '.('0x'.join '',map{unpack 'H*',chr rand 256}1..2):'incoherent nonsense')while our $Noport=1;
Reply With Quote
  #8  
Old 02-03-2013, 10:18 PM
jdoran
Hill Giant
 
Join Date: Jul 2012
Posts: 212
Default

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.
Reply With Quote
  #9  
Old 02-03-2013, 10:19 PM
lerxst2112
Demi-God
 
Join Date: Aug 2010
Posts: 1,742
Default

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;
}
Reply With Quote
  #10  
Old 02-03-2013, 11:46 PM
joligario's Avatar
joligario
Developer
 
Join Date: Mar 2003
Posts: 1,498
Default

Quote:
Originally Posted by jdoran View Post
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.
Reply With Quote
  #11  
Old 02-04-2013, 01:47 PM
jdoran
Hill Giant
 
Join Date: Jul 2012
Posts: 212
Default

Quote:
Originally Posted by lerxst2112 View Post
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.
Reply With Quote
  #12  
Old 02-04-2013, 03:16 PM
lerxst2112
Demi-God
 
Join Date: Aug 2010
Posts: 1,742
Default

https://projecteqemu.googlecode.com/svn is the correct repository. Make sure you are using the trunk and not some random branch.
Reply With Quote
  #13  
Old 02-04-2013, 03:47 PM
jdoran
Hill Giant
 
Join Date: Jul 2012
Posts: 212
Default

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.
Reply With Quote
  #14  
Old 02-04-2013, 04:12 PM
lerxst2112
Demi-God
 
Join Date: Aug 2010
Posts: 1,742
Default

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.
Reply With Quote
  #15  
Old 02-04-2013, 08:23 PM
sorvani
Dragon
 
Join Date: May 2010
Posts: 965
Default

Quote:
Originally Posted by lerxst2112 View Post
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.
Reply With Quote
Reply

Thread Tools
Display Modes

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

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

   

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


 

Everquest is a registered trademark of Daybreak Game Company LLC.
EQEmulator is not associated or affiliated in any way with Daybreak Game Company LLC.
Except where otherwise noted, this site is licensed under a Creative Commons License.
       
Powered by vBulletin®, Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Template by Bluepearl Design and vBulletin Templates - Ver3.3