FOnline Development > Questions and Answers
how to change number of chosen traits?
raynor009:
How can I change how many traits the player can use at registration? I only want him to choose 1 trait.
i have tried chaging if(cr.TraitBase!=0 && traits<2) to if(cr.TraitBase!=0 && traits<1) but it didn't work
--- Code: ---{
// Input: 7 special, 3 tag skills, 2 traits, age, gender
uint traits=0;
for(uint i=TRAIT_BEGIN;i<=TRAIT_END;i++)
{
if(cr.TraitBase[i]!=0 && traits<2)
{
cr.TraitBase[i]=1;
traits++;
}
else cr.TraitBase[i]=0;
}
--- End code ---
the cod is from main.fos
hexer:
Did you try maybe setting uint traits=0; to uint traits=1; ?
wladimiiir:
--- Quote from: hexer on February 25, 2014, 12:57:07 pm ---Did you try maybe setting uint traits=0; to uint traits=1; ?
--- End quote ---
From the code flow point of view, his change is the same as the one you suggested.
--- Quote from: raynor009 on February 24, 2014, 12:54:21 pm ---How can I change how many traits the player can use at registration? I only want him to choose 1 trait.
--- End quote ---
I think this is hardcoded in the engine and that you will have to make your own registration form to have different number of traits.
Mayck:
It can be done. Keep the current check you made. You need to put another check to parameters.fos into
bool CritterGenerateCheck(int[]& data) function. (i tried this 3 years ago so not sure if it will still work)
--- Code: ---uint traits=0;
for(uint i=TRAIT_BEGIN;i<=TRAIT_END;i++)
{
if(data[i]!=0) traits++;
}
if(traits>1) // one stands for num of traits
{
Message("|4291317840 Choose one trait max plox"); //red message
return false;
}
--- End code ---
edit: changed typo: traits>1
raynor009:
Thanks for the reply. I forgot to mention that I'm working with the clean sdk. I have tried your method but, I'm getting this. Maybe the clean SDK is missing something?
--- Code: ---[00:024] FOnline server, version 0457-C3.
[00:857] *** Starting initialization ****
[00:870] Script system initialization...
[00:896] Reload scripts...
[00:977] Script message: parameters : Error : Unexpected token 'for' : 95, 1.
[00:977] Script message: parameters : Error : Expected identifier : 95, 28.
[00:977] Script message: parameters : Error : Expected identifier : 95, 44.
[00:978] Script::LoadScript - Unable to Build module<parameters>, result<-1>.
[00:978] Load module fail, name<parameters>.
[00:983] Script::BindImportedFunctions - Fail to bind imported functions, module<main>, error<-19>.
[00:983] Script::BindImportedFunctions - Fail to bind imported functions, module<perks>, error<-19>.
[00:983] Reload scripts fail.
[01:203] Reload scripts fail.
[01:203] Initialization fail!
--- End code ---
Navigation
[0] Message Index
[#] Next page
Go to full version