Sign up Calendar Latest Topics
 
 
 


Reply
  Author   Comment  
James

Junior Member
Registered:
Posts: 29
Reply with quote  #1 

Hey martin 


(for a heads up my english is not the best)


I have the chartboost plugin and everything works (everytime when the player lose chartboost ads appear.)

Now i want to know how can i make random appear?
Because i dont want eveytime the player lose there will a ads pop out. 


Any idea how to make it random>?



Thanks!

0
Salus Games

Member
Registered:
Posts: 85
Reply with quote  #2 
Just count how many times the player loses then every x times show an ad.

Just create an int variable. Every time the player loses just add one to that int. When it its 5 losses for example show your ad then reset the the int to 0.

__________________
http://www.salusgames.com - Our passion is making great quality games across all genre's.
0
Roman

Avatar / Picture

Senior Member
Registered:
Posts: 304
Reply with quote  #3 
#pragma strict
 
var i;
 
var chartboostAppID : String = "your chartboostAppID ";
var chartboostAppSignature : String = "your chartboostAppSignature  ";
 
function Start () 
{
ChartboostAndroid.init( chartboostAppID, chartboostAppSignature, true );
ChartboostAndroid.cacheInterstitial( null );
 
i=Random.Range(1,4);
 
if(i==2)
{
Ads();
}
 
}
 
function Ads()
{
ChartboostAndroid.showInterstitial( null );
}




hope it helps

__________________
http://wasted-droid.com
0
Martin

Avatar / Picture

Administrator
Registered:
Posts: 2,230
Reply with quote  #4 
Thanks for the reply guys.

@Roman. Yeah I was about to suggest the same code [smile] It's good for me to see code on here sometimes, I've not made a game in month lol. I'm worried my coding skills will fade to nothing.

By the way, on a different point I think we need to give the player a warning when ads appear. We've started getting some bad reviews from players about too many ads. It's ok if they cancel them but some players complained when they are in the middle of a game and the ad appears. I think with a lot of plugins there's an EventListener to tell you when the ad is ready to show. In this case you can try to show the ad when it's ready, but if the ad isn't ready then don't show it if the player is in the middle of the game.
The problem is that if we call ShowAd() for example, then it might be a few seconds later until the ad actually appears on the screen due a slow network connection. We'll need to figure this out.

Martin
0
James

Junior Member
Registered:
Posts: 29
Reply with quote  #5 

Hey 

Thanks for the help

I just found a script that works great![thumb] 

 

0
Martin

Avatar / Picture

Administrator
Registered:
Posts: 2,230
Reply with quote  #6 
Cool, glad its working James [smile]

Martin
0
Previous Topic | Next Topic
Print
Reply

Quick Navigation:

Easily create a Forum Website with Website Toolbox.