lilwayne1982 Posted May 25, 2011 Share Posted May 25, 2011 i made a small grocery store mod and was thinking about unique features i could add What about the ability to buy lottery tickets and potentially win? what im getting at is will any1 be willing to help me with the script? im very unskilled when it comes to scripts thanks for helping! Link to comment Share on other sites More sharing options...
madman132 Posted May 26, 2011 Share Posted May 26, 2011 i made a small grocery store mod and was thinking about unique features i could add What about the ability to buy lottery tickets and potentially win? what im getting at is will any1 be willing to help me with the script? im very unskilled when it comes to scripts thanks for helping!You would have to store the prize somewhere. Well, you could just spawn the caps or whatever but that wouldn't be very atmospheric. One would expect a larger large security force to be present. Maybe they'll have new weapons and armor :D Link to comment Share on other sites More sharing options...
PaladinRider Posted May 26, 2011 Share Posted May 26, 2011 What I would do is make ~ 10 'tokens' or notes. So you give the player the option to buy one of these 10 notes. I would invoke the lottery process through an NPC most likely. The script to determine the winning ticket would be something like this: short rand ; random number between 0-100 short winningticket ; which ticket is the winner ( 1- 10 ) set rand to GetRandomPercent if rand < 10 set winningticket to 1 elseif rand < 20 set winningticket to 2 elseif rand < 30 set winningticket to 3 elseif rand < 40 set winningticket to 4 ... Then you just do a If Player.GetItemCount Ticketnumber == winningticket then s/he wins. Link to comment Share on other sites More sharing options...
lilwayne1982 Posted May 27, 2011 Author Share Posted May 27, 2011 What I would do is make ~ 10 'tokens' or notes. So you give the player the option to buy one of these 10 notes. I would invoke the lottery process through an NPC most likely. The script to determine the winning ticket would be something like this: short rand ; random number between 0-100 short winningticket ; which ticket is the winner ( 1- 10 ) set rand to GetRandomPercent if rand < 10 set winningticket to 1 elseif rand < 20 set winningticket to 2 elseif rand < 30 set winningticket to 3 elseif rand < 40 set winningticket to 4 ... Then you just do a If Player.GetItemCount Ticketnumber == winningticket then s/he wins. so how exactly would i go abouts adding this? just making a new script and copy/paste what you presented or do i have to change some numbers and text? do i have to add it to tickets as well, and how when you recieve the winning ticket you cash it? i really apreciate ur help too paladin Link to comment Share on other sites More sharing options...
Quetzlsacatanango Posted May 27, 2011 Share Posted May 27, 2011 In that script, the last ticket in the list will always be the winner. Link to comment Share on other sites More sharing options...
davidlallen Posted May 27, 2011 Share Posted May 27, 2011 In that script, the last ticket in the list will always be the winner.The script uses "elseif", so it seems each ticket has a 10% chance of winning. Link to comment Share on other sites More sharing options...
Quetzlsacatanango Posted May 27, 2011 Share Posted May 27, 2011 (edited) Word. Edited May 27, 2011 by Quetzlsacatanango Link to comment Share on other sites More sharing options...
PaladinRider Posted May 28, 2011 Share Posted May 28, 2011 (edited) lilwayne, they'll be more to it then that. That script will randomly pick a winning ticket. you'll have to set it up to allow the player to purchase a ticket. If you do it this way, the odds will be 1 in 10 as there will only be one ticket. However you can easily say that there's only 10 tickets left, and give them random numbers like "Ticket 5549", "Ticket 1290" etc to give the illusion of a larger lottery. Edited May 28, 2011 by PaladinRider Link to comment Share on other sites More sharing options...
Recommended Posts