Jump to content
  • 0

Question about a script and lagg


Kreustoo

Question


  • Group:  Members
  • Topic Count:  34
  • Topics Per Day:  0.01
  • Content Count:  215
  • Reputation:   45
  • Joined:  05/03/13
  • Last Seen:  

Hi,

I'd like to have some opinion, for a custom system, I'd like to do this, each time a monster die :

//Add ip player (stocked on each player) on array : .@ArrayIP
//Add ID player on array : .@arrayID

//For each player in group
	//if player online
		//if player alive
			//if player on the same map
				//if player IP not in .@ArrayIP
					//Add ip playeron array : .@ArrayIP
					//Add ID player on array : .@arrayID
					
//For each player in .@arrayID
       getitem X,;

I know how to do this in script, but I wonder if it's not too much. It won't do any sql_query, it will "only" do all of this test each time a monster die.

I really don't know if this kind of script is consuming too much time.

Link to comment
Share on other sites

3 answers to this question

Recommended Posts


  • Group:  Members
  • Topic Count:  81
  • Topics Per Day:  0.02
  • Content Count:  1654
  • Reputation:   583
  • Joined:  08/09/12
  • Last Seen:  

Single execution won't take time, but imagine if your players gathers tens of monsters and kill them all with AoE skill.

Let's say 1 player gathers 10 mobs, 20 of your players do this too, so there are 200 mobs in OnNPCKillEvent queue

You used 2 for and 4 if, for will multiply the if, you can do the math and count all the if your script will do on each monster kill.

Generally it's still a safe thing to do.

Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  34
  • Topics Per Day:  0.01
  • Content Count:  215
  • Reputation:   45
  • Joined:  05/03/13
  • Last Seen:  

Thanks for helping, but I misspoke.

I know how to "count", if there is a team of 10 that killed 200 monster, it'll have something like 200*10*7 instructions. But I'm wondering if it's a real problem.

It seems pretty obvious that it will be a problem if there is too much player. But, I don't know how many instruction the server is executing each second/each time a monster is killed, so I don't know if this 1400~ instructions are ridiculous compared to what the server is already doing.

Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  31
  • Topics Per Day:  0.01
  • Content Count:  283
  • Reputation:   31
  • Joined:  07/08/14
  • Last Seen:  

It probably is. Judging from some of my scripts I would say you can do pretty much all you want with simple executions.

But it's something pretty easy to test, spawn hundreds of monsters in a restricted area with 2 or 3 members in your group and kill them all you'll see^^

 

Still i don't understand some things in your script.

 

If I get it right you want to give, to all players in a group on the same map, one item each time any of the group members kill a monster.

Then you could probably shorten it:

//For each player in group
	//if player online
		//if player alive
			//if player on the same map
				getitem ...;

getpartymember won't give you twice the same player and since you are using temporary NPC variables they will be deleted once the script ends so there would be no use of a character id checking.

 

But still I'm really curious about why you want to give players so many items  :lol:

 

Maybe I didn't get it, if that's the case I'm sorry  ^_^

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
Answer this question...

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