ACR Skills

For toolset tutorials as well as question and answers.
Locked
User avatar
Teric neDhalir
Githyanki
Posts: 1495
Joined: Mon Jan 05, 2004 10:04 pm
Location: Manchester UK

ACR Skills

Post by Teric neDhalir »

I'm trying to write a "flavour text" trigger that gives you information if you pass a skill roll OnEnter. I need to include all the new ACR skills which on the face of it shouldn't be difficult. The problem is that;

Code: Select all

GetIsSkillSuccessful(oPC, SKILL_ESCAPE_ARTIST, iDifficulty, FALSE);
works, but;

Code: Select all

GetIsSkillSuccessful(oPC, 35, iDifficulty, FALSE);
doesn't. As I want a generic trigger that I can change the skill, text and difficulty via variables I need to either understand why it doesn't understand the int for the skill type (and I have acr_i included) or how to pass the name of the skill to the function when it's expecting an int.
Gods of code, I humbly beseech an answer.
Teric
t-ice
Dungeon Master
Posts: 2106
Joined: Fri Apr 17, 2009 6:24 pm

Re: ACR Skills

Post by t-ice »

Do you explictly give the "35" in the code, or do you define an integer like:

Code: Select all

if(blah)
    integer i=35;
else
   integer i=32;
end
GetIsSkillSuccessful(oPC, i, iDifficulty, FALSE);
?
Only thing I could come up with is the 35 explicitly written into the code isn't given a type, so it doesn't know whether it's a string, a float or a int. Logically it _should_ default to int (as "35" is string, 35.0 is float), but never know...
User avatar
Teric neDhalir
Githyanki
Posts: 1495
Joined: Mon Jan 05, 2004 10:04 pm
Location: Manchester UK

Re: ACR Skills

Post by Teric neDhalir »

t-ice,
AFAIK,
The GetIsSkillSuccessful is *expecting* an int at that position.
If you put in a number like 8 for a skill from the original game it works.
t-ice
Dungeon Master
Posts: 2106
Joined: Fri Apr 17, 2009 6:24 pm

Re: ACR Skills

Post by t-ice »

Okay, beats me then...
Zelknolf
Chosen of Forumamus, God of Forums
Posts: 6139
Joined: Tue Jul 05, 2005 7:04 pm

Re: ACR Skills

Post by Zelknolf »

Are you certain that it's getting that 35?

If it's reading from a local on a trigger, the type might be wrong-- if you have 35 set as a local string, then GetLocalInt will still return 0.

Also, it does indeed default types-- but on the plus side, if for whatever exotic reason the compiler -thinks- it's the wrong type, you'll just get a compile error, and the code that runs will be the last valid code that you attempted to compile. So I guess watch the feedback when you're editing scripts as general advice; if it complains, then your new stuff won't run.
User avatar
Teric neDhalir
Githyanki
Posts: 1495
Joined: Mon Jan 05, 2004 10:04 pm
Location: Manchester UK

Re: ACR Skills

Post by Teric neDhalir »

Zelknolf wrote:Are you certain that it's getting that 35?
Yes, because for testing purposes I stopped passing it any variable from the trigger and just put the number of the skill directly in the script. Just tested it again and putting "8" in the script works - one of the OC skills.

Code: Select all

GetIsSkillSuccessful(oPC, 8, iDifficulty, FALSE)
Zelknolf
Chosen of Forumamus, God of Forums
Posts: 6139
Joined: Tue Jul 05, 2005 7:04 pm

Re: ACR Skills

Post by Zelknolf »

That seems like evidence in favor of the hypothesis?

You know that it's getting called-- as you get the expected result with a hardcoded value. Thus it is most sensible to look into the provided data, and making sure that you're checking what you think you are-- add some SendMessageToPC(GetEnteringObject(), IntToString(whateverValueYoureUsing)) or the like in there. That'll help you figure out what's moving around.


Also totally just occured to me that you're using the OE function. You'll want to include acr_skills_i and use ACR_SkillCheck (it is very unlikely that this will succeed if the same information passed to the OE function is not, but ACR_SkillCheck is garaunteed to use ALFA rules for skill checks, which the OE function calls might not)
Ronan
Dungeon Master
Posts: 4611
Joined: Sun Feb 20, 2005 9:48 am

Re: ACR Skills

Post by Ronan »

I would think GetIsSkillSuccessful would still function where nSkill = 0, though I have not tested it. Teric, could you paste your entire code within a block?
Zelknolf
Chosen of Forumamus, God of Forums
Posts: 6139
Joined: Tue Jul 05, 2005 7:04 pm

Re: ACR Skills

Post by Zelknolf »

Ronan wrote:I would think GetIsSkillSuccessful would still function where nSkill = 0, though I have not tested it. Teric, could you paste your entire code within a block?
Skill 0 is AE; we've burnt it at the stake, because it's AE. Though I also haven't tried to roll it on the ACR, because it's AE. So yeah, code block would be handy.
User avatar
Teric neDhalir
Githyanki
Posts: 1495
Joined: Mon Jan 05, 2004 10:04 pm
Location: Manchester UK

Re: ACR Skills

Post by Teric neDhalir »

*sigh* Stand down, everyone. I think it must have been working all along. If anyone wants to check my working the OnEnter for the trigger says;

Code: Select all

#include "acr_i"
void main()
{
object oPC = GetEnteringObject();
int iSkill = GetLocalInt(OBJECT_SELF, "SJC_SKILLNUMBER");
string sFeedback = GetLocalString(OBJECT_SELF, "SJC_FLAVOURTEXT");
int iDifficulty = GetLocalInt(OBJECT_SELF, "SJC_SKILL_DC");
string sTag = GetTag(OBJECT_SELF);

if (!GetIsPC(oPC)) return;
if (GetLocalInt(oPC, "SKILLTRIGGERDONE" + sTag) == 1) return;


SetLocalInt(oPC, "SKILLTRIGGERDONE" + sTag, 1);

if (GetIsSkillSuccessful(oPC, iSkill, iDifficulty, FALSE))
	{
	FloatingTextStringOnCreature(sFeedback, oPC, TRUE, 5.0f);	
	}

}
you'll have to back-engineer the variables on the trigger yourself.
Apologies for wasting your time (again).
Zelknolf
Chosen of Forumamus, God of Forums
Posts: 6139
Joined: Tue Jul 05, 2005 7:04 pm

Re: ACR Skills

Post by Zelknolf »

Code: Select all

#include "acr_i"
#include "acr_notifications_i"

void main()
{
object oPC = GetEnteringObject();
int iSkill = GetLocalInt(OBJECT_SELF, "SJC_SKILLNUMBER");
string sFeedback = GetLocalString(OBJECT_SELF, "SJC_FLAVOURTEXT");
int iDifficulty = GetLocalInt(OBJECT_SELF, "SJC_SKILL_DC");
string sTag = GetTag(OBJECT_SELF);

if (!GetIsPC(oPC)) return;
if (GetLocalInt(OBJECT_SELF, "SKILLDONE" + IntToString(ACR_GetCharacterID(oPC))) == 1) return;


SetLocalInt(OBJECT_SELF, "SKILLDONE" + IntToString(ACR_GetCharacterID(oPC)), 1);

if (GetIsSkillSuccessful(oPC, iSkill, iDifficulty, FALSE))
{
	string sAbbreviation = "You've found something!";
	NotifyPlayer( oPC, NOTIFY_TYPE_INFO, sAbbreviation, sFeedback, NOTIFY_WINDOW_MESSAGE_BOX, "", "", "OK", "");
}

}
Saving on the trigger will spare you from potential woes related to trigger re-use, and you'll be more insulated against repeat use of tags.

ACR_GetCharacterID is in acr_db_persist_i, which you inherit through acr_i.

NotifyPlayer has the advantage of populating a list box in the corner of the screen with an icon; if a character notices something interesting while being spammed with foreign language, for example, they'll still have that-- and it'll wait there until it's acknowledged (when it will pop up with the full feedback you wanted to give). It is in acr_notifications_i, which isn't inherited through anything AFAIK.
User avatar
Teric neDhalir
Githyanki
Posts: 1495
Joined: Mon Jan 05, 2004 10:04 pm
Location: Manchester UK

Re: ACR Skills

Post by Teric neDhalir »

Thanks for the tips!
t-ice
Dungeon Master
Posts: 2106
Joined: Fri Apr 17, 2009 6:24 pm

Re: ACR Skills

Post by t-ice »

Well, this is sort of repeating what Zelk said, and what I did instructed by Zelk, but Amn's "hunting areas" use skill rolls similarly upon entering. The script runs as the OnClicked script on the trigger that leads to the area (on the other side, that is). Local variables are saved on the area object, though I suppose the trigger itself would be just as well, but using locals on the PC is rather to be avoided if possible?
Zelknolf
Chosen of Forumamus, God of Forums
Posts: 6139
Joined: Tue Jul 05, 2005 7:04 pm

Re: ACR Skills

Post by Zelknolf »

t-ice wrote:Well, this is sort of repeating what Zelk said, and what I did instructed by Zelk, but Amn's "hunting areas" use skill rolls similarly upon entering. The script runs as the OnClicked script on the trigger that leads to the area (on the other side, that is). Local variables are saved on the area object, though I suppose the trigger itself would be just as well, but using locals on the PC is rather to be avoided if possible?
The method of saving on the PC object or the trigger or the area wasn't the problem, really-- the systems were looking for something that would be garaunteed to be unique, and area or trigger tags rely on human configuration to achieve uniqueness (and humans aren't very good at that); however, PC IDs are garaunteed unique by a computer (and computers are quite good at that).
Locked