Post Reply 
 
Thread Rating:
  • 0 Votes - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Multiplayer level system implementation
Author Message
Claus
Apprentice
*

Posts: 17
Likes Given: 3
Likes Received: 0 in 0 posts
Joined: Jan 2014
Reputation: 0



Post: #1
Multiplayer level system implementation
In reference to this script,
Quote:https://forum.spherecommunity.net/Thread...b-to-0-56d
with which I had some problems, but which I managed to solve with your help, I would like a hand for some implementations.

Now I'm trying to bring this system to a multiplayer level. Let me explain better, I would like to ensure that the players in the group (creating a party) by killing a monster all get experience from the monster.

The system should be structured like this:

There is a group leader who creates the party (eg .party) up to a maximum of 6-8 people. The group leader must be of the highest level. When you kill a monster the exp is given to all members.

Also when you go in a group there is a 30% exp expo bonus (ex if the monster gives 100 alone, in group 130)

Furthermore, the party also has a private chat (example .p sentence to say) and the players do not necessarily have to hit the monster as long as they are in the same area (I believe that the REGION can be useful in this sense)
Finally, to avoid that people of too high level help those who are too low I thought of a delta between the levels of maybe 5 (the group leader is lv 20 can group minimum lv 15)

For the party I found this script (see at the end) in the packs already on the site, I would like to implement the two things, but I have no idea how to proceed.
I believe that at this point I would redo the place in the "script request" section, in the case that everything is placed in the correct section.

Party System
Quote:[plevel 1]
party

[ITEMDEF i_party]
DEFNAME i_party
NAME=Party Memory [DO NOT REMOVE]
ID=i_memory
TYPE=T_EQ_SCRIPT
LAYER=30


[ITEMDEF i_partylink]
NAME=Party Link Memory [DO NOT REMOVE]
ID=i_memory
TYPE=T_EQ_SCRIPT
LAYER=30

[ITEMDEF i_partyreq]
NAME=Party Request Memory [DO NOT REMOVE]
ID=i_memory
TYPE=T_EQ_SCRIPT
LAYER=30

[ITEMDEF i_party_targ]
Name=Party Target Memory [DO NOT REMOVE]
ID=i_memory
TYPE=T_EQ_SCRIPT
LAYER=30

on @timer
remove
return 1

on @targon_char
//This memory will only be used for adding for now, so there will be no check for what it is for.
//Possibly in later days it'll be defined by a tag and an integer.
//TAG.SLOT will be the slot they'll be added in for the party.
if (<src.targ.npc>)
src.sysmessage You may not add an NPC to the party.
else
if (<Src.targ.flags>& statf_war)
//Client is in warmode, deny
src.sysmessage The Target is in warmode and can't be partied.
return 1
endif
//Target is a real player lets try Shock
if (<src.targ.findid.i_partylink>)
//Target is already in a party
src.sysmessage <src.targ.name> is already in a party.
elseif (<src.targ.findid.i_partyreq>)
src.sysmessage <src.targ.name> is already requested to be in a party.
else
//Member is good to be asked to join the party
try SRC.findid.i_party.tag.p.<eval <tag.slot>>.uid=<src.targ.uid>
src.sysmessage Sending <src.targ.name> a request to join the party.
src.newitem i_partyreq
src.act.link <src.findid.i_party.uid>
src.act.tag.slot = <tag.slot>
src.act.cont = <src.targ.uid>
trysrc <src.targ.uid> dialog d_party_invite

endif
endif

return 1

[events e_party]
on @death
f_partybroadcast has been killed by <qval (<act.uid>==<src.uid>) ? Accident : <act.name>>

on @disconnect
if (<findid.i_party>)
f_disbandparty
elseif (0<findid.i_partylink>)
f_leaveparty
endif



[function party]
//Replacement for Sphere's party system which has multiple bugs,
//This party system will include many features and abuse checks that the sphere party system didn't allow.
//When typing .Party with no arguements it'll bring up your party menu, which will be a gump with a list of party members,
//the maximum amount of party members will be 6, If you were added to the party the gump that'll pop up will be a gump
//With limited options, the only options that you will have is to whisper to a specific member, and to leave the party.
//The person who did the adding will be the one who controls the party and will be able to add additional members,
//kick members, and also of course be able to whisper to members.
//Restrictions: The person being will only be able to requested once.
if (STRMATCH("<args>","")
//No Arguements lets bring up the dialog.
if (<findid.i_party>)
//Owner of the Party.
dialog d_party_master
elseif (0<findid.i_partylink>)
//In a party
dialog d_party_member
else
//Not in a party, would you like to create one?
dialog d_party_create
endif
elseif (STRMATCH("<ARGS>","disband")
if (<findid.i_party>)
//Owner of the party were able to disband!
f_disbandparty
elseif (0<findid.i_partylink>)
sysmessage You are not the master of a party, use .party leave instead!.
else
sysmessage You are not in a party.
endif
elseif (STRMATCH("<ARGS>","leave")
if (<findid.i_party>)
sysmessage You are the master of a party, use .party disband instead!.
elseif (0<findid.i_partylink>)
f_leaveparty
else
sysmessage You are not in a party.
endif
else
//Client would like to send a party message.
//Is he in a party?
if (0<findid.i_partylink>)
//Client is in a party lets broadcast the Message
f_partybroadcast <args>
else
sysmessage You are not in a party
endif
endif
[function f_leaveparty]
f_partybroadcast has left the party.
if (<findid.i_partylink.link.tag.p.1.uid>==<uid>)
try findid.i_partylink.link.tag.p.1.uid=0
elseif (<findid.i_partylink.link.tag.p.2.uid>==<uid>)
try findid.i_partylink.link.tag.p.2.uid=0
elseif (<findid.i_partylink.link.tag.p.3.uid>==<uid>)
try findid.i_partylink.link.tag.p.3.uid=0
elseif (<findid.i_partylink.link.tag.p.4.uid>==<uid>)
try findid.i_partylink.link.tag.p.4.uid=0
elseif (<findid.i_partylink.link.tag.p.5.uid>==<uid>)
try findid.i_partylink.link.tag.p.5.uid=0
elseif (<findid.i_partylink.link.tag.p.6.uid>==<uid>)
try findid.i_partylink.link.tag.p.6.uid=0
endif
events -e_party
sysmessage You have left the party.
return 1


[function f_disbandparty]
f_partybroadcast has disbanded the party.
if (<findid.i_party.tag.p.1.uid>)
try uid.<findid.i_party.tag.p.1.uid>.findid.i_partylink.remove
endif
if (<findid.i_party.tag.p.2.uid>)
try uid.<findid.i_party.tag.p.2.uid>.findid.i_partylink.remove
endif
if (<findid.i_party.tag.p.3.uid>)
try uid.<findid.i_party.tag.p.3.uid>.findid.i_partylink.remove
endif
if (<findid.i_party.tag.p.4.uid>)
try uid.<findid.i_party.tag.p.4.uid>.findid.i_partylink.remove
endif
if (<findid.i_party.tag.p.5.uid>)
try uid.<findid.i_party.tag.p.5.uid>.findid.i_partylink.remove
endif
if (<findid.i_party.tag.p.6.uid>)
try uid.<findid.i_party.tag.p.6.uid>.findid.i_partylink.remove
endif
findid.i_party.remove
sysmessage Your party has been disbanded.
events -e_party
return 1

[function f_partybroadcast]
var.party.msg = <args>
var.party.uid=<src.findid.i_partylink.link>
serv.allclients f_partybroadcast_receive

[function f_partybroadcast_receive]
if (<findid.i_partylink>)
//Client is in a party, but is it the right one?
if (<findid.i_partylink.link.uid> == <var.party.uid>)
//They are in the right party! lets broadcast the msg
sysmessage @14 [ <src.name> ] : <var.party.msg>
endif
endif
return 1


[dialog d_party_invite]
200,200

page 0

resizepic 0 0 5054 425 300
gumppic 76 8 1143 // 400 20
resizepic 10 40 3000 400 250

text 27 45 0 1 0
text 27 65 0 2 0
text 23 125 0 3 0
text 23 145 0 4 0
text 23 165 0 5 0
text 23 185 0 6 0

//Agree
button 390 270 5601 5605 1 0 1
text 45 265 0 8 0
//Disagree
button 20 270 5603 5607 1 0 0
text 325 265 0 7 0


text 130 10 0 0 0

[dialog d_party_invite text]
Party System by Coptus
You've been invited to join a party!
<src.findid.i_partyreq.link.cont.name> and friends would like you to join!
Rules:
No Abusing party system, (Partyban, Jail, Ban)
No abusive behavior (Spamming) (Partyban, Jail, Ban)
No advertising other shards/servers. (Ban)
I Agree
I do not Agree

[dialog d_party_invite button]

on=1
//Accepted friends request.
src.findid.i_partyreq.id=i_partylink
src.findid.i_partylink.link.cont.sysmessage <src.name> Has accepted your request for party.
src.sysmessage You have accepted the request.
src.events +e_party
//Broadcast join to the party.
src.f_partybroadcast has joined the party.

on=0
src.sysmessage Canceled, You don't agree.
src.findid.i_partyreq.link.cont.sysmessage <src.name> Has denied your request for party.
try src.findid.i_partyreq.link.tag.p.<eval <src.findid.i_partyreq.tag.slot>>.uid=0
src.findid.i_partyreq.remove




[dialog d_party_create]
200,200

page 0

resizepic 0 0 5054 425 300
gumppic 76 8 1143 // 400 20
resizepic 10 40 3000 400 250

text 27 45 0 1 0
text 27 65 0 2 0
text 23 125 0 3 0
text 23 145 0 4 0
text 23 165 0 5 0
text 23 185 0 6 0

//Agree
button 390 270 5601 5605 1 0 1
text 45 265 0 8 0
//Disagree
button 20 270 5603 5607 1 0 0
text 325 265 0 7 0


text 130 10 0 0 0

[dialog d_party_create text]
Party System by Coptus
The party system is a system designed to allow
players to talk with a select group of friends,
Rules:
No Abusing party system, (Partyban, Jail, Ban)
No abusive behavior (Spamming) (Partyban, Jail, Ban)
No advertising other shards/servers. (Ban)
I Agree
I do not Agree

[dialog d_party_create button]

on=1
src.newitem i_party
src.act.tag.p.1.uid=<src.uid>
src.act.tag.p.2.uid=0
src.act.tag.p.3.uid=0
src.act.tag.p.4.uid=0
src.act.tag.p.5.uid=0
src.act.tag.p.6.uid=0
local.partyuid=<src.act.uid>

src.act.equip
src.sysmessage You have created a party, type .party again to add members.

src.newitem i_partylink
src.act.link <local.partyuid>
src.act.equip
events +e_party

on=0
src.sysmessage Canceled, You don't agree.


[dialog d_party_master]
200,200

page 0

resizepic 0 0 5054 425 300
gumppic 76 8 1143 // 400 20
resizepic 10 40 3000 400 250

//text 27 45 0 1 0

button 390 270 5601 5605 1 0 1
button 20 270 5603 5607 1 0 0

resizepic 60 60 3000 250 22
text 60 60 0 1 0
resizepic 60 90 3000 250 22
text 60 90 0 2 0
resizepic 60 120 3000 250 22
text 60 120 0 3 0
resizepic 60 150 3000 250 22
text 60 150 0 4 0
resizepic 60 180 3000 250 22
text 60 180 0 5 0
resizepic 60 210 3000 250 22
text 60 210 0 6 0

text 15 20 0 7 0
text 375 20 0 8 0

button 25 65 2104 2103 1 0 2
button 25 95 2104 2103 1 0 3
button 25 125 2104 2103 1 0 4
button 25 155 2104 2103 1 0 5
button 25 185 2104 2103 1 0 6
button 25 215 2104 2103 1 0 7

//2-7 Are Kick buttons.

button 385 65 2104 2103 1 0 8
button 385 95 2104 2103 1 0 9
button 385 125 2104 2103 1 0 10
button 385 155 2104 2103 1 0 11
button 385 185 2104 2103 1 0 12
button 385 215 2104 2103 1 0 13

//8-13 Are Add buttons.

text 130 10 0 0 0

[dialog d_party_master text]
Party System
<qval (0<findid.i_party.tag.p.1.uid>) ? <uid.<findid.i_party.tag.p.1.uid>.name> : Slot 1>
<qval (0<findid.i_party.tag.p.2.uid>) ? <uid.<findid.i_party.tag.p.2.uid>.name> : Slot 2>
<qval (0<findid.i_party.tag.p.3.uid>) ? <uid.<findid.i_party.tag.p.3.uid>.name> : Slot 3>
<qval (0<findid.i_party.tag.p.4.uid>) ? <uid.<findid.i_party.tag.p.4.uid>.name> : Slot 4>
<qval (0<findid.i_party.tag.p.5.uid>) ? <uid.<findid.i_party.tag.p.5.uid>.name> : Slot 5>
<qval (0<findid.i_party.tag.p.6.uid>) ? <uid.<findid.i_party.tag.p.6.uid>.name> : Slot 6>
Kick
Add
[dialog d_party_master button]
onbutton=2
src.sysmessage Why would you want to kick yourself? If you want to disband this party type .party disband
onbutton=3
//Slot 2 - Kick
if (<findid.i_party.tag.p.2.uid>)
//Person is in this slot, lets kick them.
else
Src.Sysmessage No one is in this slot.
endif
onbutton=4
//Slot 3 - Kick
if (<findid.i_party.tag.p.3.uid>)
//Person is in this slot, lets kick them.
else
Src.Sysmessage No one is in this slot.
endif
onbutton=5
//Slot 4 - Kick
if (<findid.i_party.tag.p.4.uid>)
//Person is in this slot, lets kick them.
else
Src.Sysmessage No one is in this slot.
endif
onbutton=6
//Slot 5 - Kick
if (<findid.i_party.tag.p.5.uid>)
//Person is in this slot, lets kick them.
else
Src.Sysmessage No one is in this slot.
endif

onbutton=7
//Slot 6 - Kick
if (<findid.i_party.tag.p.6.uid>)
//Person is in this slot, lets kick them.
else
Src.Sysmessage No one is in this slot.
endif

onbutton=8
src.sysmessage This slot is in use, BY YOU.
onbutton=9
//Slot 2 - Add
if (<findid.i_party.tag.p.2.uid>)
//Person is in this slot, we can't add anyone
Src.Sysmessage Someone one is in this slot.
else
//Add
SRC.NEWITEM i_party_targ
SRC.ACT.TAG.SLOT = 2
SRC.ACT.TARGET
SRC.ACT.TIMER 10
SRC.SYSMESSAGE Choose a person you'd like to add.
endif
onbutton=10
//Slot 3 - Add
if (<findid.i_party.tag.p.3.uid>)
//Person is in this slot, we can't add anyone
Src.Sysmessage Someone one is in this slot.
else
SRC.NEWITEM i_party_targ
SRC.ACT.TAG.SLOT = 3
SRC.ACT.TARGET
SRC.ACT.TIMER 10
SRC.SYSMESSAGE Choose a person you'd like to add.
endif
onbutton=11
//Slot 4 - Add
if (<findid.i_party.tag.p.4.uid>)
//Person is in this slot, we can't add anyone
Src.Sysmessage Someone one is in this slot.
else
SRC.NEWITEM i_party_targ
SRC.ACT.TAG.SLOT = 4
SRC.ACT.TARGET
SRC.ACT.TIMER 10
SRC.SYSMESSAGE Choose a person you'd like to add.
endif
onbutton=12
//Slot 5 - Add
if (<findid.i_party.tag.p.5.uid>)
//Person is in this slot, we can't add anyone
Src.Sysmessage Someone one is in this slot.
else
SRC.NEWITEM i_party_targ
SRC.ACT.TAG.SLOT = 5
SRC.ACT.TARGET
SRC.ACT.TIMER 10
SRC.SYSMESSAGE Choose a person you'd like to add.
endif
onbutton=13
//Slot 6 - Add
if (<findid.i_party.tag.p.6.uid>)
//Person is in this slot, we can't add anyone
Src.Sysmessage Someone one is in this slot.
else
SRC.NEWITEM i_party_targ
SRC.ACT.TAG.SLOT = 2
SRC.ACT.TARGET
SRC.ACT.TIMER 10
SRC.SYSMESSAGE Choose a person you'd like to add.
endif

on=1
src.say button 1
on=0
src.say Cancel.
09-14-2019 09:29 AM
Find all posts by this user Like Post Quote this message in a reply
Coruja
Sphere Developer
*****

Posts: 892
Likes Given: 5
Likes Received: 208 in 171 posts
Joined: Jul 2012
Reputation: 6

Dimension Shard

Post: #2
RE: Multiplayer level system implementation
I don't know who made this script, but on its notes someone wrote that this is an complete replacement for sphere internal party system because "the internal party system was bugged". Probably it's an really old script with really old syntax, because I'm using sphere since a long time ago and can't remember any critical bug on internal party system, so I think you won't need to replace the internal party system with an softcoded system because the internal code is already working fine

So you just need keep using your level system and deal with some party functions
http://wiki.spherecommunity.net/index.php?title=Parties

Maybe something like this:
Code:
LOCAL.ExpTotal = 1234
IF (<ISINPARTY>)
   SYSMESSAGE I'm in a party so total <dLOCAL.ExpTotal> exp should be splitted between <PARTY.MEMBERS> members
   LOCAL.ExpSingle = <eval <LOCAL.ExpTotal>/<PARTY.MEMBERS>>
   FOR 0 <eval <PARTY.MEMBERS>-1>
      REF1=<PARTY.MEMBER.<LOCAL._FOR>>
      IF (<REF1>)
         SYSMESSAGE Party member <dLOCAL._FOR> (<REF1.NAME>) should gain <dLOCAL.ExpSingle> exp
      ENDIF
   ENDFOR
ELSE
   SYSMESSAGE I'm not in a party so I should gain all total <dLOCAL.ExpTotal> exp
ENDIF
(This post was last modified: 09-14-2019 01:00 PM by Coruja.)
09-14-2019 12:56 PM
Find all posts by this user Like Post Quote this message in a reply
Claus
Apprentice
*

Posts: 17
Likes Given: 3
Likes Received: 0 in 0 posts
Joined: Jan 2014
Reputation: 0



Post: #3
RE: Multiplayer level system implementation
Yes, the party script is very old, i found it in a script-pack on this site, but work bad for my needs, so i will use built-in .

But i have to add this at the and of my script?
like this?
Quote:[EVENTS e_exp_gain]
ON=@DEATHCORPSE
Ref1 = <argo.more2> // More 2 store the killer uid
IF (<Ref1.ISPLAYER>) && (<Ref1.tag0.levelUp> < <def.levelCap>)
LOCAL.EXP_GAIN = <calcNewExp <TAG0.EXP>,<ref1.tag.LevelUp>>
Ref1.TAG0.EXP += <dLOCAL.EXP_GAIN>
Ref1.LEVELUP //check if you have lvl up.
Ref1.SYSMESSAGE Hai guadagnato <dLOCAL.EXP_GAIN> punti esperienza.
RETURN 0
ENDIF
LOCAL.ExpTotal = <dLOCAL.EXP_GAIN>
IF (<ISINPARTY>)
SYSMESSAGE I'm in a party so total <dLOCAL.ExpTotal> exp should be splitted between <PARTY.MEMBERS> members
LOCAL.ExpSingle = <eval <LOCAL.ExpTotal>/<PARTY.MEMBERS>>
FOR 0 <eval <PARTY.MEMBERS>-1>
REF1=<PARTY.MEMBER.<LOCAL._FOR>>
IF (<REF1>)
SYSMESSAGE Party member <dLOCAL._FOR> (<REF1.NAME>) should gain <dLOCAL.ExpSingle> exp
ENDIF
ENDFOR
ELSE
SYSMESSAGE I'm not in a party so I should gain all total <dLOCAL.ExpTotal> exp
ENDIF
09-14-2019 09:35 PM
Find all posts by this user Like Post Quote this message in a reply
Coruja
Sphere Developer
*****

Posts: 892
Likes Given: 5
Likes Received: 208 in 171 posts
Joined: Jul 2012
Reputation: 6

Dimension Shard

Post: #4
RE: Multiplayer level system implementation
The code above is just an example, it already have all references needed to use it as base just changing what is needed

Anyway, to make things a bit simple, try using this code below. I didn't tested it but it should work

Code:
[EVENTS e_exp_gain]
ON=@Death
REF1 = <ATTACKER.LAST>
IF !(<REF1>)
   return 0
ELIF (<REF1.ISPLAYER>)
   IF (<REF1.ISINPARTY>)
      TAG0.Exp += 30    //add bonus exp when in party
      TAG0.Exp /= <REF1.PARTY.MEMBERS>    //split exp between party members
      FOR 0 <eval <REF1.PARTY.MEMBERS> - 1>
         REF2=<REF1.PARTY.MEMBER.<LOCAL._FOR>>
         IF (<REF2>)
            REF2.ExpGain <TAG0.Exp>
         ENDIF
      ENDFOR
   ELSE
      REF1.ExpGain <TAG0.Exp>
   ENDIF
ENDIF

[FUNCTION ExpGain]
IF (<TAG0.LevelUp> < <DEF0.LevelCap>)
   TAG0.Exp += <ARGS>
   SYSMESSAGE Hai guadagnato <dARGS> punti esperienza.
   LevelUp //check if you have lvl up
ENDIF
(This post was last modified: 09-15-2019 07:48 AM by Coruja.)
09-15-2019 07:47 AM
Find all posts by this user Like Post Quote this message in a reply
[+] 1 user Likes Coruja's post
Claus
Apprentice
*

Posts: 17
Likes Given: 3
Likes Received: 0 in 0 posts
Joined: Jan 2014
Reputation: 0



Post: #5
RE: Multiplayer level system implementation
Perfect, thank you very much.
09-16-2019 02:56 AM
Find all posts by this user Like Post Quote this message in a reply
Claus
Apprentice
*

Posts: 17
Likes Given: 3
Likes Received: 0 in 0 posts
Joined: Jan 2014
Reputation: 0



Post: #6
RE: Multiplayer level system implementation
I tried to make the exp that was "weighted" on the average levels of the group. So I wanted to ask how to calculate the average level. I tried in many ways but without success. What I had thought was to have a TAG0.levelmed to use as a parameter for my local.exp_gain (a function, which runs but sets tag0.levelmed by default as zero) Here is the script with the "function" I had thought of, but that runs in some circumstances, but specifically not.

Quote:[DEFNAME levelSystem]
levelBase 1 //Incrementa di 1 tag.levelup, tag.levelUp tiene i livelli
levelCap 30
levelMultiplier 2000


[EVENTS e_exp_gain]
ON=@Deathcorpse
REF1 = <argo.more2>
IF !(<REF1>)
return 0
ELIF (<REF1.ISPLAYER>)
IF (<REF1.ISINPARTY>)

TAG0.LEVELMED = <f_party_med>
LOCAL.EXP_GAIN_GROUP = <calcNewExpDue <TAG0.EXP>,<TAG0.LEVELMED>>

TAG.BONUS = (((<REF1.PARTY.MEMBERS>)*(30))/(10))

TAG0.Exp += (<LOCAL.EXP_GAIN_GROUP>*<TAG.BONUS>) //add
TAG0.Exp /= (<REF1.PARTY.MEMBERS>) //split exp between party members
FOR 0 <eval <REF1.PARTY.MEMBERS> - 1>
REF2=<REF1.PARTY.MEMBER.<LOCAL._FOR>>
IF (<REF2>)
REF2.ExpGain <TAG0.Exp>
ENDIF
ENDFOR
ELSE
REF1.ExpGain <TAG0.Exp>
ENDIF
ENDIF

[FUNCTION ExpGain]
IF (<TAG0.LevelUp> < <DEF0.LevelCap>)
TAG0.Exp += <ARGS>
SYSMESSAGE Hai guadagnato <dARGS> punti esperienza.
LevelUp //check if you have lvl up
ENDIF

ENDIF


[function f_party_med]

if
Ref3 = <ref1.party.member.0>
Ref4 = <ref1.party.member.1>
Ref5 = <ref1.party.member.2>
Ref6 = <ref1.party.member.3>
Ref7 = <ref1.party.member.4>
Ref8 = <ref1.party.member.5>
Ref9 = <ref1.party.member.6>
Ref10 = <ref1.party.member.7>
Ref11 = <ref1.party.member.8>
Ref12 = <ref1.party.member.9>

serv.log ref1 e' <party.member.1>


var0.level.1 = <eval(<ref3.tag.levelup>)>
var0.level.2 = <eval(<ref4.tag.levelup>)>
var0.level.3 = <eval(<ref6.tag.levelup>)>
var0.level.4 = <eval(<ref6.tag.levelup>)>
var0.level.5 = <eval(<ref7.tag.levelup>)>
var0.level.6 = <eval(<ref8.tag.levelup>)>
var0.level.7 = <eval(<ref9.tag.levelup>)>
var0.level.8 = <eval(<ref10.tag.levelup>)>
var0.level.9 = <eval(<ref11.tag.levelup>)>
var0.level.10 = <eval(<ref12.tag.levelup>)>


TAG0.levelsom = <eval(<var0.level.1>+<var0.level.2>+<var0.level.3>+<var0.level.4>+<var0.level.5>+<var0.level.6>+<var0.level.7>+<var0.level.8>+<var0.level.9>+<var0.level.10>)>

serv.log il valor of tag0level is <tag0.levelsom>
TAG.levelmed = <eval(<tag0.levelsom>/<REF1.PARTY.MEMBERS>)>
serv.log valor of tag0levelmed is <tag0.levelmed>

ENDIF



ENDIF

[EOF]

this is what I add for each npc to get the calculation done (monster by monster)

Quote:local.exp.gainGROUP = <calcNewExpDue <TAG0.EXP>,<TAG0.LEVELMED>>
[FUNCTION calcNewExpDue]
if <argn2> < 5
argn1 -= 0
return <argn1>
endif
if <argn2> < 8
argn1 -= 125
return <argn1>
endif
if <argn2> < 10
argn1 -= 200
return <argn1>
endif
if <argn2> < 12
argn1 -= 250
return <argn1>
endif

I can not in any way start the function that should take the levels of all party members and make it the average, so as to oblige the various players to chase away gradually to stronger monsters

I modified the basic system you posted to me, because in that way the monsters would always give a precise value of exp, regardless of the level of those who killed them, and I wanted to make sure that each level had its "favorite" monster and that one of 50 did not go to kill skeletons (which would have always given 500) instead of dragons (which maybe give 20,000, but are much more difficult to kill). The same applies to groups. Except that while in "single player" there is no need to have a medium level and the "function"
Quote:local.exp_gain = <calcNewExp <TAG0.EXP>, <ref1.tag.LevelUp >>
where the re1.tag.levelup is obviously the level of the killer and therefore

Quote:[FUNCTION calcNewExp]
if <argn2> = 0
argn1 + = 2000
return <argn1>
endif
if <argn2> <8
argn1 - = 150
return <argn1>
endif
if <argn2> <10
argn1 - = 200
return <argn1>
endif
if <argn2> <12
argn1 - = 250
return <argn1>
endif
it's simple, with groups I have difficulties.
(This post was last modified: 10-03-2019 07:50 AM by Claus.)
10-03-2019 07:39 AM
Find all posts by this user Like Post Quote this message in a reply
Coruja
Sphere Developer
*****

Posts: 892
Likes Given: 5
Likes Received: 208 in 171 posts
Joined: Jul 2012
Reputation: 6

Dimension Shard

Post: #7
RE: Multiplayer level system implementation
To get the average level value between all members you just need to add all levels and split into memberts qty

Code:
[FUNCTION GetAveragePartyLevel]
LOCAL.Total=0
IF (<ISINPARTY>)
  FOR 0 <eval <PARTY.MEMBERS> - 1>
    LOCAL.Total += <PARTY.MEMBER.<LOCAL._FOR>.TAG0.Level>
  ENDFOR
  LOCAL.Total /= <PARTY.MEMBERS>
ENDIF
//SERV.LOG <NAME>'s average party level is <dLOCAL.Total>
return <LOCAL.Total>
You just need to call this function on proper source, like <GetAveragePartyLevel>, <REF1.GetAveragePartyLevel>, etc
10-03-2019 02:02 PM
Find all posts by this user Like Post Quote this message in a reply
[+] 1 user Likes Coruja's post
Claus
Apprentice
*

Posts: 17
Likes Given: 3
Likes Received: 0 in 0 posts
Joined: Jan 2014
Reputation: 0



Post: #8
RE: Multiplayer level system implementation
It works perfectly, thanks a lot
10-03-2019 08:54 PM
Find all posts by this user Like Post Quote this message in a reply
Post Reply 


Forum Jump:


User(s) browsing this thread: 1 Guest(s)

This forum uses Lukasz Tkacz MyBB addons.