Jump to content
  • 0

Request for script


Mootie

Question


  • Group:  Members
  • Topic Count:  43
  • Topics Per Day:  0.01
  • Content Count:  815
  • Reputation:   86
  • Joined:  10/26/12
  • Last Seen:  

I was thinking a freebies giver to have 4 items to give and 1 item it would be a random

zhakastia,85,57,6 script Freebies Giver 790,{
OnInit:
waitingroom "Get your freebies here!!!",0;
if( !Freebies ){
set Freebies,1;
mes "Welcome...this is your gift...";
getitem 2357,1;
getitem 2524,1;
getitem 2421,1;
getitem 5171,1;
getitem 667,5587,5598,1: <<<<<<this is the example that players will get a random rewards from it so the list above will get thoroughly and for the last item it will be random for the item id that i put in
}else{
mes "You have claim the Reward already.";
}
close;
}

  • Upvote 1
Link to comment
Share on other sites

9 answers to this question

Recommended Posts


  • Group:  Forum Moderator
  • Topic Count:  93
  • Topics Per Day:  0.02
  • Content Count:  10015
  • Reputation:   2348
  • Joined:  10/28/11
  • Last Seen:  

setarray .@Item[0],607,608,512;
getitem .@Item[ rand( getarraysize( .@Item ) ) ],1;

  • Upvote 1
Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  21
  • Topics Per Day:  0.00
  • Content Count:  326
  • Reputation:   19
  • Joined:  09/27/12
  • Last Seen:  

Just replace your last getitem line with Emistry's, and fill the array with all the random items you want - the rest is done automatically.

Just make sure you use a semi-colon and not a colon.

  • Upvote 1
Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  24
  • Topics Per Day:  0.01
  • Content Count:  132
  • Reputation:   8
  • Joined:  07/19/12
  • Last Seen:  

I haven't tested it yet, but I'm pretty sure that it'll work just fine.

zhakastia,85,57,6 script Freebies Giver 790,{
  if( !Freebies ){
  set Freebies,1;
  mes "Welcome...this is your gift...";
  getitem .@Item[ rand( getarraysize( .@Item ) ) ],1;
  }
  else{
  mes "You have claim the Reward already.";
  }
close;

OnInit:
	 waitingroom "Get your freebies here!!!",0;
	 setarray .@Item[0],2357,2524,2421,5171;
}

Oh, you also have to restart your map server to give chance for the waiting room command and array declaration to load.

Edited by Valiente
  • Upvote 1
Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  0
  • Topics Per Day:  0
  • Content Count:  205
  • Reputation:   19
  • Joined:  10/12/12
  • Last Seen:  

OnInit:
waitingroom "Get your freebies here!!!",0;
if( !Freebies ){
set Freebies,1;
mes "Welcome...this is your gift...";

Look at your script. You are using an OnInit label, which means your script will run when loaded or server reload, without attaching any RID.

So, at who did it suppose to send the mes "Welcome..." ?? You will just get the Player not attached ! error.

About this, Valiente's script is a good solution.

I haven't tested it yet, but I'm pretty sure that it'll work just fine.

OnInit:
	 waitingroom "Get your freebies here!!!",0;
	 setarray .@Item[0],2357,2524,2421,5171;
}

I believe it doesn't work instead. .@Item array exists only in the scope of its instance. When loaded with OnInit, it will be created until the script ends, that is at the next line.

So when people will speak with the NPC, .@item array will just appear as a never-set array.

To solvethis, just use NPC attached variable. (.Item).

  • Upvote 1
Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  24
  • Topics Per Day:  0.01
  • Content Count:  132
  • Reputation:   8
  • Joined:  07/19/12
  • Last Seen:  

OnInit:
waitingroom "Get your freebies here!!!",0;
if( !Freebies ){
set Freebies,1;
mes "Welcome...this is your gift...";

Look at your script. You are using an OnInit label, which means your script will run when loaded or server reload, without attaching any RID.

So, at who did it suppose to send the mes "Welcome..." ?? You will just get the Player not attached ! error.

About this, Valiente's script is a good solution.

I haven't tested it yet, but I'm pretty sure that it'll work just fine.

OnInit:
	 waitingroom "Get your freebies here!!!",0;
	 setarray .@Item[0],2357,2524,2421,5171;
}

I believe it doesn't work instead. .@Item array exists only in the scope of its instance. When loaded with OnInit, it will be created until the script ends, that is at the next line.

So when people will speak with the NPC, .@item array will just appear as a never-set array.

To solvethis, just use NPC attached variable. (.Item).

My bad. just copied his script. lol

Edited by Valiente
Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  105
  • Topics Per Day:  0.02
  • Content Count:  390
  • Reputation:   27
  • Joined:  07/12/12
  • Last Seen:  

here's a good freebie script..

easy to modify + it automatically gives then (one per account.)


- script Ivy poli 1,{
OnPCLoginEvent:
if(!#givenStartItems) {
set #givenStartItems, 1;
//=== Freebies
getitem 14545,5;
getitem 13644,1;
getitem 7227,5;
getitem 675,5;
getitem 32702,1;
}
end;
}

Edited by stydianx
Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  7
  • Topics Per Day:  0.00
  • Content Count:  54
  • Reputation:   1
  • Joined:  02/21/12
  • Last Seen:  

how if i want to put it in item script ? 1 item give 10 random items :D how do i script that in item :D thanks in advance

Link to comment
Share on other sites


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

// In your item_db.txt
909,Jellopy,Jellopy,3,6,,10,,,,,,,,,,,,,{setarray .@Item[0],607,608,512;getitem .@Item[ rand( getarraysize( .@Item ) ) ],1;},{},{}

/?

Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  7
  • Topics Per Day:  0.00
  • Content Count:  54
  • Reputation:   1
  • Joined:  02/21/12
  • Last Seen:  

thanks and one more thing how if i want base on SUCCESS Rate like the LOTTI GURL ? 

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