How to detect the player's race

This forum is for discussing anything related to The Quest editor.

How to detect the player's race

Postby KGold » Thu Nov 09, 2017 4:29 pm

So I'm trying to apply the script 'getrace' in a code, but apparently I'm doing something wrong.

if(player.getrace("Etherim")) or if(player.getrace(base_etherim)) don't work, the error message says 'invalid number of arguments'. The tutorial doesn't specify this. What's the right way to use this script?
If you have been really too busy,
And you feel your head being dizzy,
It's recommended to have a rest,
I have a good offer-play the Quest! : )
User avatar
KGold
 
Posts: 127
Joined: Sun Jun 10, 2012 3:21 pm
Location: Hungary

Re: How to detect the player's race

Postby Catacomber » Fri Nov 10, 2017 8:31 am

It's an ability--so you have to query it like any other ability--

base_abetherim
User avatar
Catacomber
 
Posts: 978
Joined: Tue Oct 25, 2011 5:20 am
Location: New York City

Re: How to detect the player's race

Postby Schicko » Fri Nov 10, 2017 1:26 pm

Catacomber wrote:It's an ability--so you have to query it like any other ability--

base_abetherim


I think that's for the hasability() function. Even then, I've tried the following as a rasvim and none of them output "you're rasvim":
Code: Select all
if (player.hasability("base_abrasvim")) {
   message("you're rasvim");
} else {
   message("you're not rasvim");
}

and also:
Code: Select all
if (player.getrace() = base_rasvim) {
   message("you're rasvim");
} else {
   message("you're not rasvim");
}


The second one above should also have worked (but also doesn't) because I tried:
Code: Select all
race = player.getrace();
message(race);

which resulted in the output:
Code: Select all
base_rasvim


I've also tried all possible permutations of the code snippets above with and without quotation marks delimiting abrasvim or rasvim. But still none of them worked.

The closest thing I could get the getrace() to produce a response is with:
Code: Select all
race = player.getrace();
if (race = base_rasvim) {
   message("you're rasvim");
} else {
   message("you're not rasvim");
}

which resulted in a runtime error stating:
Code: Select all
The Quest Editor v1.0: Error in c:\home\development\projects\Quest\Quest1\source\Quest/Core/PointerArray.h at line 345.

Please see: redshift.hu/help

when the dialogue containing that script is selected.

Other than that, the only way to be able to use player's race in dialogue that actually works seems to be possible only by using the PCRace or PCUndead dialogue conditions or with the isundead() function (the latter two of which only differentiates between rasvim and non rasvim, and not with other races). The isundead() function works properly when used like so:
Code: Select all
if (player.isundead()) {
   message("you're rasvim");
} else {
   message("you're not rasvim");
}


To conclude, it seems like hasability() and getrace() functions in the script editor/compiler are broken when used to try and match statements with player's race.
User avatar
Schicko
 
Posts: 25
Joined: Sat Nov 12, 2011 11:02 am
Location: In your inventory

Re: How to detect the player's race

Postby KGold » Fri Nov 10, 2017 2:38 pm

Should've thought of this. I remember checking the 'Abilities' tab in the game and seeing my race there... :)

Seems like the purpose of the 'getrace' script is to display the race of the player, not detect it.
I'm aware of the use of the 'isundead' script, but in this case, I need something more specific.

Thank you for the help Cat and Schicko!
If you have been really too busy,
And you feel your head being dizzy,
It's recommended to have a rest,
I have a good offer-play the Quest! : )
User avatar
KGold
 
Posts: 127
Joined: Sun Jun 10, 2012 3:21 pm
Location: Hungary


Return to Editor

Who is online

Users browsing this forum: No registered users and 1 guest