Jump to content
  • 0

R>Ideas for new scripts.


Peopleperson49

Question


  • Group:  Members
  • Topic Count:  218
  • Topics Per Day:  0.05
  • Content Count:  1180
  • Reputation:   141
  • Joined:  01/27/12
  • Last Seen:  

So far I have made hundreds of scripts and I'm fresh out of ideas for what to do next. If anybody has good ideas for scripts that haven't been done over and over again please post here. If you have an ideas for old scripts to make them better post also. Thanks.

 

Peopleperson49

Link to comment
Share on other sites

2 answers to this question

Recommended Posts

  • 0

  • Group:  Members
  • Topic Count:  42
  • Topics Per Day:  0.01
  • Content Count:  1096
  • Reputation:   344
  • Joined:  02/26/12
  • Last Seen:  

A* path finding algorithm for units for walking to long distances function. Walking mobs between maps (i talking about pure script based algorithm without touching sources)

 

Example:

 

what do you have:

Your mob at x = 1, y = 1, you should to move your mob unit to x = 300, y = 300 in prontera, how will you do it, how will you avoid walls, obstacles, buildings, zones, warp-portals?

 

This will be good challenge to try your power :P

+ Try to test your algorithm at any maze map

 

what is your output (script function)

mob_unitwalktoxy(.@map$, .@x, .@y);

and mob will walk to this coordinates, if this coordinates busy he will walk somewhere around it.

 

Extra important information:

path.h -> MAX_WALKPATH defined to 32 and can't be changed (because it will break a lot of mechanic things in the game)

path finding algorithm divided to 32 cells only around you. So you can easly walk in 32x32 area, but you should somehow found a way to walk for longer distances by walking between this 32x32 blocks easy

 

What do you think about it?)

Will be it hard for you (just for education purposes)

Link to comment
Share on other sites

  • 0

  • Group:  Members
  • Topic Count:  218
  • Topics Per Day:  0.05
  • Content Count:  1180
  • Reputation:   141
  • Joined:  01/27/12
  • Last Seen:  

That looks a lot like a src mod I used a while ago. I needs to be updated to the lastest svn and I'm not a coder, but when it did work it would allow you to randomly find items as you walked around.

 

Peopleperson49

Index: src/map/pc.h
===================================================================
--- src/map/pc.h	(revision 17079)
+++ src/map/pc.h	(working copy)
@@ -24,6 +24,12 @@
 #define MAX_PC_SKILL_REQUIRE 5
 #define MAX_PC_FEELHATE 3
 #define DAMAGELOG_SIZE_PC 100	// Any idea for this value?
 #define MAX_PC_BONUS_SCRIPT 20

+// [Xantara] Walking item/zeny modification
+#define WALK_ZENY_CHANCE 2000 // 1 out of WALK_ZENY_CHANCE chance per step taken of receiving zeny
+#define WALK_ZENY_AMOUNT 500 // Random zeny between 1 and WALK_ZENY_AMOUNT to give
+#define WALK_GIFTBOX_GROUPID 4 // Group ID of the Giftbox (item_giftbox.txt)
+#define WALK_GIFTBOX_CHANCE 5000 // 1 out of WALK_GIFTBOX_CHANCE chance per step taken of receiving a giftbox
+
 struct weapon_data {
 	int atkmods[3];
 	// all the variables except atkmods get zero'ed in each call of status_calc_pc
Index: src/map/unit.c
===================================================================
--- src/map/unit.c	(revision 17079)
+++ src/map/unit.c	(working copy)
@@ -165,6 +165,38 @@
 	ud->walk_count++; // Walked cell counter, to be used for walk-triggered skills. [Skotlex]
 	status_change_end(bl, SC_ROLLINGCUTTER, INVALID_TIMER); // If you move, you lose your counters. [malufett]
 
+	if(sd && bl->type == BL_PC) {
+		// Zeny chance [Xantara]
+		if(rnd()%WALK_ZENY_CHANCE < 1) {
+			int flag = 3, zeny = rnd()%WALK_ZENY_AMOUNT+1;
+			char mes[CHAT_SIZE_MAX];
+
+			sprintf(mes, "You found some lost zeny on the ground!");
+			clif_broadcast(bl, mes, (int)strlen(mes)+1, flag&0xf0, SELF);
+			
+			pc_getzeny(sd, zeny, LOG_TYPE_OTHER, NULL);
+		}
+		// Giftbox chance [Xantara]
+		if(rnd()%WALK_GIFTBOX_CHANCE < 1) {
+			int flag = 3;
+			char mes[CHAT_SIZE_MAX];
+			struct item it;
+
+			memset(&it,0,sizeof(it));
+			it.nameid = itemdb_searchrandomid(WALK_GIFTBOX_GROUPID);
+			it.identify = 1;
+			
+			sprintf(mes,"You found a lost item on the ground!");
+			clif_broadcast(bl, mes, (int)strlen(mes)+1, flag&0xf0, SELF);
+
+			if ((flag = pc_additem(sd, &it, 1, LOG_TYPE_OTHER))) {
+				clif_additem(sd, 0, 0, flag);
+				if( pc_candrop(sd, &it) )
+					map_addflooritem(&it,1,sd->bl.m,sd->bl.x,sd->bl.y,0,0,0,0);
+			}
+		}
+	}
+
 	if (bl->x != x || bl->y != y || ud->walktimer != INVALID_TIMER)
 		return 0; //map_moveblock has altered the object beyond what we expected (moved/warped it)
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...