Recursion
#6

Quote:
Originally Posted by ******
Посмотреть сообщение
Код:
RandomHospitalLoot()
{
    const items[] = { ITEM_MEDKIT, ITEM_BONDAGE, ITEM_FIRSTAID };
    return items[random(sizeof (items))];
}
Wow thank you! this is better than my code why I haven't thought this one

Items[] = { ITEM_MEDKIT, ITEM_BONDAGE, ITEM_FIRSTAID } ; // ID: Array starts on 0 so 0,1,2

items[random(sizeof(items))]; sizeof getting the total value in items array and then it it random from 0-2 if im not mistaken and then if it random to 1 then ITEM_BONDAGE will return of its ID right?

^ enlighten me please
Reply


Messages In This Thread
Recursion - by ToiletDuck - 30.07.2018, 07:21
Re: Recursion - by ToiletDuck - 30.07.2018, 07:42
Re: Recursion - by ToiletDuck - 30.07.2018, 07:47
Re: Recursion - by ball - 30.07.2018, 08:09
Re: Recursion - by Calisthenics - 30.07.2018, 08:12
Re: Recursion - by ToiletDuck - 30.07.2018, 08:24

Forum Jump:


Users browsing this thread: 1 Guest(s)