Jump to content
Nova

Character Deletion on Death

Recommended Posts

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 [email protected],getcharid(0);
	message strcharinfo(0),"Game Over";
	atcommand "@kick "+strcharinfo(0);
	set [email protected], getarraysize( .char_delete$ );
	for ([email protected] = 0; [email protected] < [email protected]; [email protected]++) {
    query_sql("DELETE FROM `"+ .char_delete$[[email protected]] +"` WHERE `char_id` = '"+ [email protected] +"'");
	}
	query_sql "DELETE FROM `party` WHERE `leader_char` = '"[email protected]+"'";
	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 [email protected],getcharid(0);
	message strcharinfo(0),"Game Over";
	atcommand "@kick "+strcharinfo(0);
	set [email protected], getarraysize( .char_delete$ );
	for ([email protected] = 0; [email protected] < [email protected]; [email protected]++) {
    query_sql("DELETE FROM `"+ .char_delete$[[email protected]] +"` WHERE `char_id` = '"+ [email protected] +"'");
	}
	query_sql "DELETE FROM `party` WHERE `leader_char` = '"[email protected]+"'";
	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

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

Important Information

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