Jump to content
  • 0

Box Announcement


leertaste

Question


  • Group:  Members
  • Topic Count:  41
  • Topics Per Day:  0.01
  • Content Count:  137
  • Reputation:   1
  • Joined:  02/02/13
  • Last Seen:  

I want to use an announcement when someone opens a special created box:

this is my function

function script F_GiftBoxFunc {
SetArray( .@MyItems[ 0 ], 5001, 5002, 5003, 5004 ); // ..
set .@ItemID, .@MyItems[ Rand( GetArraySize( .@MyItems ) - 1 ) ];
set .@ItemCount, 1;
GetItem( .@ItemID, .@ItemCount );
Announce( "" + strcharinfo(0) + " opened a headgear box and got: " + GetItemName( .@ItemID ) + " !", BC_ALL );
end;
}

what i want to know:

is it possible to press the 5001, 5002, 5003, 5004 into sth like 5001 - 5004?

Edited by leertaste
Link to comment
Share on other sites

5 answers to this question

Recommended Posts


  • Group:  Members
  • Topic Count:  48
  • Topics Per Day:  0.01
  • Content Count:  410
  • Reputation:   29
  • Joined:  04/04/12
  • Last Seen:  

function script F_GiftBoxFunc {
set .@ItemID, rand(5001,5004);
GetItem( .@ItemID, 1 );
Announce( "" + strcharinfo(0) + " opened a headgear box and got: " + GetItemName( .@ItemID ) + " !", BC_ALL );
end;
}

Like that you mean?

  • Upvote 1
Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  41
  • Topics Per Day:  0.01
  • Content Count:  137
  • Reputation:   1
  • Joined:  02/02/13
  • Last Seen:  

so are 5002 and 5003 also included? i dont think so :S

i want that the item ids from 5001 - 5004 are included without typing "5001, 5002, 5003, 5004"

Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  72
  • Topics Per Day:  0.02
  • Content Count:  2997
  • Reputation:   1131
  • Joined:  05/27/12
  • Last Seen:  

*rand(<number>{,<number>});

This function returns a number ...

(if you specify one) ... randomly positioned between 0 and the number you specify -1.

(if you specify two) ... randomly positioned between the two numbers you specify.

rand(10) would result in 0,1,2,3,4,5,6,7,8 or 9

rand(0,9) would result in 0,1,2,3,4,5,6,7,8 or 9

rand(2,5) would result in 2,3,4 or 5

Look up commands you're unsure about in trunk/doc/script_commands.txt.

  • Upvote 2
Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  41
  • Topics Per Day:  0.01
  • Content Count:  137
  • Reputation:   1
  • Joined:  02/02/13
  • Last Seen:  

ah, good to know!

thanks!

Okay next thing... :$

This works great:

function script F_GiftBoxFunc {
set .@ItemID, rand(5001,5004);
GetItem( .@ItemID, 1 );
Announce( "" + strcharinfo(0) + " opened a headgear box and got: " + GetItemName( .@ItemID ) + " !", BC_ALL );
end;
}

But what i want to add now is (for example) something like that:

IDs from 5001-5004 + IDs 5050-5080

Can someone help? :)

Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  48
  • Topics Per Day:  0.01
  • Content Count:  410
  • Reputation:   29
  • Joined:  04/04/12
  • Last Seen:  

function script F_GiftBoxFunc {
set .@rand, rand(1,2);
if (.@rand == 1) {
set .@ItemID, rand(5001,5004);
}
else {
set .@ItemID, rand(5050,5080);
}
GetItem( .@ItemID, 1 );
Announce( "" + strcharinfo(0) + " opened a headgear box and got: " + GetItemName( .@ItemID ) + " !", BC_ALL );
end;
}

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