ID:165242
 
I'm looking for a code that when a player speaks to an NPC the NPC will generate a random value (in my case a weekly salary) and the player can either accept that ammount or take their chances at seeing what else they could be offered but after 3 goes they get what the third ammount was regardless

Now I remember this code off a game on byond i think it may of been dragonball z but I cannot find anything like it its mostly lotto sources
Danny007 wrote:
I'm looking for a code that when a player speaks to an NPC the NPC will generate a random value (in my case a weekly salary) and the player can either accept that ammount or take their chances at seeing what else they could be offered but after 3 goes they get what the third ammount was regardless

Now I remember this code off a game on byond i think it may of been dragonball z but I cannot find anything like it its mostly lotto sources

proc/NewJob(var/mob/M)
var/TakeJob = "no" //bolean for if they accept
var/wage //how much they offer
M << "Ok I'll offer you...
for(var/i=1 to 3)
wage = random(1,100)
TakeJob = input(M,"[wage]. We got a deal?(yes or no)",,"no") as text
if((TakeJob != "yes")||(i<3))
M << "Really?!?!? how about I offer..."
else
break
M << "[wage] it is...."
In response to Jik
The || i<3 part in your code is wrong; it means the player can never choose Yes. Take it out and it'll be fine.

Lummox JR
In response to Lummox JR
Lummox JR wrote:
The || i<3 part in your code is wrong; it means the player can never choose Yes. Take it out and it'll be fine.

Lummox JR

ops, I ment || i = 3, since they need to accept the third offer no matter what... but it was just some quick code.
In response to Jik
Thanks