Jump to content

Character Deletion on Death


Nova

Recommended Posts


  • Group:  Members
  • Topic Count:  14
  • Topics Per Day:  0.00
  • Content Count:  265
  • Reputation:   95
  • Joined:  09/30/14
  • Last Seen:  

Someone recently requested this from me so I figure I'd share it with the community.

Be very careful about randomly throwing this on your own real server please, and warn your players about it.

-	script	PERMANENTDEATH	-1,{
end;

OnPCDieEvent:
	set .@deadplayer,getcharid(0);
	message strcharinfo(0),"Game Over";
	atcommand "@kick "+strcharinfo(0);
	set .@j, getarraysize( .char_delete$ );
	for (.@i = 0; .@i < .@j; .@i++) {
    query_sql("DELETE FROM `"+ .char_delete$[.@i] +"` WHERE `char_id` = '"+ .@deadplayer +"'");
	}
	query_sql "DELETE FROM `party` WHERE `leader_char` = '"+.@deadplayer+"'";
	end;
	
OnInit:
setarray .char_delete$[0],"bonus_script","char","cart_inventory","elemental","friends","global_reg_value","guild","guild_member","homunculus","hotkey","inventory","memo","mercenary","mercenary_owner","pet","quest","sc_data","skill","skillcooldown";
end;
	
}

I was thinking about adding an NPC that would set a character variable to select if they wanted to opt-in to "Hardcore" mode, and give them benefits for doing so, and having people without the character variable not be affected by it, but that should be easy to add.

 

The only detail is I get a "[Error]: chrif_ack_login_req failed - player not online." but I believe it might be because I have other OnPCDieEvent labels that are attempting to run, didn't have time to confirm if this was the problem or not. But the deletion goes through just fine and the server doesn't seem to be affected by it at all.

 

Enjoy! (Yay my first public release)

 

X0v7aZN.png

 

Edit: Thanks to my friend Tokei for making me use better loops.

 

Here's the version for the upgraded script engine:

-	script	PERMANENTDEATH	-1,{
end;

OnPCDieEvent:
	set .@deadplayer,getcharid(0);
	message strcharinfo(0),"Game Over";
	atcommand "@kick "+strcharinfo(0);
	set .@j, getarraysize( .char_delete$ );
	for (.@i = 0; .@i < .@j; .@i++) {
    query_sql("DELETE FROM `"+ .char_delete$[.@i] +"` WHERE `char_id` = '"+ .@deadplayer +"'");
	}
	query_sql "DELETE FROM `party` WHERE `leader_char` = '"+.@deadplayer+"'";
	end;
	
OnInit:
setarray .char_delete$[0],"bonus_script","char","cart_inventory","elemental","friends","char_reg_str","char_reg_num","guild","guild_member","homunculus","hotkey","inventory","memo","mercenary","mercenary_owner","pet","quest","sc_data","skill","skillcooldown";
end;
	
}

Have not tested this one, but it should work fine :]

Edited by Nova
  • Upvote 2
Link to comment
Share on other sites

  • 3 weeks later...

  • Group:  Developer
  • Topic Count:  48
  • Topics Per Day:  0.01
  • Content Count:  1443
  • Reputation:   337
  • Joined:  10/17/12
  • Last Seen:  

<3 Hardcore Mode

Link to comment
Share on other sites

  • 7 months later...

  • Group:  Members
  • Topic Count:  50
  • Topics Per Day:  0.01
  • Content Count:  974
  • Reputation:   41
  • Joined:  11/13/11
  • Last Seen:  

This is too hardcore <3

Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  14
  • Topics Per Day:  0.00
  • Content Count:  265
  • Reputation:   95
  • Joined:  09/30/14
  • Last Seen:  

Added a slightly modified version for people running with the script engine upgrade below. :]

Link to comment
Share on other sites

  • 3 months later...

  • Group:  Members
  • Topic Count:  50
  • Topics Per Day:  0.01
  • Content Count:  974
  • Reputation:   41
  • Joined:  11/13/11
  • Last Seen:  

is this one still working? HAHA /heh

Link to comment
Share on other sites

  • 1 month later...

  • Group:  Members
  • Topic Count:  1
  • Topics Per Day:  0.00
  • Content Count:  3
  • Reputation:   1
  • Joined:  07/12/13
  • Last Seen:  

So hardcore but really Like this haha

  • Upvote 1
Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  14
  • Topics Per Day:  0.00
  • Content Count:  265
  • Reputation:   95
  • Joined:  09/30/14
  • Last Seen:  

is this one still working? HAHA /heh

 

Should be working! If it's not, let me know and I'll fix it up.

Link to comment
Share on other sites

  • 1 month later...

  • Group:  Members
  • Topic Count:  1
  • Topics Per Day:  0.00
  • Content Count:  9
  • Reputation:   0
  • Joined:  04/16/16
  • Last Seen:  

it's sooooooooooo cooooool !!! thx :)

Link to comment
Share on other sites

  • 2 years later...

  • Group:  Members
  • Topic Count:  66
  • Topics Per Day:  0.01
  • Content Count:  223
  • Reputation:   4
  • Joined:  02/23/12
  • Last Seen:  

On 4/21/2016 at 6:36 PM, Nova said:

 

Should be working! If it's not, let me know and I'll fix it up.

could you add that only delet the char if dies in certain map

Link to comment
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
Reply to this topic...

×   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.

×
×
  • Create New...