Allow /Disallow new character

Get Help on scripting in POL with configurations, config setups, script trouble shooting, etc.

Moderator: POL Developer

Post Reply
User avatar
OldnGrey
POL Expert
Posts: 657
Joined: Sat Feb 04, 2006 6:26 pm

Allow /Disallow new character

Post by OldnGrey »

I am trying to stop a problem on my shard whereby a player will create a new character, store the starter equipment, delete the character, and repeat many times to build up a stash of money and things.

Is there any way in pol we can refuse the client's request to create a new character? Obviously I can record the old character creation time, and use that to decide, but where? By the time oncreate runs, it's already been created.
User avatar
CWO
POL Expert
Posts: 1159
Joined: Sat Feb 04, 2006 5:49 pm
Location: Chicago, IL USA

Re: Allow /Disallow new character

Post by CWO »

Don't you create the starting equipment in the OnCreate script? Why not just check it and not create the items if they're doing it too fast? And maybe then do a Start_Script at the very end of the OnCreate, wait about 2 seconds, freeze/paralyze them, SysMessage that they're creating a new char too fast, wait a few more seconds to give them a chance to read the message, disconnect, and delete.
Pierce
Forum Regular
Posts: 420
Joined: Thu Feb 02, 2006 8:33 am

Re: Allow /Disallow new character

Post by Pierce »

There are several ways to do this.
The first thing imho is to set the servspec option StartingGold to zero or
a low value like 1 or 10. The real start value could be given later in the
OnCreate script.
I personally would set a account cprop to make sure that every slot is
getting the starting gold or equipment once.

You could use an array like (e.g. char slot 2, 1200 gp):

Code: Select all

var gotstartgold := account.getprop("GotStartGold");
if(!gotstartgold)
 gotstartgold := {0, 0, 0, 0, 0, 0, 0};
endif
if(!gotstartgold[charslot])
 // give 1200 goldpieces and start equipment here
 gotstartgold[charslot] := 1200;
 account.setprop("GotStartGold", gotstartgold);
endif
You'll have to write a function to determine the charslot, e.g. going through all
slots and compare the names because imho there exist no character.slot member atm.
Tomi
POL Developer
Posts: 478
Joined: Tue Feb 21, 2006 5:08 pm

Re: Allow /Disallow new character

Post by Tomi »

One way I have seen being used alot to stop this is a timer on the character how long you have to wait until you can delete it. For example you can not delete a character you created for 1 day.
Pachacuti
Apprentice Poster
Posts: 51
Joined: Fri Jun 12, 2009 8:57 am

Re: Allow /Disallow new character

Post by Pachacuti »

Tomi wrote:One way I have seen being used alot to stop this is a timer on the character how long you have to wait until you can delete it. For example you can not delete a character you created for 1 day.
but how can I make something like this tomi?
User avatar
OldnGrey
POL Expert
Posts: 657
Joined: Sat Feb 04, 2006 6:26 pm

Re: Allow /Disallow new character

Post by OldnGrey »

I wasn't aware I could stop a player from deleting a character in pol.
Tomi
POL Developer
Posts: 478
Joined: Tue Feb 21, 2006 5:08 pm

Re: Allow /Disallow new character

Post by Tomi »

Pachacuti oncreate and candelete scripts in scripts/misc

store a prop on the character in oncreate and check for that against some timer in candelete.

OldnGrey candelete controls if the character can be deleted or not.
User avatar
OldnGrey
POL Expert
Posts: 657
Joined: Sat Feb 04, 2006 6:26 pm

Re: Allow /Disallow new character

Post by OldnGrey »

Great Tomi.
That solves my problem. I simply won't allow them to delete a new character within a day of creating it.
JaceAce
Expert Poster
Posts: 74
Joined: Fri Feb 29, 2008 10:56 pm

Re: Allow /Disallow new character

Post by JaceAce »

Another idea, i was thinking about ( not sure if it would work but ill throw it out there anyway) ...

Put a property on all the items created in the beginning for a newcharacter...
Like a player serial number and maybe a date of creation...

You would also want to put a property on the player with the same date of creation

var systemtime := time right now

var newbiearray := { newcharacter.serial, systemtime }
SetObjProperty(newbieItem, "newbieitem", newbiearray)

SetObjProperty(newcharacter, "creationdate", systemtime);

Then, in the equip.src or equiptest.src

have it do a quick check for the "newbieitem" property...

if ( "newbieitem" property exists )
....if (currentcharacter.serial != newbiesavedserial)
........Destroy the item.
....endif
....elseif ( currentcharacter.serial == newbiesavedserial)
..........if ( "newbieitem" property system time != currentcharacter property "creation date" )
...............Destroy the item
..........endif
....endif
endif

You could expand on the concept with time delays etc ...

The equip and equiptest ( would be for equipment ) for gold or items that you dont equip maybe in the can insert script....

Just an idea...
Gnafu
Grandmaster Poster
Posts: 136
Joined: Thu Feb 02, 2006 7:29 am
Location: Livorno, Italy
Contact:

Re: Allow /Disallow new character

Post by Gnafu »

In our shard, players must wait 2 days before they can re-create a character after deleting one.
It's done by deleting the new char if the timer on the account hasn't passed (oncreate.ecl)

(I know.. orrible english, sorry)
Pachacuti
Apprentice Poster
Posts: 51
Joined: Fri Jun 12, 2009 8:57 am

Re: Allow /Disallow new character

Post by Pachacuti »

Gnafu wrote: (I know.. orrible english, sorry)
the only mistake I saw was the "orrible" >_<

but mine isn't good too :D
User avatar
OldnGrey
POL Expert
Posts: 657
Joined: Sat Feb 04, 2006 6:26 pm

Re: Allow /Disallow new character

Post by OldnGrey »

Now I have a slightly more interesting thing... :)

We are allowing more than one character per account but only after they achieve a certain point in the game. So.... Gnafu's idea is now of interest.

Since we don't have CanCreate (looks at MuadDib), is it really feasible to have OnCreate have a line that deletes the character itself? I would expect that to cause a bit of havoc!
Gnafu
Grandmaster Poster
Posts: 136
Joined: Thu Feb 02, 2006 7:29 am
Location: Livorno, Italy
Contact:

Re: Allow /Disallow new character

Post by Gnafu »

I know what you say, I had some trouble deletting a npc within it's own script.
The character deletion is done in this way:

Code: Select all

[... bla bla ... hey, you can't create the char! ]
[ Set some property to the char saying it must be deletted]
detach();
DisconnectClient (who);
sleep (2);
// idx = get the character slot in the account
Start_Script (":uty:deletechar", {acc , idx});
Set_Critical(0);
return;
The "deletechar" script it's an utility for deletting chars on a given account, it simply does a "acc.DeleteCharacter(idx);" after some logging and checking. I think that after a detach() the scripts itself can destroy the char, but I never tried.

The Oncreate script can be modified to set a maximum number of characters an account can have, or to allow the creation only on specific condittions, like you said.
MuadDib
Former Developer
Posts: 1091
Joined: Sun Feb 12, 2006 9:50 pm
Location: Cross Lanes, WV

Re: Allow /Disallow new character

Post by MuadDib »

.... packethooks to check prior to even allowing, and if not, create a reply to disallow so client can move on and back to char selection list (and block 0x0 packet)?
Tomi
POL Developer
Posts: 478
Joined: Tue Feb 21, 2006 5:08 pm

Re: Allow /Disallow new character

Post by Tomi »

CanCreate can be done by packethooks and packet 0x00

but having the client going back to character selection is another thing..
xeon
Forum Regular
Posts: 338
Joined: Fri Oct 31, 2008 3:18 am
Location: Italy

Re: Allow /Disallow new character

Post by xeon »

Sorry to up an old thread, but I've just done this:
Tomi wrote:CanCreate can be done by packethooks and packet 0x00

but having the client going back to character selection is another thing..

I've create the packethook, and I can block new characters creation. Now I would like to be able to make the client fallback to some point of the login procedure, and not just hang.

The first problem is that SendPacket() need an online character reference to work.
There's some way around this?
Tomi
POL Developer
Posts: 478
Joined: Tue Feb 21, 2006 5:08 pm

Re: Allow /Disallow new character

Post by Tomi »

if you build the core from the latest SVN there is the client objref that you can use to send a packet back with, so now this should be fully possible by packethooks.
xeon
Forum Regular
Posts: 338
Joined: Fri Oct 31, 2008 3:18 am
Location: Italy

Re: Allow /Disallow new character

Post by xeon »

Ah! Ok.

Another reason to upgrade POL version ASAP.

Thank you!
Post Reply