How to add a global reg value requirement in script.c

vijay

New member
Messages
76
Points
0
Age
33
Location
Bangalore, India.
Emulator
I want to add a global reg unit and that is #DOMINATION, Its like a points.
Player then need have atlest 1 to bypass the script_pushint(st, -2);.
Here are the codes.
http://pastebin.com/zN3gikWv

This is the line i need to add up that #DOMINATION

if(sd2 && (sd2->status.base_level<200 || sd2->status.class_==JOB_NOVICE || sd2->status.class_==JOB_BABY || sd2->status.class_==JOB_NOVICE_HIGH)){ 

script_pushint(st, -2);

I tried this but i'm getting errors
if(sd2 && (sd2->status.#DOMINATION < 1 || sd2->status.base_level<200 || sd2->status.class_==JOB_NOVICE || sd2->status.class_==JOB_BABY || sd2->status.class_==JOB_NOVICE_HIGH)){

script_pushint(st, -2);

Heads up would be grate, Thanks!

 
Now the line is
if(sd2 && (!pc_readaccountreg(sd2,script->add_str("#DOMINATION")<1) || sd2->status.base_level<200 || sd2->status.class_==JOB_NOVICE || sd2->status.class_==JOB_BABY || sd2->status.class_==JOB_NOVICE_HIGH)){

But still I'm getting error wile compiling.

1>f:*******************script.c(5024): error C2065: 'script' : undeclared identifier
1>f:*******************script.c(5024): error C2223: left of '->add_str' must point to struct/union
 
Now the line is

if(sd2 && (!pc_readaccountreg(sd2,script->add_str("#DOMINATION")<1) || sd2->status.base_level<200 || sd2->status.class_==JOB_NOVICE || sd2->status.class_==JOB_BABY || sd2->status.class_==JOB_NOVICE_HIGH)){

But still I'm getting error wile compiling.

1>f:*******************script.c(5024): error C2065: 'script' : undeclared identifier

1>f:*******************script.c(5024): error C2223: left of '->add_str' must point to struct/union
coz that's herc format , I think you arent using herc emulator?

if(sd2 &&( !pc_readaccountreg(sd2,"#DOMINATION") || sd2->status.base_level<200 || sd2->status.class_==JOB_NOVICE || sd2->status.class_==JOB_BABY || sd2->status.class_==JOB_NOVICE_HIGH)){

 
Last edited by a moderator:
Thanks 
default_smile.png
and what about #DOMINATION value must be at lest 1?

if(sd2 &&( !pc_readaccountreg(sd2,"#DOMINATION")<1 || sd2->status.base_level<200 || sd2->status.class_==JOB_NOVICE || sd2->status.class_==JOB_BABY || sd2->status.class_==JOB_NOVICE_HIGH)){

Is that alright?

 
Last edited by a moderator:
Thanks 
default_smile.png
and what about #DOMINATION value must be at lest 1?

if(sd2 &&( !pc_readaccountreg(sd2,"#DOMINATION")<1 || sd2->status.base_level<200 || sd2->status.class_==JOB_NOVICE || sd2->status.class_==JOB_BABY || sd2->status.class_==JOB_NOVICE_HIGH)){

Is that alright?
nope,  should look like  pc_readaccountreg(sd2,"#DOMINATION")<1

 
Last edited by a moderator:
Fixed thanks.
But one more question, What if i want to add a item requirement too?
Like countitem(18541) < 1
Any idea Angel?

Tried this but error and warning.
if(sd2 && (pc_checkequip(sd2,"18540")<1 || pc_readaccountreg(sd2,"#DOMINATION")<1 || sd2->status.base_level<200 || sd2->status.class_==JOB_NOVICE || sd2->status.class_==JOB_BABY || sd2->status.class_==JOB_NOVICE_HIGH)){
script_pushint(st, -2); return 0;
}


Error:
1>f:****srcmapscript.c(5024): warning C4047: 'function' : 'int' differs in levels of indirection from 'char [6]'
1>f:****srcmapscript.c(5024): warning C4024: 'pc_checkequip' : different types for formal and actual parameter 2

 
Last edited by a moderator:
int f;

ARR_FIND( 0, MAX_INVENTORY, f, sd2->status.inventory[f].nameid == 18540 );

if(sd2 &&(f >= MAX_INVENTORY || pc_readaccountreg(sd2,"#DOMINATION")<1 || sd2->status.base_level<200 || sd2->status.class_==JOB_NOVICE || sd2->status.class_==JOB_BABY || sd2->status.class_==JOB_NOVICE_HIGH)){


 

 
Last edited by a moderator:
Last question Angel.
pc_readaccountreg(sd2,"#DOMINATION")<1 is for read

After reading it, if he/she has 1 or more than 1 DOMINATION then i want to delete 1.
something like this: set #DOMINATION, #DOMINATION- ( 1 );

or
pc_setaccountreg(sd2,"#DOMINATION", -1);

something like that?

Is that possible?

 
Last edited by a moderator:
Code:
int dom_point = pc_readaccountreg(sd,"#DOMINATION"); //should be at start of the function.//for checking..if (dom_point>=1){    pc_setaccountreg(sd, script->add_str("#DOMINATION"), dom_point-1);    clif->message(sd->fd,"Domination Point Reduced by 1");} 
 
Last edited by a moderator:
int dom_point = pc_readaccountreg(sd,"#DOMINATION"); //should be at start of the function.

//for checking..

if (dom_point>=1){
pc_setaccountreg(sd, script->add_str("#DOMINATION"), dom_point-1);
    sprintf(out, "Domination Point Reduced by 1");
}
 
I did this but getting a error message.
1>f:*******3ceamsrcmapscript.c(5047): error C2065: 'script' : undeclared identifier
1>f:*******3ceamsrcmapscript.c(5047): error C2223: left of '->add_str' must point to struct/union

 
Last edited by a moderator:
that means,you are not using herc

Code:
int dom_point = pc_readaccountreg(sd,"#DOMINATION"); //should be at start of the function.//for checking..if (dom_point>=1){    pc_setaccountreg(sd, "#DOMINATION", dom_point-1);    clif->message(sd->fd,"Domination Point Reduced by 1");}
 
1>f:******3ceamsrcmapscript.c(4993): warning C4700: uninitialized local variable 'sd' used
This line
int dom_point = pc_readaccountreg(sd,"#DOMINATION"); //should be at start of the function.

 
1>f:******3ceamsrcmapscript.c(4993): warning C4700: uninitialized local variable 'sd' used

This line

int dom_point = pc_readaccountreg(sd,"#DOMINATION"); //should be at start of the function.
sd  ----change to--->  sd2  ?

 
Back
Top