Page 1 of 1

Ghosties

Posted: Thu Jul 31, 2008 6:20 pm
by runtest
What controls.

- Who and what can see players when they are dead.
- How to apply that to an NPC.

I am wanting to create ghost that can only be seen if you are dead or have spirit speak and that will attack players and drain their mana. I was going to rip the idea off the file that control player dead and just modify the hit script. What control the above mentioned to players?

Posted: Thu Jul 31, 2008 10:23 pm
by CWO
Not easily done if it can be done. Who/what can see players when dead? 'Seeghosts' privilege. Really, this is only useful on player chars like staff members.

NPCs can see ghosts with SYSEVENT_ENTEREDAREA or SYSEVENT_GHOST_SPEECH and ListGhostsNearLocation() or ListMobilesNearLocationEx() with the LISTEX_GHOSTS flag.

Posted: Fri Aug 01, 2008 4:09 am
by runtest
Really I just want to hide the creature to anyone who has a low level of spirit speak, is alive or is staff and have it hidden to anyone else.

Posted: Fri Aug 01, 2008 5:59 am
by CWO
The only way I can see doing this is actually screwing with cmdlevels. Conceal the mobile to 1 and then anyone with high enough spirit speak can be upped to cmdlevel = 1. Of course, you'd have to bump staff cmdlevels up 1 and search through all checks of cmdlevel in your scripts. Although I don't think you'd be able to hide it to someone that is dead without packethooks but this may cause some undesirable effects.

Posted: Fri Aug 01, 2008 11:00 am
by runtest
I love that idea. Heres what I will do. CWO you amaze me.

1. All players 0 unless 90% ss or dead then they are bumped to one. It will be a check, if they are under 90% and they are alive they will be 0. If they are dead or have 90% spirit speak they will be set to cmdlevel := 1. That is actually a nice way of doing this. Is there a good place to put this so it does not generate an enormous amount of lag?

Posted: Fri Aug 01, 2008 10:11 pm
by CWO
I would put it on death, login, and resurrection. It shouldn't lag really since its only a few instructions...

Code: Select all

if (!who.cmdlevel)
     if (GetAttribute(who, "spiritspeak") >= 90)
          who.cmdlevel := 1;
     endif
endif
Watch your counselor cmdlevel though as I said before. You'll probably want to bump it up one by defining a new cmdlevel in cmds.cfg and make sure you change all scripts that reference cmdlevel. And also since you defined a new cmdlevel, you can even make textcmds and such available only to those of that level.

Posted: Sat Aug 02, 2008 8:10 pm
by runtest
So it does the spirit speak check after they die, logout, logon. That shouldn't be to bad. I might have it do a check on spirit speak use to. Just for the over 90, so when they go over it takes care of it. Thanks allot. Thats allot easier than the way I was going about it.

Posted: Sun Aug 03, 2008 2:20 am
by runtest
Where is the Res function stored? When I get this done would you like me to post it in the Custom Scripts topic? Is Resurrect() a core function and ResNow() the actual check?

This is what I am doing at those checks. Its a bit redundant but it should work.

Code: Select all

	//start spirit check
	var ss := GetObjProperty(who, "spiritspeak");
	if(who.cmdlevel == 0)
		if(ss >= 90)
			who.cmdlevel := 1;
		endif
	endif

	if(who.cmdlevel == 1)
		if(ss <=89.9)
			who.cmdlevel := 0;
		endif
	endif
I prefer to If statements, it helps me keep it in some sort of order.

Posted: Sun Aug 03, 2008 6:47 am
by CWO
Resurrect(who, flags := 0) is a core function. Look for instances of Resurrect in your scripts. Also, to clean up your code a little...

Code: Select all

if (GetAttribute(who, "spiritspeak") >= 90)
     who.cmdlevel := 1;
else
     who.cmdlevel := 0;
endif
Remember to GetAttribute not GetObjProperty... a skill level isn't a custom prop.

Posted: Tue Aug 05, 2008 6:47 pm
by runtest
Like I said, I like my separate ifs. So :P, by the way, thanks for the help. Good one with that command level change.