Jump to content
  • 0

Script Event Random


NicoAFV1212

Question


  • Group:  Members
  • Topic Count:  21
  • Topics Per Day:  0.02
  • Content Count:  53
  • Reputation:   0
  • Joined:  08/29/20
  • Last Seen:  

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

Link to comment
Share on other sites

6 answers to this question

Recommended Posts

  • 0

  • Group:  Content Moderator
  • Topic Count:  55
  • Topics Per Day:  0.02
  • Content Count:  1676
  • Reputation:   703
  • Joined:  12/21/14
  • Last Seen:  

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
Link to comment
Share on other sites

  • 0

  • Group:  Members
  • Topic Count:  21
  • Topics Per Day:  0.02
  • Content Count:  53
  • Reputation:   0
  • Joined:  08/29/20
  • Last Seen:  

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

image.png.32cc426516433351df7ee208fad2f6fb.png

Nope NidManager.txt What is wrong?
image.thumb.png.e51ef04da60bd9c04566f47b12a4287f.png

Edited by NicoAFV1212
Link to comment
Share on other sites

  • 0

  • Group:  Members
  • Topic Count:  0
  • Topics Per Day:  0
  • Content Count:  90
  • Reputation:   34
  • Joined:  10/01/18
  • Last Seen:  

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
Link to comment
Share on other sites

  • 0

  • Group:  Content Moderator
  • Topic Count:  55
  • Topics Per Day:  0.02
  • Content Count:  1676
  • Reputation:   703
  • Joined:  12/21/14
  • Last Seen:  

Link to comment
Share on other sites

  • 0

  • Group:  Members
  • Topic Count:  21
  • Topics Per Day:  0.02
  • Content Count:  53
  • Reputation:   0
  • Joined:  08/29/20
  • Last Seen:  

2 hours ago, sader1992 said:

image.png.4e4bf740def2cb1e4ab237f95e7d4626.png

 

I have to delete that "}" ?

 

Link to comment
Share on other sites

  • 0

  • Group:  Content Moderator
  • Topic Count:  55
  • Topics Per Day:  0.02
  • Content Count:  1676
  • Reputation:   703
  • Joined:  12/21/14
  • Last Seen:  

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

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

×
×
  • Create New...