Jump to content

Help with random int


gdanbo

Recommended Posts

Hey guys, I have another problem. I'm making a callout in which there are 2 possibilities of what can happen. One is when you ring the doorbell of the house, the suspect will open up, the second is that another person will open the door. I'm using this for these possibilities:

 int r_talk = new Random().Next(1, 2);

If r_talk is 1, the suspect spawns, if it's 2 then non-suspect spawns. I have to define the variable at the beginning of the code so it stays the same during whole callout, because if not, a thing can happen where the suspect spawns and he acts like the non-suspect. My problem is, when the r_talk is chosen to be 1 or 2, it will stay the same during the whole game session, so if I repeat the callout, the outcome will be the same, e.g. the suspect will spawn every time. So, is there a way to randomize it over and over again every time the callout is accepted? Thanks in advance

Edited by gdanbo
Link to comment
Share on other sites

  • Management Team

Please show us a little bit more code, if possible your whole class. 

Please do not PM me unless really necessary (knowing you helps). If you think you need my attention in a topic, tag me.

Link to comment
Share on other sites

You probably need to define the variable on the class, but don't initialize it until OnBeforeCalloutDisplayed or OnCalloutAccepted. 

[REL] Coastal Callouts: An action-packed mod with new vehicles, maps, capabilities, and callouts in and around the waters of Los Santos

[REL] Police Tape: Make your scenes more realistic while stopping peds and traffic

[REL] Better EMS: Realistic and dynamic EMS response

Join the Parks Benefactor Program to support my work and get early beta access!

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
Reply to this topic...

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