Author Topic: Overall Coding Help Needed for My Project  (Read 3207 times)

Heres a link to a parent/package tutorial, and you can look at the event addItem to find out how to set player's items.


Okay, thanks. I made a new script with no syntax errors using no packages at the moment and having functions on their own. But nothing happens on round reset. (When I tried packages it said my package could not be found.)

Code: [Select]
function Slayer_MinigameSO::onReset(%this)
{
%wave = 1;
commandToAll('centerPrint', "<font:impact:50><color:f420eb>The first wave has begun!",5);
commandToAll('bottomPrint', "<color:f420eb>Wave: <color:ffffff>" SPC %wave SPC "<color:1818ba>You are a <color:FFFFFF>" SPC %client.getTeam().name SPC "<color:f420eb>Wave Time Remaining: <color:ffffff>" SPC %time);
%time = 240;
serTimer2(%time, %wave, %client);
}

function serTimer2(%time, %wave, %client)
{
if (%time <= 0)
{
%wave = 2;
commandToAll('centerPrint', "<font:impact:50><color:f420eb>The second wave has begun!",5);
commandToAll('bottomPrint', "<color:f420eb>Wave: <color:ffffff>" SPC %wave SPC "<color:1818ba>You are a <color:FFFFFF>" SPC %client.getTeam().name SPC "<color:f420eb>Wave Time Remaining: <color:ffffff>" SPC %time);
%time = 240;
serTimer3(%time, %wave, %client);

}

else
{
%time--;

$TimerSchedule = schedule(1000, 0, "serTimer", %time);
}
}

function serTimer3(%time, %wave, %client)
{
if (%time <= 0)
{
%wave = 3;
commandToAll('centerPrint', "<font:impact:50><color:f420eb>The third wave has begun!",5);
commandToAll('bottomPrint', "<color:f420eb>Wave: <color:ffffff>" SPC %wave SPC "<color:1818ba>You are a <color:FFFFFF>" SPC %client.getTeam().name SPC "<color:f420eb>Wave Time Remaining: <color:ffffff>" SPC %time);
%time = 240;
serTimer4(%time, %wave, %client);
}

else
{
%time--;

$TimerSchedule = schedule(1000, 0, "serTimer", %time);
}
}

function serTimer4(%time, %wave, %client)
{
if (%time <= 0)
{
%wave = 4;
commandToAll('centerPrint', "<font:impact:50><color:f420eb>The forth wave has begun!",5);
commandToAll('bottomPrint', "<color:f420eb>Wave: <color:ffffff>" SPC %wave SPC "<color:1818ba>You are a <color:FFFFFF>" SPC %client.getTeam().name SPC "<color:f420eb>Wave Time Remaining: <color:ffffff>" SPC %time);
%time = 240;
serTimer5(%time, %wave, %client);
}

else
{
%time--;

$TimerSchedule = schedule(1000, 0, "serTimer", %time);
}
}

function serTimer5(%time, %wave, %client)
{
if (%time <= 0)
{
%wave = 5;
commandToAll('centerPrint', "<font:impact:50><color:f420eb>The fifth and final wave has begun!",5);
commandToAll('bottomPrint', "<color:f420eb>Wave: <color:ffffff>" SPC %wave SPC "<color:1818ba>You are a <color:FFFFFF>" SPC %client.getTeam().name SPC "<color:f420eb>Wave Time Remaining: <color:ffffff>" SPC %time);
%time = 240;
serTimer6(%time, %wave, %client);
}

else
{
%time--;

$TimerSchedule = schedule(1000, 0, "serTimer", %time);
}
}

function serTimer6(%time, %wave, %client)
{
if (%time <= 0)
{
%wave = 5;
commandToAll('centerPrint', "<font:impact:50><color:f420eb>The Survivors have Won!",5);
}

else
{
%time--;

$TimerSchedule = schedule(1000, 0, "serTimer", %time);
}
}

Edit: I had the activate package above the package. But I still don't know if adding a package is keeping it from working.
« Last Edit: February 10, 2015, 09:27:38 PM by rggbnnnnn »

Code: [Select]
package ThisShouldBePackaged
{
function Slayer_MinigameSO::onReset(%this)
{
%wave = 1;
commandToAll('centerPrint', "<font:impact:50><color:f420eb>The first wave has begun!",5);
commandToAll('bottomPrint', "<color:f420eb>Wave: <color:ffffff>" SPC %wave SPC "<color:1818ba>You are a <color:FFFFFF>" SPC %client.getTeam().name SPC "<color:f420eb>Wave Time Remaining: <color:ffffff>" SPC %time);
%time = 240;
serTimer2(%time, %wave, %client);
parent::onReset(%this);
}
};
activatePackage(ThisShouldBePackaged);

The reason nothing would happen when the round resets is because you're overwriting the reset function for slayer. That is the reason you need to package and parent it. You cant just skip steps in coding unless you know exactly what you're doing.