PenUltima Online Forum Index Official Core: 096.7
Official Core: 097 2008-02-26
Donate towards the POL web hosting bill!
 POL Home   FAQ   Search    Memberlist   Usergroups    Register    Profile   Log in to check your private messages   Log in
Couple questions about creating new characters

 
Post new topic   Reply to topic    PenUltima Online Forum Index -> General Help 096
Display posts from previous:   

Author Message
Datus



Joined: 19 Sep 2006
Posts: 58

PostPosted: Thu Mar 01, 2007 4:18 pm    Post subject: Couple questions about creating new characters Reply with quote

Is it possible to remove the Advanced option on the class selection menu? It's not in the prof file ...

Also... how do I restrict how many characters are allowed per account?

Thanks.

Author Message
Yukiko



Joined: 02 Feb 2006
Posts: 1094
Location: Southern Central USA

PostPosted: Fri Mar 02, 2007 4:50 am    Post subject: Reply with quote

This might be what you need to limit characters.

In \pol\scripts\misc in oncreate.src after the following code:
Code:

    syslog("ALERT! Account " + account.name + " was banned for cheating.");
  endif


add this:

Code:

  var maxchars := 5; // Maximum allowed characters.
  var numchars := 0; // Counter for use later
    for i := 1 to 5
        var chr := account.GetCharacter(i);
        if (!chr)
            continue;
        else
            numchars := numchars + 1;
        endif
    endfor
   
    if (numchars > maxchars)
        who.paralyzed :=1;
        SendSysMessage(who, "You have exceeded the maximum allowable characters!!!", 2, 33);
        SendSysMessage(who, "In 30 seconds this character will be deleted.", 2, 33);
        Sleep(30);
        DisconnectClient( victim );
        account.DeleteCharacter( i );
    endif


The only caveat is that the character must be in a safe logout (insta log) location when she enters the world for the account.DeleteCharacter to operate correctly. If she is in a delayed logout condition then the account.DeleteCharacter doesn't work or atleast it didn't in POL 95.

I think that scriptlet will work.

NOTE: This is is compatible with a converted POL 0.95 scripset only.

Author Message
Barbeirosa



Joined: 01 Feb 2007
Posts: 43

PostPosted: Fri Mar 02, 2007 6:58 am    Post subject: Reply with quote

I hope anyone who uses that script as written is ready for some big-time nightmares.

Let's first assume that characters won't be created in a "insta-log" area. But even if we don't assume that, the script there gives the character plenty of time to run to such a place. Most people completely ignore login messages, so I guarantee they'll usually miss that message, and go running off to play, and find themselves kicked off for reasons they don't understand.

Maybe, after it happens a couple times, they'll realize why. They'll be confused about why their character isn't actually being deleted, though. So, maybe they'll log in one of their real characters to check it. They'll see that SAME MESSAGE. And they won't know this... but if they don't run that character RIGHT AWAY away from a zero-timeout location, it will be THAT character that will be deleted.

*sigh*


First problem: They should be logged off immediately when this happens... not have it wait 30 seconds. Put in a sleep of a second to assure they get the message. Better yet, make the message a GUMP, so they can't miss it. But then kick them out immediately, and MARK THE CHARACTER with a CProp to note that it must be deleted. The 30-second sleep is a decent idea - but AFTER kicking them off and marking them with a CProp. Not before.

When counting characters in this script, then, you must also check for this CProp, and ONLY count characters that don't have this CProp. If anyone ever logs in a char with this CProp, just kick and delete, without even bothering counting. Otherwise, count ONLY those without the CProp, and...

Finally, after you kick them off, for heaven's sake, don't leave things up to chance!!! Move their character to a zero-timeout location first!


Whoever wrote the above script needs some logic lessons before any more scripting lessons, I think. Embarassed

Author Message
Datus



Joined: 19 Sep 2006
Posts: 58

PostPosted: Fri Mar 02, 2007 9:08 am    Post subject: Reply with quote

barb,

Now I could be wrong here but I believe the "who.paralyzed :=1; " part means the character is now paralyzed and cannot "go running off to play".

Besides, anyone who goes running off to play on my shard gets killed instantly ... it's part of the magic.

Anyway this script looks good to me and if nothing more gives me something to work with.

Thanks Yukiko

Author Message
Barbeirosa



Joined: 01 Feb 2007
Posts: 43

PostPosted: Fri Mar 02, 2007 4:15 pm    Post subject: Reply with quote

Datus wrote:
barb,

Now I could be wrong here but I believe the "who.paralyzed :=1; " part means the character is now paralyzed and cannot "go running off to play".


Granted. But maybe read beyond the first sentence or two, mkay? Or have fun dealing with players who get their 7xGM character deleted because of the above script.

Author Message
Datus



Joined: 19 Sep 2006
Posts: 58

PostPosted: Fri Mar 02, 2007 10:21 pm    Post subject: Reply with quote

Ok I'm convinced now that Barbeirosa is a joke... so I'm going to ignore him... unless he does a really amazing trick ... like actually post his own code.

Author Message
Barbeirosa



Joined: 01 Feb 2007
Posts: 43

PostPosted: Sat Mar 03, 2007 3:28 am    Post subject: Reply with quote

This is the only time I will do this, and only to prove you wrong. I told you how to do it, it should have been a simple matter to figure out. But here it is. Next time, I'm sure you'll be able to figure it out yourself.

Code:

var account := who.acct;
var INVALID_CHAR_CPROP := "INVALID_CHARACTER";
var maxchars := 5;
var numchars := 0;
var myindex := 0;
if (GetObjProperty(who, INVALID_CHAR_CPROP))
   numchars := maxchars + 1;
endif
var i;
for (i:=1;i<=5;i:=i+1)
   var chr := account.GetCharacter(i);
   if (chr)
      if (!GetObjProperty(chr, INVALID_CHAR_CPROP))
         numchars := numchars + 1;
      endif
      if (chr==who)
         myindex := i;
      endif
   endif
endfor

if (numchars > maxchars && myindex)
   who.paralyzed :=1;
   SendSysMessage(who, "You have exceeded the maximum allowable characters ("+cstr(maxchars)+") This character will be deleted.", FONT_BOLD, FONTCOLOR_RED);
   Sleep(1);
   SetObjProperty(who, INVALID_CHAR_CPROP, 1);

   var x, y, z; //set x, y, z to a closed 'insta-log' location

   MoveCharacterToLocation(who, x, y, z, MOVECHAR_FORCELOCATION);   
   DisconnectClient(who);
   sleep(30);
   account.DeleteCharacter(myindex);
endif


If there are any typos in the code, feel free to ask about them. I did not bother mentioning the typos in the code I fixed that would have resulted in other errors (like, always deleting the 5th character, no matter which character was actually the one logged on)

Author Message
Datus



Joined: 19 Sep 2006
Posts: 58

PostPosted: Sat Mar 03, 2007 10:50 pm    Post subject: Reply with quote

that's pretty crappy barbie...

you just copied 90% of what yukiko already wrote... and you can prove me wrong by not being a weenie.

Author Message
Barbeirosa



Joined: 01 Feb 2007
Posts: 43

PostPosted: Sun Mar 04, 2007 3:26 am    Post subject: Reply with quote

Datus wrote:
that's pretty crappy barbie...

you just copied 90% of what yukiko already wrote...


Except I fixed the numerous errors which would have had your players pretty pissed. Crappy? Fine. I already said I won't do it again. Next time, just use whatever you find!

Author Message
Yukiko



Joined: 02 Feb 2006
Posts: 1094
Location: Southern Central USA

PostPosted: Mon Mar 05, 2007 2:01 am    Post subject: Reply with quote

A couple of things:

1. I made that post as my lappy battery was getting low so I was afraid I'd lose power and didn't have time to script a gump call. Hence the message being in RED and being set to font 2, an expanded larger font than the default font.

2. I mentioned the caveat about needing an insta log location for character creation because I assumed that most shard owners chose the location the character enters the world. If they don't know how to do that then please ask and I am sure Barbarosa can explain it to them.

Barbarosa wrote:
Quote:
Better yet, make the message a GUMP, so they can't miss it. But then kick them out immediately...

3. Wouldn't kicking the player immediately after sending a gump disconnect them and therefore prevent them from seeing it? I haven't checked that out yet but it might not give the desired result.

I do agree that a non closable gump would be the ideal way of informing the player but as I said I was up against the clock that night. By the way I did miss seeing that gump code in your "new and improved" version of my scriptlet Barbie.

As for any other criticisms of my code...

Author Message
Barbeirosa



Joined: 01 Feb 2007
Posts: 43

PostPosted: Mon Mar 05, 2007 4:18 am    Post subject: Reply with quote

Yukiko wrote:

3. Wouldn't kicking the player immediately after sending a gump disconnect them and therefore prevent them from seeing it? I haven't checked that out yet but it might not give the desired result.


Yes it would, which is why I put in a one-second sleep after.

Your code gave a great basic idea how to do what was asked but the problem is a lot of the time people just cut and paste exactly what is posted without ever looking at it. Your original post almost seemed to suggest doing exactly that. But as far as offering help for the general idea it was great and as dattie said I basically copied it for my own post.


As for the other topic in this thread; you can't really remove the advanced option but you can sort of hide it. Just add more entries to the prof.txt file to push the advanced option out of the way. 6 entries pushes it down. The result is not pretty but it may work for you.

Post new topic   Reply to topic    PenUltima Online Forum Index -> General Help 096 All times are GMT - 4 Hours
Page 1 of 1

 




Powered by phpBB © 2001, 2005 phpBB Group :: Theme & Graphics by GHS & Scott E. Royalty