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

02-03-2013, 08:19 PM
|
Hill Giant
|
|
Join Date: Jul 2012
Posts: 212
|
|
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.
|

02-03-2013, 08:25 PM
|
Discordant
|
|
Join Date: Jan 2013
Posts: 284
|
|
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.
|

02-03-2013, 08:30 PM
|
Hill Giant
|
|
Join Date: Jul 2012
Posts: 212
|
|
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.
|

02-03-2013, 08:39 PM
|
 |
Dragon
|
|
Join Date: Dec 2009
Posts: 719
|
|
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;
|

02-03-2013, 08:57 PM
|
 |
Developer
|
|
Join Date: Mar 2003
Posts: 1,498
|
|
Did you check the animation field in spawn2?
|

02-03-2013, 09:29 PM
|
Hill Giant
|
|
Join Date: Jul 2012
Posts: 212
|
|
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.
|

02-03-2013, 09:44 PM
|
 |
Dragon
|
|
Join Date: Dec 2009
Posts: 719
|
|
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;
|

02-03-2013, 10:18 PM
|
Hill Giant
|
|
Join Date: Jul 2012
Posts: 212
|
|
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.
|

02-03-2013, 10:19 PM
|
Demi-God
|
|
Join Date: Aug 2010
Posts: 1,742
|
|
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;
}
|

02-03-2013, 11:46 PM
|
 |
Developer
|
|
Join Date: Mar 2003
Posts: 1,498
|
|
Quote:
Originally Posted by jdoran
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.
|

02-04-2013, 01:47 PM
|
Hill Giant
|
|
Join Date: Jul 2012
Posts: 212
|
|
Quote:
Originally Posted by lerxst2112
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.
|

02-04-2013, 03:47 PM
|
Hill Giant
|
|
Join Date: Jul 2012
Posts: 212
|
|
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.
|

02-04-2013, 04:12 PM
|
Demi-God
|
|
Join Date: Aug 2010
Posts: 1,742
|
|
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.
|

02-04-2013, 08:23 PM
|
Dragon
|
|
Join Date: May 2010
Posts: 965
|
|
Quote:
Originally Posted by lerxst2112
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.
|
Posting Rules
|
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
HTML code is Off
|
|
|
All times are GMT -4. The time now is 10:20 PM.
|
|
 |
|
 |
|
|
|
 |
|
 |
|
 |