Author Topic: how to change number of chosen traits?  (Read 3489 times)

how to change number of chosen traits?
« 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.

i have tried chaging if(cr.TraitBase!=0 && traits<2) to if(cr.TraitBase!=0 && traits<1) but it didn't work

Code: [Select]
{
// 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;
}

the cod is from main.fos
« Last Edit: February 24, 2014, 01:38:37 pm by raynor009 »

Re: how to change number of chosen traits?
« Reply #1 on: February 25, 2014, 12:57:07 pm »
Did you try maybe setting uint traits=0; to uint traits=1; ?

Offline wladimiiir

  • Rotator
  • Independent FOnline developer
Re: how to change number of chosen traits?
« Reply #2 on: February 26, 2014, 07:41:03 am »
Did you try maybe setting uint traits=0; to uint traits=1; ?
From the code flow point of view, his change is the same as the one you suggested.

How can I change how many traits the player can use at registration? I only want him to choose 1 trait.
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.

Offline Mayck

  • Rotator
  • ...shhhh...
Re: how to change number of chosen traits?
« Reply #3 on: February 26, 2014, 08:35:50 am »
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: [Select]
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;
}

edit: changed typo: traits>1
« Last Edit: February 26, 2014, 10:23:36 am by Mayck »

Re: how to change number of chosen traits?
« Reply #4 on: February 26, 2014, 12:44:58 pm »
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: [Select]
[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!

Offline Wipe

  • Rotator
  • Random is god
Re: how to change number of chosen traits?
« Reply #5 on: February 26, 2014, 12:52:24 pm »
Problem is between chair and monitor ;)
That's just syntax error, maybe missing semicolon, not included _defines.fos or something like that. Check parameters.fos with ASCompiler to see at what line AngelScript starts crying, and double-check it.
Games are meant to be created, not played...