leertaste Posted February 6, 2013 Group: Members Topic Count: 41 Topics Per Day: 0.01 Content Count: 137 Reputation: 1 Joined: 02/02/13 Last Seen: July 18, 2019 Share Posted February 6, 2013 (edited) 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 February 6, 2013 by leertaste Quote Link to comment Share on other sites More sharing options...
michaelsoftman Posted February 6, 2013 Group: Members Topic Count: 48 Topics Per Day: 0.01 Content Count: 410 Reputation: 29 Joined: 04/04/12 Last Seen: November 28, 2024 Share Posted February 6, 2013 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? 1 Quote Link to comment Share on other sites More sharing options...
leertaste Posted February 6, 2013 Group: Members Topic Count: 41 Topics Per Day: 0.01 Content Count: 137 Reputation: 1 Joined: 02/02/13 Last Seen: July 18, 2019 Author Share Posted February 6, 2013 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" Quote Link to comment Share on other sites More sharing options...
Euphy Posted February 6, 2013 Group: Members Topic Count: 72 Topics Per Day: 0.02 Content Count: 2997 Reputation: 1132 Joined: 05/27/12 Last Seen: June 1, 2017 Share Posted February 6, 2013 *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. 2 Quote Link to comment Share on other sites More sharing options...
leertaste Posted February 6, 2013 Group: Members Topic Count: 41 Topics Per Day: 0.01 Content Count: 137 Reputation: 1 Joined: 02/02/13 Last Seen: July 18, 2019 Author Share Posted February 6, 2013 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? Quote Link to comment Share on other sites More sharing options...
michaelsoftman Posted February 6, 2013 Group: Members Topic Count: 48 Topics Per Day: 0.01 Content Count: 410 Reputation: 29 Joined: 04/04/12 Last Seen: November 28, 2024 Share Posted February 6, 2013 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; } Quote Link to comment Share on other sites More sharing options...
Question
leertaste
I want to use an announcement when someone opens a special created box:
this is my function
what i want to know:
is it possible to press the 5001, 5002, 5003, 5004 into sth like 5001 - 5004?
Edited by leertasteLink to comment
Share on other sites
5 answers to this question
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.