Aller au contenu

Photo

Is it possible...?


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

#1
JediMindTrix

JediMindTrix
  • Members
  • 283 messages
...to check to see if a PC has a spell (I have Knock in mind) memorized in their spellbook and use it in a Text Appears When conditional?

EDIT: Forgot to ask, also is there a thread on the forums or a tutorial anywhere that would help me figure out how to use DC's in scripts that are designed to make skill or ability checks. I want specific control of these DC's, otherwise I'd be using the standard NWN difficulty checks.

Thank you in advance!

Modifié par NineCoronas2021, 20 mai 2012 - 03:06 .


#2
Lightfoot8

Lightfoot8
  • Members
  • 2 535 messages
Function - GetHasSpell

#3
JediMindTrix

JediMindTrix
  • Members
  • 283 messages
Thank you Lightfoot!

Modifié par NineCoronas2021, 20 mai 2012 - 05:50 .


#4
Lightfoot8

Lightfoot8
  • Members
  • 2 535 messages
In fact the starting condition for the knock spell is already a bioware standard script.

x0_d2_hasknock

EDIT:  In fact all of the scripts in the toolset that have  *_d2_*  in the middle of them are starting conditions.  A lot of the time you can find what you are looking for by looking through them.

Modifié par Lightfoot8, 20 mai 2012 - 06:00 .


#5
JediMindTrix

JediMindTrix
  • Members
  • 283 messages
Okay, I am trying to write a Text Appears When script that would allow me to perform Ability checks while setting the DC's on local variable's stored on the object that begins the conversation. I've figured out a bit of it on my own, but now I'm at a loss.

int StartingConditional()
{
object oPC = GetPCSpeaker();

int iDexCheck = d20(1) + GetAbilityModifier(ABILITY_DEXTERITY, oPC);
int iStrCheck = d20(1) + GetAbilityModifier(ABILITY_STRENGTH, oPC);
int iConCheck = d20(1) + GetAbilityModifier(ABILITY_CONSTITUTION);
int iWisCheck = d20(1) + GetAbilityModifier(ABILITY_WISDOM);
int iIntCheck = d20(1) + GetAbilityModifier(ABILITY_INTELLIGENCE);
int iChaCheck = d20(1) + GetAbilityModifier(ABILITY_CHARISMA);

//Checks the object for local variables placed on it defining the DC of the ability roll
int iDexDC = GetLocalInt(OBJECT_SELF, "DexDC");
int iStrDC = GetLocalInt(OBJECT_SELF, "StrDC");
int iConDC = GetLocalInt(OBJECT_SELF, "ConDC");
int iWisDC = GetLocalInt(OBJECT_SELF, "WisDC");
int iIntDC = GetLocalInt(OBJECT_SELF, "IntDC");
int iChaDC = GetLocalInt(OBJECT_SELF, "ChaDC");

//Allows for a second of the same type of DC check
int iDexDCa = GetLocalInt(OBJECT_SELF, "DexDCa");
int iStrDCa = GetLocalInt(OBJECT_SELF, "StrDCa");
int iConDCa = GetLocalInt(OBJECT_SELF, "ConDCa");
int iWisDCa = GetLocalInt(OBJECT_SELF, "WisDCa");
int iIntDCa = GetLocalInt(OBJECT_SELF, "IntDCa");
int iChaDCa = GetLocalInt(OBJECT_SELF, "ChaDCa");

//Allows for a third of the same type of DC check
int iDexDCb = GetLocalInt(OBJECT_SELF, "DexDCb");
int iStrDCb = GetLocalInt(OBJECT_SELF, "StrDCb");
int iConDCb = GetLocalInt(OBJECT_SELF, "ConDCb");
int iWisDCb = GetLocalInt(OBJECT_SELF, "WisDCb");
int iIntDCb = GetLocalInt(OBJECT_SELF, "IntDCb");
int iChaDCb = GetLocalInt(OBJECT_SELF, "ChaDCb");

//TextAppearsWhen Conditionals:
if (iDexCheck =< iDexDC);
}


I honestly have no idea what I am doing now; does anyone know how I would go about achieving my goal from here? (Am currently getting an unknown compiler state from the 'if' line, not really surprising, expect more <.<)

#6
The Amethyst Dragon

The Amethyst Dragon
  • Members
  • 1 880 messages
In your "if" line, change "=<" to "<=". :)

and you need the ", oPC" in your other GetAbilityModifier calls.


As far as the rest of the script, it just depends on what checks you want to make.  That'll determine what code you need.

Things to consider:
What checks do you want done?
Do you want PCs to see the mechanics (rolls, results, etc.)?
Do you want to make standard skill checks, but with the DC controlled by variables?

Modifié par The Amethyst Dragon, 20 mai 2012 - 07:50 .


#7
JediMindTrix

JediMindTrix
  • Members
  • 283 messages
I blame sleep deprivation on those errors at the top of the script <.<

Well,
I want to make Ability Score checks, and later standard skill checks, with the DC controlled by variables stored on the placeable the conversation is attached too.
I want to be able to use one script for all of these checks so I don't have to clutter up my SP module.

Is this possible?
If the script ends up looking like this at the end:

if (iDexCheck <= iDexDC) return FALSE;
if (iDexCheck <= iDexDCa) return FALSE;
if (iDexCheck <= iDexDCb) return FALSE;

if (iStrCheck <= iStrDC) return FALSE;
if (iStrCheck <= iStrDCa) return FALSE;
if (iStrCheck <= iStrDCb) return FALSE;

return TRUE;


If one of those "If" statements are met, will it show the text, or will the script be requiring all of those to "If" conditions to be met?

#8
ShadowM

ShadowM
  • Members
  • 768 messages
Something like this?


int AbilityCheck(object oPC,int iAbility, int iDC)
{
int iABResult =FALSE;
int iRoll = d20(1);
int iAb_mod =GetAbilityModifier(iAbility,oPC);
int iResult = iRoll+iAb_mod;
if(iResult>=iDC)iABResult=TRUE;

return iABResult;
}


/*
int ABILITY_STRENGTH = 0; // should be the same as in nwseffectlist.cpp
int ABILITY_DEXTERITY = 1;
int ABILITY_CONSTITUTION = 2;
int ABILITY_INTELLIGENCE = 3;
int ABILITY_WISDOM = 4;
int ABILITY_CHARISMA = 5;

Use these for variable type
*/

int StartingConditional()
{
int iResult;
int iAb_type = GetLocalInt(OBJECT_SELF,"AbilityCheckTyp");
//Fix for 0
if(iAb_type==-1)iAb_type=ABILITY_STRENGTH;
int iDC = GetLocalInt(OBJECT_SELF,"AbilityCheck");
iResult = AbilityCheck(GetPCSpeaker(),iAb_type,iDC);
return iResult;
}

Modifié par ShadowM, 20 mai 2012 - 09:47 .


#9
JediMindTrix

JediMindTrix
  • Members
  • 283 messages
Honestly, I don't quite understand how to use that just by looking at that. :whistle:
I get how the AbiltyCheck function works, but everything below that...

#10
JediMindTrix

JediMindTrix
  • Members
  • 283 messages
Why is "if(iAb_type==-1)" -1 and not 0 like up in the commented section?
Also, what do you mean by "Fix for 0"?

What variables would be on the placeable with this script?

#11
JediMindTrix

JediMindTrix
  • Members
  • 283 messages
Ahh, I think I understand your script. The thing is, I want to be able to account for more than one possible DC and more than one possible ability check using variables on the object.

Modifié par NineCoronas2021, 20 mai 2012 - 10:50 .


#12
ShadowM

ShadowM
  • Members
  • 768 messages
The -1 because when you do call of a variable it will always call a 0 if even if it does not have the variable on it. It more or less to make sure something does not go wrong. You can take it out if you want. You would put
AbilityCheckTyp for the type of ability check.
AbilityCheck for the DC of the check.

#13
JediMindTrix

JediMindTrix
  • Members
  • 283 messages
This works well for a single check, but I have conversations that include multiple checks of varying difficulty and type :/ I think you're on to something, I just need to figure out a different method of implementation that allows for a wider scope.

#14
JediMindTrix

JediMindTrix
  • Members
  • 283 messages
Hmm, is it possible to get the name of an integer and define that name as a string?

EDIT:
Also, would this code theoritically work?

int AbilityCheck(object oPC,int iAbility, int iDC)
{
int iABResult =FALSE;
int iRoll = d20(1);
int iAb_mod =GetAbilityModifier(iAbility,oPC);
int iResult = iRoll+iAb_mod;
if(iResult>=iDC)iABResult=TRUE;

return iABResult;
}


/*
int ABILITY_STRENGTH = 1; // should be the same as in nwseffectlist.cpp
int ABILITY_DEXTERITY = 2;
int ABILITY_CONSTITUTION = 3;
int ABILITY_INTELLIGENCE = 4;
int ABILITY_WISDOM = 5;
int ABILITY_CHARISMA = 6;

Use these for variable type
*/

int StartingConditional()
{
int iResult;
int iAb_type = GetLocalInt(OBJECT_SELF,"AbilityCheckTyp");
int iDC = GetLocalInt(OBJECT_SELF,"DCCheck");

if(iAb_type==1)iAb_type=ABILITY_STRENGTH;
iResult = AbilityCheck(GetPCSpeaker(),iAb_type,iDC);
return iResult;

if(iAb_type==2)iAb_type=ABILITY_DEXTERITY;
iResult = AbilityCheck(GetPCSpeaker(),iAb_type,iDC);
return iResult;

if(iAb_type==3)iAb_type=ABILITY_CONSTITUTION;
iResult = AbilityCheck(GetPCSpeaker(),iAb_type,iDC);
return iResult;

if(iAb_type==4)iAb_type=ABILITY_INTELLIGENCE;
iResult = AbilityCheck(GetPCSpeaker(),iAb_type,iDC);
return iResult;

if(iAb_type==5)iAb_type=ABILITY_WISDOM;
iResult = AbilityCheck(GetPCSpeaker(),iAb_type,iDC);
return iResult;

if(iAb_type==6)iAb_type=ABILITY_CHARISMA;
iResult = AbilityCheck(GetPCSpeaker(),iAb_type,iDC);
return iResult;
}

Modifié par NineCoronas2021, 20 mai 2012 - 11:06 .


#15
Lightfoot8

Lightfoot8
  • Members
  • 2 535 messages
Hope you dont mind me jumping in ShodowM.  

 What you are asking for uses a lot of advanced scripting styles, with a good base understanding of how conversations work.  For what you are tring to do you may want to check out one of the dynamic conversation systems on the vault, Like zz_dialogue.   Or use a system like _guile has already ofered up in a post recently.  

My opinion is if yu are going to take the step towards dynamic dialouges you might as well give zz dialogue a try.  I can not comment on it much since I have never used it though.
 
As far as  _guiles scripts he posted them Here.. I also can not comment on them much since I have never used them. They can at least give you an Idea of what you are up against.

Modifié par Lightfoot8, 20 mai 2012 - 11:05 .


#16
JediMindTrix

JediMindTrix
  • Members
  • 283 messages
I will give both of those a look, maybe I can learn something from them :)

#17
Lightfoot8

Lightfoot8
  • Members
  • 2 535 messages
ZZ-Dialog 1.0 link.  

#18
ShadowM

ShadowM
  • Members
  • 768 messages
Sorry went to eat. :) if you doing multiples you could create 6 script that change to the current Ability check and use though to switch through the conversation subsets. Are you changing the DC on the placables too dynamically? You could just place a variable for each ability DC and use the above to break it down to each ability check. I would have to see a lot of examples and see sample conversations to get it all right so I would go with LIghtfoot8 suggestion look at _guiles functions / scripts and look at zz Dialog too. Like Lightfoot8 I have not used it. I'm sure I be making a similar system later. Good luck. :)

#19
JediMindTrix

JediMindTrix
  • Members
  • 283 messages
Well, in example I have one conversation that is fired from an invisible object that includes a low dex check and a high dex check, a strength check, an open locks check, a search and disable traps check... all on the same placeable. I want to be able to place the DC's on the placeable and refer back to them with one script, or at least that was the goal. Your idea is a bit more feasible (breaking it down into a few scripts). I may end up using ZZ-Dialog, but I'd prefer to do this on my own as much as possible so I can learn as much as possible in the process, ya know?

-NineCoronas

Modifié par NineCoronas2021, 21 mai 2012 - 02:31 .