Jump to content
  • 0

OnPCStatCalcEvent On login not work


Question

Posted (edited)

-	script	guildbonus	-1,{
OnPCStatCalcEvent:
bonus bStr, 30;
}

Simple, worked only when change map and change equip and other...

But when login in the stat isnt change....

??

Update: Ok i find out that status_calc_pc is executed first, and then >>>> npc event...

I need a way to run npc_script_event(sd, NPCE_STATCALC); first... Or have to status_calc_pc vy script in game... right?

Edited by bearnope246

13 answers to this question

Recommended Posts

  • 0
Posted (edited)

I don't think you got how it works bro.

 

Take a look at the description:

OnPCStatCalcEvent:


This special label triggers when a player's stats are recalculated, such as when
changing stats, equipment, or maps, as well as when logging in, leveling up, and
mounting a job mount. This can be used to grant additional item bonuses to certain
player groups, for instance.

 

This means that this event will only be triggered OnLogin if your stats are recalculated. If your stats are never recalculated then this event will never be triggered.

Well, if you need something to happen only on player's login then you should use OnPCLoginEvent instead of OnPCStatCalcEvent.

Att,
_Okuz_.

Edited by _Okuz_
  • 0
Posted

I don't think you got how it works bro.

 

Take a look at the description:

OnPCStatCalcEvent:

This special label triggers when a player's stats are recalculated, such as when

changing stats, equipment, or maps, as well as when logging in, leveling up, and

mounting a job mount. This can be used to grant additional item bonuses to certain

player groups, for instance.

 

This means that this event will only be triggered OnLogin if your stats are recalculated. If your stats are never recalculated then this event will never be triggered.

Well, if you need something to happen only on player's login then you should use OnPCLoginEvent instead of OnPCStatCalcEvent.

Att,

_Okuz_.

if you use OnPCStatCalcEvent with a stat bonus like:

OnPCStatCalcEvent:
bonus bstr,10;

This will run just like Onpcloginevent... but only after the stat is calculated first (Base stat, equipment, charm........)

So if you logging in, the stat won't change to str + 10.... only if you change map or equip/unequip something then it will...

 

i put in a dospbottom script to test.... i saw the it popup after a few sec, so i say that it run after status_calc_pc.

 

So what i need is The bonus applied right away when i login....

  • 0
Posted (edited)

If you need the bonus to be applied on login then you should use OnPCLoginEvent...

OnPCStatCalcEvent will be triggered only after the status_calc_pc(...), as you already noticed. I don't know why you want to use OnPCStatCalcEvent to give player bonus On Login...

Try something like this:

-	script	whatever	-1,{

OnPCLoginEvent: // will force to give the bonus on login event
OnPCStatCalcEvent: // will give the bonus when stats are recalculated
	if (@received) // don't acum the bonuses...
		end;

	bonus bStr, 30;
	set @received, 1;
}

Att,

_Okuz_.

Edited by _Okuz_
  • 0
Posted

If you need the bonus to be applied on login then you should use OnPCLoginEvent...

OnPCStatCalcEvent will be triggered only after the status_calc_pc(...), as you already noticed. I don't know why you want to use OnPCStatCalcEvent to give player bonus On Login...

Try something like this:

-	script	whatever	-1,{

OnPCLoginEvent: // will force to give the bonus on login event
OnPCStatCalcEvent: // will give the bonus when stats are recalculated
	if (@received) // don't acum the bonuses...
		end;

	bonus bStr, 30;
	set @received, 1;
}

Att,

_Okuz_.

I already tried that.. Nothing will change.

Onpcloginevent and OnPCStatCalcEvent are the same.. they always run after status_calc_pc.

 

I want it to calculated just like Item bonus... Right when they login.. So the stats bobus apply .

 

Im using this to make a Guild bonus script. Anyone with the guildid will have bonus. It work but i must change map or equip something for the stat to appear.....

 

I saw someone change the npc_script_event to runscript() and they said it worked... I tried that too but error say not enough argument....

  • 0
Posted (edited)

Maybe now...

-	script	whatever	-1,{

OnPCLoginEvent:
	statusup2 bStr,readparam(bStr);
	end;

OnPCStatCalcEvent:
	if (@received) end;

	bonus bStr, 30;
	set @received, 1;
}

Try it!

Att,
_Okuz_.

Edited by _Okuz_
  • 0
Posted

Maybe now...

-	script	whatever	-1,{

OnPCLoginEvent:
	statusup2 bStr,readparam(bStr);
	end;

OnPCStatCalcEvent:
	if (@received) end;

	bonus bStr, 30;
	set @received, 1;
}

Try it!

Att,

_Okuz_.

Tried it.

Every time i Relog Str got doubled... 1 2 4 816....

 

I think this kind of thing really need a source mod....

  • 0
Posted (edited)

Well, first of all I don't think bonus are meant to be used outside the item scripts... As its description says, they are unsafe because there aren't any guarantee of when the bonus expire...

 

*bonus <bonus type>,<val1>;

*bonus2 <bonus type>,<val1>,<val2>;
*bonus3 <bonus type>,<val1>,<val2>,<val3>;
*bonus4 <bonus type>,<val1>,<val2>,<val3>,<val4>;
*bonus5 <bonus type>,<val1>,<val2>,<val3>,<val4>,<val5>;

These commands are meant to be used in item scripts. They will probably work
outside item scripts, but the bonus will not persist for long. They, as
expected, refer only to an invoking character.

You can find the full list of possible bonuses and which command to use for each
kind in 'doc/item_bonus.txt'.

 

I'm gonna try to solve this tonight and if I have success I'll let you know.

Att,
_Okuz_.

Edited by _Okuz_
  • 0
Posted

i dont see why it doesn't work for you ...

 

3EbbPdc.png

 

 

If you are having issue, at least provide some useful  information/feedback... 

the word "BUMP" are not helping at all... and stop bump without provide any useful info.

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.   Paste as plain text instead

  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.

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...