Aller au contenu

Photo

gc_check_stats question, or actually any ginc_var_ops info


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

#1
andysks

andysks
  • Members
  • 1 652 messages

Hi all. Is it possible to copy the gc_check_stats and modify it to give a result with params like "4" "<14". As it is now returns true if the value is equal or exceeds the second number, which is the stat. But there is no <>! etc.



#2
rjshae

rjshae
  • Members
  • 4 505 messages

Well I thought you could pass various logic checks in as part of the value string, but you could always use logic like this:

 

gc_check_stats( 4, 14 ) && ! gc_check_stats( 4, 15 )

 

It's true if the first is true and the second is false. You can do that with the conversation logic buttons as well.



#3
Lugaid of the Red Stripes

Lugaid of the Red Stripes
  • Members
  • 955 messages

Yeah, the "conversation logic button" is all you need.  Just check the NOT box in front of the script.  NOT >= 14 is the same thing as <14.



#4
andysks

andysks
  • Members
  • 1 652 messages
That's what I actually did. I just wondered if ginc var ops can be impkemented to any script. But the scrupts need chanfes in order to. Gc_local_int uses strings, while check stats ints.

#5
Lance Botelle

Lance Botelle
  • Members
  • 1 480 messages

Hi andysks,
 
Here you go ... lb_check_stats:

 

NB: I have only done one quick test, so let me know if it works OK for you.

 

In case it is not obvious, you define the ability to check as a number (unchanged), but the value as a string using the normal ">" symbols etc.
 


// LANCE BOTELLE adaption of gc_check_stats to run like gc_local_int (i.e. Using strings.)

#include "ginc_var_ops"
//#include "ginc_param_const"

int StartingConditional(int nStat, string sCheck)
{
    object oPC = GetPCSpeaker();
    int nNewStat;

    switch ( nStat )
    {
        case 0:     // Strength
            nNewStat = ABILITY_STRENGTH;
            break;
        case 1:     // Dexterity
            nNewStat = ABILITY_DEXTERITY;
            break;
        case 2:     // Constitution
            nNewStat = ABILITY_CONSTITUTION;
            break;
        case 3:     // Intelligence
            nNewStat = ABILITY_INTELLIGENCE;
            break;
        case 4:     // Wisdom
            nNewStat = ABILITY_WISDOM;
            break;
        case 5:     // Charisma
            nNewStat = ABILITY_CHARISMA;
            break;
    }	
	
	int nValue = GetAbilityScore(oPC,nNewStat);
    int iRet = CompareInts(nValue, sCheck);
    
    return (iRet);

}


#6
andysks

andysks
  • Members
  • 1 652 messages

Thanks Lance. It was actually more like a question if it's possible and stuff and not a script request, but of course I will use it. It should work, I don't see why not. Thanks a lot for the unexpected reply and ready script you gave :).



#7
Morbane

Morbane
  • Members
  • 1 883 messages
int StartingConditional(int nStat, int nDC)
{

    object oPC = GetPCSpeaker();
    int nNewStat;

    switch ( nStat )
    {
        case 0:     // Strength
            nNewStat = ABILITY_STRENGTH;
            break;
        case 1:     // Dexterity
            nNewStat = ABILITY_DEXTERITY;
            break;
        case 2:     // Constitution
            nNewStat = ABILITY_CONSTITUTION;
            break;
        case 3:     // Intelligence
            nNewStat = ABILITY_INTELLIGENCE;
            break;
        case 4:     // Wisdom
            nNewStat = ABILITY_WISDOM;
            break;
        case 5:     // Charisma
            nNewStat = ABILITY_CHARISMA;
            break;
    }
	string sStat;
	if (nStat == 0)
		sStat = "STR";
	else if (nStat == 1)
		sStat = "DEX";
	else if (nStat == 2)
		sStat = "CON";
	else if (nStat == 3)
		sStat = "INT";
	else if (nStat == 4)
		sStat = "WIS";
	else if (nStat == 5)
		sStat = "CHA";
	
	int nMod = GetAbilityModifier(nNewStat, oPC);
	int nd20 = d20();
	int nRoll = nd20 + nMod;
    
	if (nRoll >= nDC )
	{
	SendMessageToPC(oPC, "Stat Check: " +  sStat + ": *Success* on a " + IntToString(nd20) + "+" + IntToString(nMod) + "=" + IntToString(nRoll) + " vs DC : " + IntToString( nDC ));
		return TRUE;
	}
	
	SendMessageToPC(oPC, "Stat Check: " +  sStat + ": *Failure* on a " + IntToString(nd20) + "+" + IntToString(nMod) + "=" + IntToString(nRoll) + " vs DC : " + IntToString( nDC ));
	    return FALSE;
}

I put this together for my tomb of horrors conversion, since so many of the tricks and traps were stat tests



#8
andysks

andysks
  • Members
  • 1 652 messages
Also usefull. Thanks so much.