Jump to content
  • 0

How to fix it a timer on fallen hero


Cyborg

Question


  • Group:  Members
  • Topic Count:  14
  • Topics Per Day:  0.01
  • Content Count:  54
  • Reputation:   1
  • Joined:  07/19/18
  • Last Seen:  

how to fix this timer because it doesn't work the time in the game is always at zero can you help me for this so that it works

ma_in01,49,99,3	script	Fallen Hero#main	651,{
	cutin "3rd_rune_knight",2;
	.Fneed_minute = 480;
	.@remain = (.Fneed_minute - #daily_minute_count);
	mes "[ ^0000FFFallen Hero^000000 ]";
	if (.@remain > 60) {
	mes "You Have ^FF0000"+#daily_minute_count+"^000000 "+ ( ( #daily_minute_count < .Fneed_minute )?" hours left to get your reward.":"Completed" );
	if ( #daily_minute_count < .Fneed_minute ) {
	close2;
	cutin "",255;
	end;
	} else
	next;
	if(gettimetick(2) - #lastpickfallen > (60 * 60 * 24)) {
	cutin "3rd_rune_knight",2;
	mes "[ ^0000FFFallen Hero^000000 ]";
	mes "Hello "+strcharinfo(0)+" ";
	mes "Get free items every day.";
	mes "Let's hope that this day will get something";
	next;
	mes "[ ^0000FFFallen Hero^000000 ]";
	mes "Random Item";
	mes "For Today...";
	if (rand(100) < 10) setarray .@i[0],6232,6228,13710,12916,5184,5199,5209,5762,5467; // 10% chance
	else if (rand(100) < 20) setarray .@i[0],12884,12885,12886,12887,35078; // 20% chance
	else setarray .@i[0],13698,13697,14175,14587,12920,12921,14192,16504,12922,7776,12412,35111; // 70% chance
	set FHitem,.@i[rand(getarraysize(.@i))];
	getitem FHitem,1;
	announce strcharinfo(0)+" has obtained "+getitemname(FHitem)+" from our Fallen Hero!",bc_all,0x00FFFF,FW_NORMAL,15;
	mes "You get "+getitemname(FHitem)+"";
	
	
	
		set #lastpickfallen,gettimetick(2);
		next;
		mes "[ ^0000FFFallen Hero^000000 ]";
		mes "To come back to win new";
		close2;
		cutin "",255;
	}
		else if (.@remain > 0) {
	mes "[ ^0000FFFallen Hero^000000 ]";
	cutin "3rd_rune_knight",2;
	mes "You have ^FF0000"+.@remain+"^000000 minute left to get your reward.";
	close2;
	cutin "",255;
	}
}
}

4mbMmTS.jpg

Link to comment
Share on other sites

8 answers to this question

Recommended Posts

  • 0

  • Group:  Members
  • Topic Count:  55
  • Topics Per Day:  0.01
  • Content Count:  1188
  • Reputation:   161
  • Joined:  06/12/12
  • Last Seen:  

2 hours ago, Cyborg said:

how to fix this timer because it doesn't work the time in the game is always at zero can you help me for this so that it works

ma_in01,49,99,3	script	Fallen Hero#main	651,{
	cutin "3rd_rune_knight",2;
	.Fneed_minute = 480;
	.@remain = (.Fneed_minute - #daily_minute_count);
	mes "[ ^0000FFFallen Hero^000000 ]";
	if (.@remain > 60) {
	mes "You Have ^FF0000"+#daily_minute_count+"^000000 "+ ( ( #daily_minute_count < .Fneed_minute )?" hours left to get your reward.":"Completed" );
	if ( #daily_minute_count < .Fneed_minute ) {
	close2;
	cutin "",255;
	end;
	} else
	next;
	if(gettimetick(2) - #lastpickfallen > (60 * 60 * 24)) {
	cutin "3rd_rune_knight",2;
	mes "[ ^0000FFFallen Hero^000000 ]";
	mes "Hello "+strcharinfo(0)+" ";
	mes "Get free items every day.";
	mes "Let's hope that this day will get something";
	next;
	mes "[ ^0000FFFallen Hero^000000 ]";
	mes "Random Item";
	mes "For Today...";
	if (rand(100) < 10) setarray .@i[0],6232,6228,13710,12916,5184,5199,5209,5762,5467; // 10% chance
	else if (rand(100) < 20) setarray .@i[0],12884,12885,12886,12887,35078; // 20% chance
	else setarray .@i[0],13698,13697,14175,14587,12920,12921,14192,16504,12922,7776,12412,35111; // 70% chance
	set FHitem,.@i[rand(getarraysize(.@i))];
	getitem FHitem,1;
	announce strcharinfo(0)+" has obtained "+getitemname(FHitem)+" from our Fallen Hero!",bc_all,0x00FFFF,FW_NORMAL,15;
	mes "You get "+getitemname(FHitem)+"";
	
	
	
		set #lastpickfallen,gettimetick(2);
		next;
		mes "[ ^0000FFFallen Hero^000000 ]";
		mes "To come back to win new";
		close2;
		cutin "",255;
	}
		else if (.@remain > 0) {
	mes "[ ^0000FFFallen Hero^000000 ]";
	cutin "3rd_rune_knight",2;
	mes "You have ^FF0000"+.@remain+"^000000 minute left to get your reward.";
	close2;
	cutin "",255;
	}
}
}

4mbMmTS.jpg

after this script

getitem FHitem,1;

put

.@remain = 0;

 

Link to comment
Share on other sites

  • 0

  • Group:  Members
  • Topic Count:  14
  • Topics Per Day:  0.01
  • Content Count:  54
  • Reputation:   1
  • Joined:  07/19/18
  • Last Seen:  

13 minutes ago, hendra814 said:

after this script

getitem FHitem,1;

put

.@remain = 0;

 

	if (rand(100) < 10) setarray .@i[0],6232,6228,13710,12916,5184,5199,5209,5762,5467; // 10% chance
	else if (rand(100) < 20) setarray .@i[0],12884,12885,12886,12887,35078; // 20% chance
	else setarray .@i[0],13698,13697,14175,14587,12920,12921,14192,16504,12922,7776,12412,35111; // 70% chance
	set FHitem,.@i[rand(getarraysize(.@i))];
	getitem FHitem,1;
	.@remain = 0;

like this?

Edited by Cyborg
Link to comment
Share on other sites

  • 0

  • Group:  Members
  • Topic Count:  55
  • Topics Per Day:  0.01
  • Content Count:  1188
  • Reputation:   161
  • Joined:  06/12/12
  • Last Seen:  

15 minutes ago, Cyborg said:
ma_in01,49,99,3	script	Fallen Hero#main	651,{
	cutin "3rd_rune_knight",2;
	.Fneed_minute = 480;
	.@remain = (.Fneed_minute - #daily_minute_count);
	mes "[ ^0000FFFallen Hero^000000 ]";
	if (.@remain > 60) {
	mes "You Have ^FF0000"+#daily_minute_count+"^000000 "+ ( ( #daily_minute_count < .Fneed_minute )?" hours left to get your reward.":"Completed" );
	if ( #daily_minute_count < .Fneed_minute ) {
	close2;
	cutin "",255;
	end;
	} else
	next;
	if(gettimetick(2) - #lastpickfallen > (60 * 60 * 24)) {
	cutin "3rd_rune_knight",2;
	mes "[ ^0000FFFallen Hero^000000 ]";
	mes "Hello "+strcharinfo(0)+" ";
	mes "Get free items every day.";
	mes "Let's hope that this day will get something";
	next;
	mes "[ ^0000FFFallen Hero^000000 ]";
	mes "Random Item";
	mes "For Today...";
	if (rand(100) < 10) setarray .@i[0],6232,6228,13710,12916,5184,5199,5209,5762,5467; // 10% chance
	else if (rand(100) < 20) setarray .@i[0],12884,12885,12886,12887,35078; // 20% chance
	else setarray .@i[0],13698,13697,14175,14587,12920,12921,14192,16504,12922,7776,12412,35111; // 70% chance
	set FHitem,.@i[rand(getarraysize(.@i))];
	getitem FHitem,1;
	.@remain = 0;
	announce strcharinfo(0)+" has obtained "+getitemname(FHitem)+" from our Fallen Hero!",bc_all,0x00FFFF,FW_NORMAL,15;
	mes "You get "+getitemname(FHitem)+"";
	
	
	
		set #lastpickfallen,gettimetick(2);
		next;
		mes "[ ^0000FFFallen Hero^000000 ]";
		mes "To come back to win new";
		close2;
		cutin "",255;
	}
		else if (.@remain > 0) {
	mes "[ ^0000FFFallen Hero^000000 ]";
	cutin "3rd_rune_knight",2;
	mes "You have ^FF0000"+.@remain+"^000000 minute left to get your reward.";
	close2;
	cutin "",255;
	}
}
}

like this?

Yes, try like that, because .@remain should be reset to recieve the reward again.

Link to comment
Share on other sites

  • 0

  • Group:  Members
  • Topic Count:  1
  • Topics Per Day:  0.00
  • Content Count:  232
  • Reputation:   86
  • Joined:  06/30/18
  • Last Seen:  

Where is the value for #daily_minute_count set?

Link to comment
Share on other sites

  • 0

  • Group:  Members
  • Topic Count:  14
  • Topics Per Day:  0.01
  • Content Count:  54
  • Reputation:   1
  • Joined:  07/19/18
  • Last Seen:  

11 hours ago, Winterfox said:

Where is the value for #daily_minute_count set?

I don't know what he is for, can you help me what the code is for because the hour on char still doesn't want to enter

Edited by Cyborg
Link to comment
Share on other sites

  • 0

  • Group:  Members
  • Topic Count:  14
  • Topics Per Day:  0.01
  • Content Count:  54
  • Reputation:   1
  • Joined:  07/19/18
  • Last Seen:  

17 hours ago, hendra814 said:

Yes, try like that, because .@remain should be reset to recieve the reward again.

but he hasn't worked yet, he doesn't want to add an hour to the script as if he's missing something.

Edited by Cyborg
Link to comment
Share on other sites

  • 0

  • Group:  Members
  • Topic Count:  1
  • Topics Per Day:  0.00
  • Content Count:  232
  • Reputation:   86
  • Joined:  06/30/18
  • Last Seen:  

I am not sure if I really understood you 100% but if I got you right, you want your script to work like this:
 

ma_in01,49,99,3	script	Fallen Hero#main	651,{
	cutin("3rd_rune_knight", 2);
	.@remaining_minutes  = (#next_fallen_gift - gettimetick(2)) / 60;

	if(#next_fallen_gift > 0 && .@remaining_minutes > 0) {
		if(.@remaining_minutes > 60)
			.@remaining_hours = .@remaining_minutes / 60;

		mes "[ ^0000FFFallen Hero^000000 ]";
		mes "You have to wait ^FF0000" + ((.@remaining_hours > 0) ? F_InsertPlural(.@remaining_hours, "hour") : F_InsertPlural(.@remaining_minutes, "minute")) + "^000000 until you can get your next gift.";
		close3;
	}

	mes "[ ^0000FFFallen Hero^000000 ]";
	mes "Hello " + strcharinfo(0) + ".";
	mes "I give you a free gift every day.";
	mes "Let's hope that you will get something good today.";
	next;
	mes "[ ^0000FFFallen Hero^000000 ]";
	mes "Let me see what I gift have for you...";

	.@pick = rand(1, .items_sum);
	for(.@i = 0; .@i < getarraysize(.items); .@i += 2) {
			.@pick -= .items[.@i + 1];
			if(.@pick <= 0) {
				.@item = .items[.@i];
				break;
			}
	}

    getitem(.@item, 1);
	announce(strcharinfo(0) + " has obtained " + getitemname(.@item) + " from the Fallen Hero!", bc_all, 0x00FFFF, FW_NORMAL, 15);
	mes "Here take this " + getitemname(.@item) + ".";
	#next_fallen_gift = gettimetick(2) + .next_gift_duration;
	next;
	mes "[ ^0000FFFallen Hero^000000 ]";
	mes "Come back later to receive a new gift.";
	close3;

	OnInit:
        // duration until the next gift can be gotten.
		.next_gift_duration = 86400;

        // item chances <<item id>, <chance>>, <<item id>, <chance>>...
		setarray(.items, 6232, 10, 6228, 10, 13710, 10, 12916, 10, 5184, 10, 5199, 10, 5209, 10, 5762, 10, 5467, 10, 12884, 20, 12885, 20, 12886, 20, 12887, 20, 35078, 20, 13698, 70, 13697, 70, 14175, 70, 14587, 70, 12920, 70, 12921, 70, 14192, 70, 16504, 70, 12922, 70, 7776, 70, 12412, 70, 35111, 70);

		for(.@i = 0; .@i < getarraysize(.items); .@i += 2)
			.items_sum += .items[.@i + 1];
}

 

Link to comment
Share on other sites

  • 0

  • Group:  Members
  • Topic Count:  14
  • Topics Per Day:  0.01
  • Content Count:  54
  • Reputation:   1
  • Joined:  07/19/18
  • Last Seen:  

6 hours ago, Winterfox said:

I am not sure if I really understood you 100% but if I got you right, you want your script to work like this:
 

ma_in01,49,99,3	script	Fallen Hero#main	651,{
	cutin("3rd_rune_knight", 2);
	.@remaining_minutes  = (#next_fallen_gift - gettimetick(2)) / 60;

	if(#next_fallen_gift > 0 && .@remaining_minutes > 0) {
		if(.@remaining_minutes > 60)
			.@remaining_hours = .@remaining_minutes / 60;

		mes "[ ^0000FFFallen Hero^000000 ]";
		mes "You have to wait ^FF0000" + ((.@remaining_hours > 0) ? F_InsertPlural(.@remaining_hours, "hour") : F_InsertPlural(.@remaining_minutes, "minute")) + "^000000 until you can get your next gift.";
		close3;
	}

	mes "[ ^0000FFFallen Hero^000000 ]";
	mes "Hello " + strcharinfo(0) + ".";
	mes "I give you a free gift every day.";
	mes "Let's hope that you will get something good today.";
	next;
	mes "[ ^0000FFFallen Hero^000000 ]";
	mes "Let me see what I gift have for you...";

	.@pick = rand(1, .items_sum);
	for(.@i = 0; .@i < getarraysize(.items); .@i += 2) {
			.@pick -= .items[.@i + 1];
			if(.@pick <= 0) {
				.@item = .items[.@i];
				break;
			}
	}

    getitem(.@item, 1);
	announce(strcharinfo(0) + " has obtained " + getitemname(.@item) + " from the Fallen Hero!", bc_all, 0x00FFFF, FW_NORMAL, 15);
	mes "Here take this " + getitemname(.@item) + ".";
	#next_fallen_gift = gettimetick(2) + .next_gift_duration;
	next;
	mes "[ ^0000FFFallen Hero^000000 ]";
	mes "Come back later to receive a new gift.";
	close3;

	OnInit:
        // duration until the next gift can be gotten.
		.next_gift_duration = 86400;

        // item chances <<item id>, <chance>>, <<item id>, <chance>>...
		setarray(.items, 6232, 10, 6228, 10, 13710, 10, 12916, 10, 5184, 10, 5199, 10, 5209, 10, 5762, 10, 5467, 10, 12884, 20, 12885, 20, 12886, 20, 12887, 20, 35078, 20, 13698, 70, 13697, 70, 14175, 70, 14587, 70, 12920, 70, 12921, 70, 14192, 70, 16504, 70, 12922, 70, 7776, 70, 12412, 70, 35111, 70);

		for(.@i = 0; .@i < getarraysize(.items); .@i += 2)
			.items_sum += .items[.@i + 1];
}

 

he is already working but how to change him that will save time then they can exchange items here?

Edited by Cyborg
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...