ECM.addEventNetAttack = function(){
var eventId = “NetAttack”;
var NetAttack = {
id: eventId,
isRandom: true,
maxTriggers: 1,
trigger: function (company){
return company.currentLevel == 2 && compamy.fans >= 25000; /* company.cash >= 75000 */
};
getNotification: function (company){
var game = company.currentGame;
var msg= "An Unknown Device is trying to access your network system. {n} You can either Block the Connection or Allow the Connection.".localize().format(game.title);
return new Notification({
sourceId: eventId,
header: "What do you want to do?".localize(),
text: msg,
options: ["Block Connection", "Allow Connection"]
});
},
Can anyone care to explain what the problem is?
its complaining about the part where it says: getNotification: function (company){
I think you might be able to create a new event inside the “complete” callback:
complete: function (decision) {
// decision is a number and will correspond to the index of the option that was chosen.
// 0=option1, 1=option2, 2=option3
// it's best if every decision has a different outcome
var company = GameManager.company ;//we fetch the company object for use later.
// Create your new event or whatever here.
return;
}
complete: function (dicision){
var company = GameManager.company;
if (discision === 0){
var n = new Notification({
header: "Block Connection".localize(),
text: ""
});
company.activeNotification.addRange(n.split());
return;
}
if (discision === 1){
var n = new Notification({
header: "Allow Connection".localize(),
text: "",
options: ["Turn Off Power", "Phone Bank", "Phone Police"]
});
}
complete: function (discision){
var company = GameManager.company;
if (discision === 0){
var n = new notification({
header: "Turn Off Power".localize(),
text: ""
});
}
if (discision === 1){
var n = new Notification({
header: "Phone Bank".localize(),
text: ""
});
n.adjustCash(-30217, "Cash Stolen");
}
if (discision === 2){
var n = new Notification({
header: "Phone Police".localize(),
text: "",
});
n.adjustCash(50000);
}
}
}
};
GDT.addEvent(NetAttack);
};
And that you might want to add the event IN the complete function, before any decision is taken:
complete: function (decision){
var company = GameManager.company;
GDT.addEvent(NetAttack);
...
or after a certain decision has been taken
if (decision=== 1){
var n = new Notification({
header: "Phone Bank".localize(),
text: ""
});
n.adjustCash(-30217, "Cash Stolen");
GDT.addEvent(NetAttack);
}
Or at the end, if you want to use it when no decision has been taken.