Jump to content
  • 0

Variable that has expiration


Eross

Question


  • Group:  Members
  • Topic Count:  166
  • Topics Per Day:  0.09
  • Content Count:  378
  • Reputation:   12
  • Joined:  04/05/20
  • Last Seen:  

Hi ! how to make variable expire ? like example I have a Freebies npc (for example) ,, When I claim the rewards it will set into set #freebies, 1; ... and you can claim again by next week same day .example every sunday you can claim the reward ....   thankyou

	claim:
		if ( gettime(4) != 0 && #free == 1) {
				mes .name$;	
				mes "I'm sorry but supplies are only available every ^ff0000Sundays^000000";
				end;
		}
		if (#freeclaim == 1) {
				mes .name$;	
				mes "You have already claimed your streamer's pack see you next week!";
				end;
		}
		else {
			getitembound 14003,50,1;
			set #freeclaim, 1;
		}

 

Link to comment
Share on other sites

1 answer to this question

Recommended Posts

  • 0

  • Group:  Members
  • Topic Count:  34
  • Topics Per Day:  0.01
  • Content Count:  216
  • Reputation:   45
  • Joined:  05/03/13
  • Last Seen:  

Hello,
If your npc is only open on sunday, and you want the player to only be able to withdraw there reward on sunday, I modified the npc to have a global variable that increments every sunday (and store it in players).

OnSun0000: //Every sunday, it increments
$Freebies++;
end;
	
          claim:
		if ( gettime(4) != 0) { //Iopen only on sunday
				mes .name$;
				mes "I'm sorry but supplies are only available every ^ff0000Sundays^000000";
				close; //When you use mes, use a close; not an end;
		}
		else if (#freeclaim == $Freebies) { //Freebies already claimed on that current session
				mes .name$;	
				mes "You have already claimed your streamer's pack see you next week!";
				close;
		}
		else { //get the item
			getitembound 14003,50,1;
			set #freeclaim, $Freebies;
		}

 

But if they can withdraw anyday but the supplied are reset on sunday, it'll be like this:
 

	OnSun0000:
		$Freebies++;
	end;
	
	claim:
		if (#freeclaim == $Freebies) { //Just checking the freebies value, not caring about the day
				mes .name$;	
				mes "You have already claimed your streamer's pack see you next week!";
				close;
		}
		else {
			getitembound 14003,50,1;
			set #freeclaim, $Freebies;
		}


No tested tho

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