Can ghosts use objects with JS scripts?

Need help with your JScripts? Got questions concerning the DFNs? Come forward, step inside :)
Post Reply
stranf
UOX3 Guru
Posts: 939
Joined: Wed Jan 04, 2006 3:59 pm
Has thanked: 0
Been thanked: 0

Can ghosts use objects with JS scripts?

Post by stranf »

I want to start working on an alternate ressurection script but it is going to need to have ghosts be able to use objects.

Generally when you click on something it says "you can't use that you are dead"; which is fine for most cases.

What I want to do, is say, have the PC die like he usually does but if he double clicks on his ressurect robe it takes him to an alternate location.

So I will need a script that basically follows this outline:

Code: Select all

  onUsed(pUsed, iUsed)
{
 if PC.isDead()
   {
     Teleport(x,y,z);
    }



}

What I can't find is a function "isDead" or equivelant way of allowing UOx3 to fire the script on the res robe IF the PC is dead.
[/code]
Grimson
Developer
Posts: 802
Joined: Sat Jun 04, 2005 1:52 am
Location: Germany
Has thanked: 0
Been thanked: 0

Post by Grimson »

Take a close look at the character properties.
User avatar
Xuri
Site Admin
Posts: 3704
Joined: Mon Jun 02, 2003 9:11 am
Location: Norway
Has thanked: 48 times
Been thanked: 8 times
Contact:

Post by Xuri »

At the moment it's not possible to run onUse JS events for ghosts, since the source code does a "ItemIsUsable" check before getting that far, and returns false if your character is dead. :/

This, I believe, is done to avoid having to put pUser.isDead checks into every JS script that uses the onUse event, but in my opinion that would be preferable to not being able to override it at all.
-= Ho Eyo He Hum =-
stranf
UOX3 Guru
Posts: 939
Joined: Wed Jan 04, 2006 3:59 pm
Has thanked: 0
Been thanked: 0

Post by stranf »

At the moment it's not possible to run onUse JS events for ghosts, since the source code does a "ItemIsUsable" check before getting that far, and returns false if your character is dead. :/

This, I believe, is done to avoid having to put pUser.isDead checks into every JS script that uses the onUse event
Ah, this is what I assumed was happening. So there is no way to bypass this? The deathrobe idea would be ideal for RP purposes, but I came up with an alternative if onUsed would NEVER work with ghosts:

Can I make a gump that appears when you die and gives the PC two choices: 1) remain at current location as a ghost, or 2) be teleported to a designated location and be ressurected.

If the PC selects option 2 from the gump, then the JS engine teleports the PC and ressurects him. I have no problem with this, and the teleport function seems to work with ghosts (through the add menu).

But how would I code the firing of this gump? In the globalscript under onDeathblow, but just make sure the target is a PC? Would that mess up the current death script?
Post Reply