Aller au contenu

Photo

Enhanced Vision (Darkvision/Low Light Vision): Is there a way to enable it via script for the PC? (COMPLETED)


  • Veuillez vous connecter pour répondre
47 réponses à ce sujet

#1
Lance Botelle

Lance Botelle
  • Members
  • 1 480 messages
Hi All,

The title says it all really: Is there a way to switch on "Enhanced Vision" for a player's PC via script?

e.g. A PC walks into a pitch black cave, and so the code activates enhanced vision for the player's PC in question.

Many Thanks,
Lance.

Modifié par Lance Botelle, 16 février 2013 - 10:10 .


#2
Lugaid of the Red Stripes

Lugaid of the Red Stripes
  • Members
  • 955 messages
You can add the feat via script, and there's also a VFX you can apply via script. I'm not actually sure if the feat does anything besides apply the VFX.

#3
Lance Botelle

Lance Botelle
  • Members
  • 1 480 messages

Lugaid of the Red Stripes wrote...

You can add the feat via script, and there's also a VFX you can apply via script. I'm not actually sure if the feat does anything besides apply the VFX.


Hi LotRS,

The PC already has the feat (and confirmed as present with debug text). However, I seem unable to "activate" the feat or "use" the feat on the player's behalf. "ActionUseFeat" is for NPCs only. :(

I did not want to use a VFX if I can help it, as I wanted the player to recognise that it is their PCs feat that is being used, and if really required, turn it off via the button again.

Any other ideas?

Lance.

#4
Lugaid of the Red Stripes

Lugaid of the Red Stripes
  • Members
  • 955 messages
SetActionMode

#5
kamal_

kamal_
  • Members
  • 5 238 messages
Lugiad already beat me to it with SetActionMode. I've used that to force characters into stealth.

#6
Lance Botelle

Lance Botelle
  • Members
  • 1 480 messages

Lugaid of the Red Stripes wrote...

SetActionMode


Hi LotRS,

I will try that next time I open the toolset. :)

Cheers!

Lance.

#7
Lance Botelle

Lance Botelle
  • Members
  • 1 480 messages

kamal_ wrote...

Lugiad already beat me to it with SetActionMode. I've used that to force characters into stealth.



Hi Kamal,

Thanks for the confirmation. I will try this later then.

Also, was it you who wanted to rewrite the "pick pocket" system if I recall correctly? I may have found a way for you to intercept the pick-pocket code ... let me know if you want me to look into that more or not.

Thanks,
Lance.

#8
kamal_

kamal_
  • Members
  • 5 238 messages
When I looked into it, it seemed you can have code run on failed pp attempts, but not successful ones. You can force a failed attempt via giving the target a super high spot score, but that interferes with other things, and "looks bad" since the player always gets the failure message.

#9
Lance Botelle

Lance Botelle
  • Members
  • 1 480 messages

kamal_ wrote...

When I looked into it, it seemed you can have code run on failed pp attempts, but not successful ones. You can force a failed attempt via giving the target a super high spot score, but that interferes with other things, and "looks bad" since the player always gets the failure message.



Hi Kamal,

It may be possible to update an XML script to send back the "target object" of the PC's pickpocket and for you to completely rewrite the entire pickpocket code! I managed to work out how to get an object from an XML script when trying to fix the Stack Split problem: http://social.biowar.../index/15844304

Let me try to track down the XML script involved and see if it possible. Alternatively, take a look at what I did in the post above and see if you can work with it as well.

I will test out the SetActionMode for my current problem first though. Posted Image

Cheers!
Lance.

Modifié par Lance Botelle, 10 février 2013 - 06:41 .


#10
Lance Botelle

Lance Botelle
  • Members
  • 1 480 messages
Hi All,
OK, I checked the SetActionMode, but I cannot see an appropriate "vision" action to set. Posted Image

Therefore, I don't think this is the appropriate function ... unless somebody can give me the full blown scripting line?

EDIT: Ha! I just did another search and found a post I did not find before: http://social.biowar...4/index/5376640
The irony is, I even posted in that post! So much for my own vision! Posted Image That makes reference to an Action Mode that I was not aware of: 24 = Nightvision apparently. So, I will try with that.

EDIT 2: Sadly, I could not get this Nightvision (24) to turn on either. Posted Image I will keep investigating, but if anybody else has any ideas, please let me know. (GetActionMode *does* detect if Darkvision is or is not activated, but I cannot use SetActionMode to enable or disable it.)

Thanks.
Lance.

Modifié par Lance Botelle, 10 février 2013 - 07:27 .


#11
Dann-J

Dann-J
  • Members
  • 3 161 messages
Action modes can be tricky, since the 2DA that holds their constants is incomplete, and corrupted by a comment.
http://social.biowar...4/index/9951825 

I was initially unable to tell whether tracking mode was on or off, but once I rebuilt the 2DA with the missing line numbers, it started to work. If nightvision is supposed to be line 24, then you'd have to fix the 2DA and add in all the missing lines down to at least 24.

Modifié par DannJ, 10 février 2013 - 10:06 .


#12
Lance Botelle

Lance Botelle
  • Members
  • 1 480 messages

DannJ wrote...

Action modes can be tricky, since the 2DA that holds their constants is incomplete, and corrupted by a comment.
http://social.biowar...4/index/9951825 

I was initially unable to tell whether tracking mode was on or off, but once I rebuilt the 2DA with the missing line numbers, it started to work. If nightvision is supposed to be line 24, then you'd have to fix the 2DA and add in all the missing lines down to at least 24.



Hi DannJ,

Thanks for this info, I will look into it straight away.

I did try looking for the 2da that might be involved, but could not find it. The corrupt data in it may also explain why my "Text" search for anything to do with vision also failed.

By the way, do you have a correctly edited 2da version already? If so, can you send me a copy, in case I do something worng? I will still try to edit/fix the 2da anyway, but I'd rather have one that I know somebody has fixed and tested 100% already. :)

Many Thanks,
Lance.

#13
Lance Botelle

Lance Botelle
  • Members
  • 1 480 messages
Hi All,

Well, I "fixed" the combatmodes.2da, but I still am not able to use SetActionMode to enable the Nightvision.

Here is my "fixed" 2da ... look ok?

Lance.

200x100http://www.mediafire.com/conv/924bee189c77d5750d93d0f98b092ba4719b8066ca424f128e5c111cfd9048c86g.jpg[/img]

Modifié par Lance Botelle, 11 février 2013 - 05:09 .


#14
Dann-J

Dann-J
  • Members
  • 3 161 messages
The first column in most 2DAs seems to be for viewing purposes only. You might have to fill in the correct string refs to get it to work. Also keep in mind that there are two feats in question: darkvision and low-light vision. Although since they use the same combat mode button (no creature has both feats), they might both be covered by the same 2DA entry.

Possibilities are:

1493 (DarkVision)
1962 (DarkVision)
5493 (DarkVision)
6331 (Ultravision)
13563 (DarkVision)
58580 (Ultravision)
111527 (Low Light Vision)
112017 (Low Light Vision)

If, on the other hand, the first column in this 2DA actually *does* do something game-wise, then the name of the text in the CombatMode column might not be 'NightVision'. It could be 'DarkVision', 'LowLightVision', 'UltraVision', or something else entirely. I may have got lucky with the tracking entry, since 'Tracking' was the most obvious choice and seemed to work first-time.

#15
Lance Botelle

Lance Botelle
  • Members
  • 1 480 messages

DannJ wrote...

The first column in most 2DAs seems to be for viewing purposes only. You might have to fill in the correct string refs to get it to work. Also keep in mind that there are two feats in question: darkvision and low-light vision. Although since they use the same combat mode button (no creature has both feats), they might both be covered by the same 2DA entry.

Possibilities are:

1493 (DarkVision)
1962 (DarkVision)
5493 (DarkVision)
6331 (Ultravision)
13563 (DarkVision)
58580 (Ultravision)
111527 (Low Light Vision)
112017 (Low Light Vision)

If, on the other hand, the first column in this 2DA actually *does* do something game-wise, then the name of the text in the CombatMode column might not be 'NightVision'. It could be 'DarkVision', 'LowLightVision', 'UltraVision', or something else entirely. I may have got lucky with the tracking entry, since 'Tracking' was the most obvious choice and seemed to work first-time.


Hi DannJ,

I was working on the information I found in this post: http://social.biowar...4/index/5376640

Check out the fourth post down by Pain. (Actually, I wil copy and paste Pain's info further below.)

Also, I can confirm that "Nightvision" does work when debug tested with the GetActionMode. It's just the SetActionMode part that I cannot get to work.

Lance.

QUOTE:

This returns a string describing mode
/** 
* Description
* @author
* @param 
* @see 
* @return 
*/
string CSLTargetActionModeToString( object oTarget )
{
string sMessage = "";
if ( GetActionMode(oTarget, 0) ) { sMessage += "Detect, "; } // Known
if ( GetActionMode(oTarget, 1) ) { sMessage += "Stealth, "; } // Known
if ( GetActionMode(oTarget, 2) ) { sMessage += "Parry, "; } // Known
if ( GetActionMode(oTarget, 3) ) { sMessage += "Power Attack, "; } // Known
if ( GetActionMode(oTarget, 4) ) { sMessage += "Improved Power Attack, "; } // Known
if ( GetActionMode(oTarget, 5) ) { sMessage += "Counter Spell, "; } // Known
if ( GetActionMode(oTarget, 6) ) { sMessage += "Flurry of Blows, "; } // Known
if ( GetActionMode(oTarget, 7) ) { sMessage += "Rapid Shot, "; } // Known
if ( GetActionMode(oTarget, 8) ) { sMessage += "Combat Expertise, "; } // Known
if ( GetActionMode(oTarget, 9) ) { sMessage += "Improved Combat Expertise, "; } // Known
if ( GetActionMode(oTarget, 10) ) { sMessage += "Defensive Casting, "; } // Known
if ( GetActionMode(oTarget, 11) ) { sMessage += "Dirty Fighting, "; } // Known
if ( GetActionMode(oTarget, 12) ) { sMessage += "Defensive Stance, "; } // need to verify
if ( GetActionMode(oTarget, 13) ) { sMessage += "Taunt, "; } // need to verify
if ( GetActionMode(oTarget, 14) ) { sMessage += "Tracking, "; } // Known
if ( GetActionMode(oTarget, 15) ) { sMessage += "Inspire Courage, "; } // need to verify
if ( GetActionMode(oTarget, 16) ) { sMessage += "Inspire Competance, "; } // need to verify
if ( GetActionMode(oTarget, 17) ) { sMessage += "Inspire Defense, "; } // need to verify
if ( GetActionMode(oTarget, 18) ) { sMessage += "Regeneration, "; } // need to verify
if ( GetActionMode(oTarget, 19) ) { sMessage += "Tougness, "; } // need to verify
if ( GetActionMode(oTarget, 20) ) { sMessage += "Slowing, "; } // need to verify
if ( GetActionMode(oTarget, 21) ) { sMessage += "Jarring, "; } // need to verify
if ( GetActionMode(oTarget, 22) ) { sMessage += "MISSING 22, "; } // not even a guess
if ( GetActionMode(oTarget, 23) ) { sMessage += "Rescue, "; } // need to verify
if ( GetActionMode(oTarget, 24) ) { sMessage += "NightVision, "; } // need to verify
if ( GetActionMode(oTarget, 25) ) { sMessage += "Hellfire Blast, "; } // Known
if ( GetActionMode(oTarget, 26) ) { sMessage += "Hellfire Shield, "; } // Known
if ( GetActionMode(oTarget, 27) ) { sMessage += "Swimming, "; } // This i am trying to add
if ( GetActionMode(oTarget, 28) ) { sMessage += "Levitating, "; } // This i am trying to add
if ( GetActionMode(oTarget, 29) ) { sMessage += "Flying, "; } // This i am trying to add
if ( GetActionMode(oTarget, 30) ) { sMessage += "MISSING 30, "; }
if ( GetActionMode(oTarget, 31) ) { sMessage += "MISSING 31, "; }

if ( sMessage != "" )
{
return GetStringLeft(sMessage, GetStringLength(sMessage)-2);
}
return "";
}

Modifié par Lance Botelle, 11 février 2013 - 10:39 .


#16
Dann-J

Dann-J
  • Members
  • 3 161 messages
Ah. I was only using GetActionMode in my case. Again, it seems like I got lucky with tracking.

#17
kamal_

kamal_
  • Members
  • 5 238 messages
How about if you force the spell on them? wiki indicates it's bugged so you may have to give them the darkvision feat temporarily as well.

#18
Lance Botelle

Lance Botelle
  • Members
  • 1 480 messages

kamal_ wrote...

How about if you force the spell on them? wiki indicates it's bugged so you may have to give them the darkvision feat temporarily as well.


Hi Kamal,

I was hoping to simply tie the action into what the PC can do anway. However, if I give them a temporary spell effect, I also need to be able to (somehow) remove the effect when they switch their "Enhanced Vision" state (which would also be in the wrong state), so that the player can remove the state if they wish.

I cannot find which XML file works the MODES button, which contains the Enhanced Vision. Is that XML file even available to us?

Cheers,
Lance.

#19
kevL

kevL
  • Members
  • 4 052 messages
testresult: i can GetActionMode #24 but i can't SetActionMode #24 ( oPC = OBJECT_SELF )


modebar.xml

w/ prototype buttons and hard-coded UI functions ........


uhm Lance? why do you want to turn the PC nightvision on/off... ? is this for, like, a tutorial

#20
Dann-J

Dann-J
  • Members
  • 3 161 messages
I much prefered the 'infravision' in Baldur's Gate, that automatically turned on in dark conditions. It should really be an ability that is in constant effect, rather than something that needs to be turned on and off. Determining when a particular area is dark enough to warrant the effect might be tricky though (short of manually adding local variables to all dark areas, or creating lots of triggers).

"Even with infravision, I prefer the daylight"
-- Khalid (at night)

#21
Lance Botelle

Lance Botelle
  • Members
  • 1 480 messages

kevL wrote...

testresult: i can GetActionMode #24 but i can't SetActionMode #24 ( oPC = OBJECT_SELF )


modebar.xml

w/ prototype buttons and hard-coded UI functions ........


uhm Lance? why do you want to turn the PC nightvision on/off... ? is this for, like, a tutorial


Hi KevL,

I did see modebar.xml, but it did not contain anything I recognised that would allow me to work with the individual buttons, which (as you say) suggested it was hardcoded.

The reason why was simply to allow a "natural" response when a PC entered a dark cave ... i.e. One that was pitch black. At the moment, when a PC arrives in such an area, the player sees nothing .... I wanted to "switch on" the natural ability of any form of night vision if the PC entered such an area. For the time being, I have got around the problem by simply having the PC equip a light source if they carry one in their group of PCs. (NB: I do not say party, because I am programming for MP game, it means each player checks their own group of PCs when they enter an area. This uses some of my unique code that separates each individual player's PCs in a MP game.)

See next ...

DannJ wrote ....

I much prefered the 'infravision' in Baldur's Gate, that automatically turned on in dark conditions. It should really be an ability that is in constant effect, rather than something that needs to be turned on and off. Determining when a particular area is dark enough to warrant the effect might be tricky though (short of manually adding local variables to all dark areas, or creating lots of triggers).

"Even with infravision, I prefer the daylight"
-- Khalid (at night)


Hi DannJ,

That was my goal ... to automatically start a night vision in a very dark area .. but also allow it to be in the control of the player to remove again via their unique mode button. I have added variables to each area that I believe is "pitch black" and requires either a form of night vision or a source of light. I was going to "equip" both according to the skill of the PC, but have had to opt out of automatic night vision due to not being able to access t via code. Posted Image

Lance.

Modifié par Lance Botelle, 13 février 2013 - 12:35 .


#22
kevL

kevL
  • Members
  • 4 052 messages
makes sense ...

then how 'bout adding just a little dim lightstone to the entry area, and perhaps a line of chat that brings mention of how dark it is?


personally i get a *bit* peeved when DMs equip and unequip my gear, or hypothetically toggle my Modes :)

#23
Lance Botelle

Lance Botelle
  • Members
  • 1 480 messages

kevL wrote...

makes sense ...

then how 'bout adding just a little dim lightstone to the entry area, and perhaps a line of chat that brings mention of how dark it is?


personally i get a *bit* peeved when DMs equip and unequip my gear, or hypothetically toggle my Modes :)


Hi KevL,

I did consider a "dim light stone", but it would not make any sense in the environment in question.
Trust me, a player definitely would want to equip a light source or turn on night vision in these cases. :innocent: It just saves them the step of doing it, and enables the player to immediately see what is going on around them ... well, almost immediately. They can quickly unequip the item (or switch off night vision ... if I had managed to do it), with no detrimental effect.

Cheers,
Lance.

Modifié par Lance Botelle, 13 février 2013 - 07:38 .


#24
kevL

kevL
  • Members
  • 4 052 messages
well, the possible issue i see is ... what if their offhand (torch-hand) item is granting a Prime Ability bonus for a caster ( say +Wis for Cleric ), suddenly they're gonna lose a few memorized spellslots, no?

#25
kamal_

kamal_
  • Members
  • 5 238 messages

Lance Botelle wrote...
Trust me, a player definitely would want to equip a light source or turn on night vision in these cases. :innocent:

In Path of Evil I had absolute pitch black areas with no lights anywhere, no one complained.

Given the amount of difficulty in implementing this, it seems like it's not really worth the trade in effort versus effect. It sounds like you've done the background work, area variables and having OnEnter scripts and such, so I would leave it out for now so it doesn't stop development. It could always be added later since the background stuff is in place and the only thing that would need to be done is updating of scripts, which can be done via a patch hak at any point.

With good project management, at some point, you have to know when something just isn't working and let it go so the project as a whole can get done.