Batmanis64 wrote...
Interesting idea, but what if the player wants to actually rest when near a chest?
Do you know which XML file deals with the highlighting of usable objects? I could simply turn it off by editing that file like I did with the spell selection GUI, and then have the custom spell perform a special effect over usables for a temporary period of time.
Hi Batmanis64,
If you make the check range < 2.0 (experiment with best distance), then resting can take place about one step away from and without actually interacting with the chest.
Hilighting is not really required, unless you want to add more scripts (triggers etc.) to enable this. The reason being, the moment the PC is next to the chest you wish to interact with, you simply use a GetNearestObjectByTag to acquire the chest you are near to interact with when the XML related hotkey is pressed.
Any button that has an editable XML file can do what you want. Those I can think off the top of my head are:
R- Rest
I - Inventory
M - Area Map
N - Mini Map
All these buttons fire off a related XML file, which you can edit to fire its own
gui_script script, which can be made to check its vicinity to a chest prior to carrying out its default function. The easiest to work with would be the R (rest) as this has some scripts that are checked
prior to opening the GUI, which means you definitely could use it to do something other than rest, without even seeing the GUI as well. (I did something similar in my NWN1 module, Soul Shaker.)
REST BUTTON
===========
If you then alter the module's On Rest to intercept the call to rest, you can have it fire your own code subject to conditions you write in the On Rest script.
Pseudo Code ..... Module's On Rest
object oChest = GetNearestObjectByTag("ChestToOpen");
if(GetDistanceToObject(oChest) < 3.0){ Run chest code ... cast spell or whatever}
else{ Run resting code.}
I am sure there are a number of other checks you could add as well if you like. There is nothing to stop you from even offering the player a choice of what they intended to do if they select R while sitting on top of a chest, but you think they may be wanting to rest. However, I think if the player is made aware that the R button can be used to interact with chests if they stand next to them (within 3.0), but rest when not next to one (> 3.0).
Lance.
Modifié par Lance Botelle, 21 mars 2011 - 11:31 .