Graal Forums

Graal Forums (https://forums.graalonline.com/forums/index.php)
-   NPC Scripting (https://forums.graalonline.com/forums/forumdisplay.php?f=8)
-   -   Class Equilization (https://forums.graalonline.com/forums/showthread.php?t=26709)

nyghtGT 03-31-2002 05:12 PM

Class Equilization
 
OK, this is an NPC I am working on for Eternal Destiny so please dont steal it. I would like to know some things i could do to make it better plus any tips to get it to work right.
NPC Code:

NPC Code:

// NPC made by Nyght
// Class Equilization
if (playerenters&&!joined) {
set joined;
setstring server.people,#v(strtofloat(#s(server.people))+=1) ;
}
if (playerchats&&startswith(joinclass,#c)) {
this.warrior=strtofloat(#s(server.people))*.30;
tokenize #c;
if (strequals(#t(1),warrior)) {
if (this.warrior<strtofloat(#s(server.warrior))) {
message You can not choose this class because it allready has enough participants!;
sleep 1.25;
message ;
} else {
joinclasswarrior();
}
}
message If you are not transfered to class level, check spelling and try again!;
}
// Functions
function joinclasswarrior() {
set warriorclass;
setstring server.warrior,#v(strtofloat(#s(server.warrior))+= 1);
setlevel2 warrior.graal,32,32;
}




Its rougly suppose to work out like, if the warrior class is less then 30% of the servers total population then the person can join the class ...

Please, any help is appreciated ...

Cybnext_Design 03-31-2002 05:32 PM

NPC Code:

// NPC made by Nyght
// Class Equilization
if (playerenters&&!joined) {
set joined;
setstring server.people,#v(strtofloat(#s(server.people))+1);
}

if (playerchats&&startswith(joinclass,#c)) {
this.warrior=strtofloat(#s(server.warrior))/strtofloat(#s(server.people));
tokenize #c;
if (strequals(#t(1),warrior)) {
if (this.warrior>0.3) {
message You can not choose this class because it allready has enough participants!;
sleep 1.25;
message ;
} else {
joinclasswarrior();
}
}
message If you are not transfered to class level, check spelling and try again!;
}
// Functions
function joinclasswarrior() {
set warriorclass;
setstring server.warrior,#v(strtofloat(#s(server.warrior))+1 );
setlevel2 warrior.graal,32,32;
}



This should work how you want it to.

nyghtGT 03-31-2002 05:47 PM

Quote:

Originally posted by Cybnext_Design

This should work how you want it to.

Thanx, i'll go check ...

Seems to work allright, thanx Cybnext ....

royce 04-01-2002 02:46 AM

I thought join was for p2p only?

jeff335 04-01-2002 03:30 AM

he's not using join lol

Saga2001 04-01-2002 12:36 PM

Quote:

Originally posted by royce
I thought join was for p2p only?
rofl
rofl
rofl
hes setting the flag joined, not joining an npc...

royce 04-02-2002 01:10 AM

Quote:

Originally posted by Saga2001


rofl
rofl
rofl
hes setting the flag joined, not joining an npc...

It was 2 in the morning -_-

nyghtGT 04-02-2002 11:50 AM

Quote:

Originally posted by royce


It was 2 in the morning -_-

excuses, but, 'joinclasswarrior()' make the function of that occur ...

prozac424242 04-07-2002 10:29 PM

ok...
 
remember to find some way to unset joined
so that when the player logs out
and reconnect to the server, that "joined" is unset.

or otherwise detect - has this player chosen a class already?
if so, add him to the server.whatever-his-class-is count.

other than that, cool idea.

Er1c 04-08-2002 05:10 AM

if people's accounts get reset it will mess up the count... keep that in mind

Saga2001 04-08-2002 04:25 PM

Quote:

Originally posted by Er1c
if people's accounts get reset it will mess up the count... keep that in mind
sliced by the seer of er1c's cold blade of fate. ;)

nyghtGT 04-08-2002 06:00 PM

Quote:

Originally posted by Er1c
if people's accounts get reset it will mess up the count... keep that in mind
i did think of that ...
and hopefully we wont ever have to reset an account ...
but subtracted one from the server total as well as from the class he joined could fix that, it'd be a hassel but it could work ...

royce 04-09-2002 03:20 AM

Quote:

Originally posted by nyghtGT

i did think of that ...
and hopefully we wont ever have to reset an account ...
but subtracted one from the server total as well as from the class he joined could fix that, it'd be a hassel but it could work ...

No reseting accounts waht-so-ever. Even if the players want a account reset we will not and should not reset it. If we have enough problems with players and other stuff we might request a server restart but thats it. Reseting account is just dumb for stuff that you have a class to stick to.


All times are GMT +2. The time now is 11:09 PM.

Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2026, vBulletin Solutions Inc.
Copyright (C) 1998-2019 Toonslab All Rights Reserved.