Jump to content
  • 0
vijay

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

Question

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!

Share this post


Link to post
Share on other sites

16 answers to this question

Recommended Posts

  • 0

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

Share this post


Link to post
Share on other sites
  • 0

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)){

Edited by Angelmelody

Share this post


Link to post
Share on other sites
  • 0

Yea I'm not, I'm still stuck on eathena 3CeAM.
Could you help me out please?

Edited by vijay

Share this post


Link to post
Share on other sites
  • 0

Thanks  :) 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?

Edited by vijay

Share this post


Link to post
Share on other sites
  • 0

Thanks  :) 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

Edited by Angelmelody

Share this post


Link to post
Share on other sites
  • 0
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
Edited by vijay

Share this post


Link to post
Share on other sites
  • 0

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)){


 

Edited by Angelmelody

Share this post


Link to post
Share on other sites
  • 0

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?

Edited by vijay

Share this post


Link to post
Share on other sites
  • 0
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");} 

Share this post


Link to post
Share on other sites
  • 0

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
Edited by vijay

Share this post


Link to post
Share on other sites
  • 0

that means,you are not using herc

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");} 

Share this post


Link to post
Share on other sites
  • 0

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.

Share this post


Link to post
Share on other sites
  • 0

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  ?

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Answer this question...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...

×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.