Ghosties

Get Help on scripting in POL with configurations, config setups, script trouble shooting, etc.
Post Reply
runtest
Grandmaster Poster
Posts: 194
Joined: Sat Aug 05, 2006 11:43 am

Ghosties

Post 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?
User avatar
CWO
POL Expert
Posts: 1160
Joined: Sat Feb 04, 2006 5:49 pm

Post 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.
runtest
Grandmaster Poster
Posts: 194
Joined: Sat Aug 05, 2006 11:43 am

Post 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.
User avatar
CWO
POL Expert
Posts: 1160
Joined: Sat Feb 04, 2006 5:49 pm

Post 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.
runtest
Grandmaster Poster
Posts: 194
Joined: Sat Aug 05, 2006 11:43 am

Post 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?
User avatar
CWO
POL Expert
Posts: 1160
Joined: Sat Feb 04, 2006 5:49 pm

Post 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.
runtest
Grandmaster Poster
Posts: 194
Joined: Sat Aug 05, 2006 11:43 am

Post 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.
runtest
Grandmaster Poster
Posts: 194
Joined: Sat Aug 05, 2006 11:43 am

Post 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.
User avatar
CWO
POL Expert
Posts: 1160
Joined: Sat Feb 04, 2006 5:49 pm

Post 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.
runtest
Grandmaster Poster
Posts: 194
Joined: Sat Aug 05, 2006 11:43 am

Post 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.
Post Reply