Jump to content
  • 5

VIP STATUS ICON ERROR (status_change_start: Invalid status change (1500)!)


Question

Posted (edited)

Hi! I added a custom status icon (VIP Users). But I have trouble implementing them. This is what I did.

1. src/map/status.cpp
Added 
case SC_VIPSTATE:
After
case SC_JEXPBOOST:

2. src/map/status.hpp
Added
SC_VIPSTATE = 1500,
Before
SC_MAX,

3. src/map/status.hpp
Added
EFST_VIPSTATE = 1500,
Before
EFST_MAX,

4. src/map/script_constants.hpp

Added the following on their respective lines.
export_constant(SC_VIPSTATE);
export_deprecated_constant2("SI_VIPSTATE",1500);
export_constant(EFST_VIPSTATE);

5. efstids.lub

EFST_VIPSTATE = 1500,

 stateiconimginfo.lub
[EFST_IDs.EFST_VIPSTATE] = "vip.tga",

 stateiconinfo.lub

StateIconList[EFST_IDs.EFST_VIPSTATE] = {
    haveTimeLimit = 1,
    posTimeLimitStr = 2,
    descript = {
        { "VIP MEMBER", COLOR_TITLE_BUFF },
        { "Exp Bonus 10%" },
        { "Job Exp Bonus 10%" },
        { "Drop Rate Bonus 10%" },
        { "Additional 300 Storage Slot" },
        { "Can use command" },
        { "@autoattack" },
        { "@autotrade" },
        { "@autoloot" },
        { "Can get Fairy Buff for +5 All stats" }
    }
    
}


6. Iteminfo.yml

 Script: |
      vip_time(1440); sc_start SC_VIPSTATE,-1,0;






I did all these things but i still receive an error and nothing works,
image.png.e4fdbca5d1f2939a832aa51f1e27cd9e.png

If anyone can help me, I would really appreciate it. Thank you very much!

Edited by funtwocrasher
  • Upvote 1

Recommended Posts

  • 0
Posted (edited)

image.thumb.png.607d3ffb082b656f4c2ecb4ff054ad72.png

Ok, i solved this.

First of all, just follow the guide from @funtwocrasher on the first page.
The only difference is, i used id of 2001 instead of 1500.

Once you followed the guide step-by-step, you need to add your custom status in db\status.yml and put it on the latest status like below:

  - Status: VIPSTATE
    Icon: EFST_VIPSTATE
    Flags:
      NoDispell: true
      NoBanishingBuster: true

Note: If there is nothing in your status.yml, you have to add it like this:

Body:
  - Status: VIPSTATE
    Icon: EFST_VIPSTATE
    Flags:
      NoDispell: true
      NoBanishingBuster: true

That is what caused the error log on the console - status_change_start: Invalid status change (1500)!.

Now, recompile your server.
Once you've done, you are supposed to be able to use sc_start SC_VIPSTATE now.

However, you might notice the timer and the actual timer for the VIP is not in sync.
To solve this problem, i created a custom function which you can call from your item or npc:

function	script	vip_system	{
	set .@time, getarg(0); // retrieve the time (in seconds) from index 0 of the argument
	set .@current_time, vip_status(3); // get the actual vip remaining time
	set .@renew_time, .@time + .@current_time;

	dispbottom "Welcome to the VIP club!";
	atcommand "@vip +" + .@time + "s " + strcharinfo(0) + "";

	if (!vip_status(1)) {
		sc_start SC_VIPSTATE,.@time * 1000,0;
		dispbottom "You are now a VIP member!";
	} else {
		sc_start SC_VIPSTATE,.@renew_time * 1000,0;
		dispbottom "You have succesfully extends your VIP membership.";
	}
}

To use the function, simply call it like this:

Script: |
      callfunc "vip_system",30;

But using this function alone is not enough, you need to create another npc to detect and update the buff icon timer whenever the user logged in to resync the timer:

-	script	VipStatus	-1,{
OnPCLoginEvent:
	set .@current_time, vip_status(3);

	sc_end EFST_VIPSTATE;
	sc_start SC_VIPSTATE,.@current_time * 1000,0;
    end;
}

Voila! It is done.

Some common issues:
1. If somehow, using sc_start still does not show the buff status icon, you can use the same thing that @Louis T Steinhil mentioned before:

// replace every sc_start SC_VIPSTATE with this one
bonus_script "{}",.@time,0,0,EFST_VIPSTATE2;

// replace every sc_end EFST_VIPSTATE with this one
bonus_script_clear 1;

docs regarding this can be found here:
https://raw.githubusercontent.com/rathena/rathena/master/doc/script_commands.txt

2. I haven't tested the timer if the timer exceed a few weeks.
3. This is a known issues since early days of rAthena and also at Hercules. Once the VIP ends, it does not really end directly. You need to wait a couple of minutes before it completely expires or if the user re-login. There is nothing that i can do to solve this. More info regarding this issue can be found in Hercules forum: https://board.herc.ws/topic/250-official-vip-system/
4. If somehow your custom status icon does not appear. Try to do double check on your client config. More info regarding this can be learned from here:

 

Edited by Jesky
  • 0
Posted
On 10/9/2024 at 8:52 PM, Jesky said:

image.thumb.png.607d3ffb082b656f4c2ecb4ff054ad72.png

Ok, i solved this.

First of all, just follow the guide from @funtwocrasher on the first page.
The only difference is, i used id of 2001 instead of 1500.

Once you followed the guide step-by-step, you need to add your custom status in db\status.yml and put it on the latest status like below:

  - Status: VIPSTATE
    Icon: EFST_VIPSTATE
    Flags:
      NoDispell: true
      NoBanishingBuster: true

Note: If there is nothing in your status.yml, you have to add it like this:

Body:
  - Status: VIPSTATE
    Icon: EFST_VIPSTATE
    Flags:
      NoDispell: true
      NoBanishingBuster: true

That is what caused the error log on the console - status_change_start: Invalid status change (1500)!.

Now, recompile your server.
Once you've done, you are supposed to be able to use sc_start SC_VIPSTATE now.

However, you might notice the timer and the actual timer for the VIP is not in sync.
To solve this problem, i created a custom function which you can call from your item or npc:

function	script	vip_system	{
	set .@time, getarg(0); // retrieve the time (in seconds) from index 0 of the argument
	set .@current_time, vip_status(3); // get the actual vip remaining time
	set .@renew_time, .@time + .@current_time;

	dispbottom "Welcome to the VIP club!";
	atcommand "@vip +" + .@time + "s " + strcharinfo(0) + "";

	if (!vip_status(1)) {
		sc_start SC_VIPSTATE,.@time * 1000,0;
		dispbottom "You are now a VIP member!";
	} else {
		sc_start SC_VIPSTATE,.@renew_time * 1000,0;
		dispbottom "You have succesfully extends your VIP membership.";
	}
}

To use the function, simply call it like this:

Script: |
      callfunc "vip_system",30;

But using this function alone is not enough, you need to create another npc to detect and update the buff icon timer whenever the user logged in to resync the timer:

-	script	VipStatus	-1,{
OnPCLoginEvent:
	set .@current_time, vip_status(3);

	sc_end EFST_VIPSTATE;
	sc_start SC_VIPSTATE,.@current_time * 1000,0;
    end;
}

Voila! It is done.

Some common issues:
1. If somehow, using sc_start still does not show the buff status icon, you can use the same thing that @Louis T Steinhil mentioned before:

// replace every sc_start SC_VIPSTATE with this one
bonus_script "{}",.@time,0,0,EFST_VIPSTATE2;

// replace every sc_end EFST_VIPSTATE with this one
bonus_script_clear 1;

docs regarding this can be found here:
https://raw.githubusercontent.com/rathena/rathena/master/doc/script_commands.txt

2. I haven't tested the timer if the timer exceed a few weeks.
3. This is a known issues since early days of rAthena and also at Hercules. Once the VIP ends, it does not really end directly. You need to wait a couple of minutes before it completely expires or if the user re-login. There is nothing that i can do to solve this. More info regarding this issue can be found in Hercules forum: https://board.herc.ws/topic/250-official-vip-system/
4. If somehow your custom status icon does not appear. Try to do double check on your client config. More info regarding this can be learned from here:

 

Did it all and still not showing  =(

  • 0
Posted (edited)

Update: Working on the latest rathena version as of the date I'm typing this.

// SERVER SIDE
1. Open src/map/status.cpp
find and add after case SC_JEXPBOOST:

		case SC_EXPBOOST:
		case SC_JEXPBOOST:
		case SC_VIPSTATE: // VIP Status Icon
		case SC_PERIOD_RECEIVEITEM_2ND:
		case SC_PERIOD_PLUSEXP_2ND:

2. Open src/map/status.hpp
find and add before SC_MAX,

	SC_OVERCOMING_CRISIS,

	SC_VIPSTATE = 2000, // VIP Status Icon
	SC_MAX, //Automatically updated max, used in for's to check we are within bounds.

find and add before EFST_MAX,

/// Do not modify code above this, since it will be automatically generated by the API again
	EFST_VIPSTATE = 2000, // VIP Status Icon
	EFST_MAX,

3. Open src/map/script_constants.hpp
find and add after export_constant(SC_OVERCOMING_CRISIS);

	export_constant(SC_CONTENTS_20);
	export_constant(SC_OVERCOMING_CRISIS);
	export_constant(SC_VIPSTATE); // VIP Status Icon

/// Do not modify code below this, until the end of the API hook, since it will be automatically generated again

find and add after export_constant(EFST_C_BUFF_9);

	export_constant(EFST_C_BUFF_9);
	export_constant(EFST_VIPSTATE); // VIP Status Icon

/// @APIHOOK_END

4. Open db/import/status.yml
copy and paste (your status.yml should look like this if you haven't added any custom sc_status)

Header:
  Type: STATUS_DB
  Version: 4

Body:
  - Status: Vipstate
    Icon: EFST_VIPSTATE
    Flags:
      NoDispell: true
      NoBanishingBuster: true

5. Open db/import/item_db.yml or db/pre-re/item_db_usable.yml (up to you)

  - Id: 30000
    AegisName: Vip_Card_3D
    Name: VIP Card 3D
    Type: Cash
    Buy: 20
    Weight: 10
    Trade:
      NoDrop: true
      NoSell: true
      NoGuildStorage: true
      NoMail: true
      NoAuction: true
    Script: |
      if (vip_status(VIP_STATUS_ACTIVE)) {
         dispbottom "You have extended your VIP duration.";
      } else {
         dispbottom "You have successfully become a VIP member.";
         sc_start SC_VIPSTATE,-1,1;
      }
      vip_time 4320;
  - Id: 30001
    AegisName: Vip_Card_7D
    Name: VIP Card 7D
    Type: Cash
    Buy: 20
    Weight: 10
    Trade:
      NoDrop: true
      NoSell: true
      NoGuildStorage: true
      NoMail: true
      NoAuction: true
    Script: |
      if (vip_status(VIP_STATUS_ACTIVE)) {
         dispbottom "You have extended your VIP duration.";
      } else {
         dispbottom "You have successfully become a VIP member.";
         sc_start SC_VIPSTATE,-1,1;
      }
      vip_time 10080;
  - Id: 30002
    AegisName: Vip_Card_30D
    Name: VIP Card 30D
    Type: Cash
    Buy: 20
    Weight: 10
    Trade:
      NoDrop: true
      NoSell: true
      NoGuildStorage: true
      NoMail: true
      NoAuction: true
    Script: |
      if (vip_status(VIP_STATUS_ACTIVE)) {
         dispbottom "You have extended your VIP duration.";
      } else {
         dispbottom "You have successfully become a VIP member.";
         sc_start SC_VIPSTATE,-1,1;
      }
      vip_time 43200;

6. Open npc/custom and add a text file named vip_system.txt
copy and paste

-	script	VIP_TIME	-1,{
OnPCLoginEvent:
	if (vip_status(1)) {
		.@remain = vip_status(VIP_STATUS_REMAINING); // seconds

		dispbottom "Remaining VIP duration: " + Time2Str(vip_status(VIP_STATUS_REMAINING) + gettimetick(2));
		sc_start SC_VIPSTATE, .@remain * 1000, 1;
		end;
	}

OnPCLogoutEvent:
	if (vip_status(1)) {
		sc_end SC_VIPSTATE; // remove the buff to update the timer on login
	}
	end;
}

7. Open npc/scripts_custom.conf
add to the last line

npc: npc/custom/vip_system.txt

8. Recompile your server

 

// CLIENT SIDE
1. You need four files from your RO GRF. Locate and extract them first from luafiles514/lua files/stateicon/

efstids.lub
stateiconimginfo.lub
stateiconinfo.lub
stateiconinfo_f.lub // I'm not sure if this one is necessary but I decided to include it anyway xD

2. Edit efstids.lub
Scroll down last line and add.

	EFST_VIPSTATE = 2000,

3. Edit stateiconimginfo.lub
Scroll down last line and add. Edit to your liking.

StateIconList[EFST_IDs.EFST_VIPSTATE] = {
	haveTimeLimit = 1,
	posTimeLimitStr = 2,
	descript = {
		{ "VIP", COLOR_TITLE_BUFF },
		{ "%s", COLOR_TIME },
		{ "Base EXP Rate +50%" },
		{ "Job EXP Rate +50%" },
		{ "Drop Rate +50%" },
		{ "Additional 300 Storage Slot" },
		{ "Ignore gemstone requirement for skills" },
		{ "Max character limit increase" },
		{ "Auto Attack Feature" },
	}
}

4. Edit stateiconinfo.lub
Scroll down last line and add.

		[EFST_IDs.EFST_VIPSTATE] = "vipicon.tga",

5. Edit stateiconinfo_f.lub
Scroll down last line and add.

	EFST_IDs.EFST_VIPSTATE,

Done! Congratulations!

 

Free VIP Icon from here. Put it inside your grf - data\texture\effect

Note: The timer on the VIP status icon will not be displayed if the duration exceeds 24 days and 19 hours. Unfortunately, I don't know how to make this possible either.

Edited by imat1
edited vip_system.txt

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   1 member

×
×
  • Create New...