Jump to content
  • 0

Script Event Random


Question

Posted

I need help with this script, In this script the event 

	// OnClock<hour><minute>: donpcevent "<npc_name>::OnStart";
	OnClock0000: donpcevent "Event_1::OnStart"; end;
	OnClock0400: donpcevent "Event_2::OnStart"; end;
	OnClock0800: donpcevent "Event_3::OnStart"; end;
	OnClock1200: donpcevent "Event_4::OnStart"; end;
	OnClock1600: donpcevent "Event_5::OnStart"; end;
	OnClock2000: donpcevent "Event_6::OnStart"; end;


This script is programmed so that each event starts at the specified time, my problem is that they are not random. I want 1 of those 6 events to start at 00:00 and so on at all hours

6 answers to this question

Recommended Posts

  • 0
Posted (edited)

something like this ?

// OnClock<hour><minute>: donpcevent "<npc_name>::OnStart";
OnClock0000:
OnClock0400:
OnClock0800:
OnClock1200:
OnClock1600:
OnClock2000:
	switch(rand(1,6)){
		case 1: donpcevent "Event_1::OnStart"; end;
		case 2: donpcevent "Event_2::OnStart"; end;
		case 3: donpcevent "Event_3::OnStart"; end;
		case 4: donpcevent "Event_4::OnStart"; end;
		case 5: donpcevent "Event_5::OnStart"; end;
		case 6: donpcevent "Event_6::OnStart"; end;
	}

or

// OnClock<hour><minute>: donpcevent "<npc_name>::OnStart";
OnClock0000:
OnClock0400:
OnClock0800:
OnClock1200:
OnClock1600:
OnClock2000:
	donpcevent "Event_" + rand(1,6) + "::OnStart";
end;

 

Edited by sader1992
  • 0
Posted (edited)
1 hour ago, NicoAFV1212 said:

I put the script and I get that.  in that line the npc ends with}

image.png.32cc426516433351df7ee208fad2f6fb.png

Simply add "}"  after the end;

Edited by Royr
  • 0
Posted
16 minutes ago, NicoAFV1212 said:

 

I have to delete that "}" ?

 

no , when you copied the code , you didn't copy this!

in the file you provided , write the missing } under the code

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Answer this question...

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

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...