Forums Index >> Modding >> Small Script Problem!
Page : <1> :
Well its lot harder than you think, you need to have a check if the person is inside the goal then schedule the same function over and over and over and over....
This gave me a lot of problems with my CTF script, if you left and got in the goal again the speed was the double than before
I already fixed it but still havent released it.
It needs like 200 lines of code to get a good timer working but even if that should take just some 50-100 lines I cant help now as I'd have to write that from scratch
about the boxes, its {code} and {/code} (replace { with [ and } with ])
Last edited: Saturday, May 14, 2005 at 12:03:08 PM
How would you make a check if some one is inside the goal? Somthing like this maybe:
if(%tank.client.namebase !$= "something") //
then after I do the check I just need to repeat all of that stated above at the top of my mis file? So if I were to repeat it 10 times then if some one were in the goal for 10 seconds they would get 10 points but would have to come out of the goal and then back in to get more points. I guess I also need a timer. Can any one els help?
No, you'd need to make an on enter function that sets a "$" variable on true, and then calls another function that makes the main things
On that main function keep checking if the player is on the goal, and if it is score a point and loop it again
The make a onleave function that sets the variable back to false, so the main function stops looping
It's like this, lad!
function goal1::onenter(%db, %this, %tank)
{
schedule(1000, false, "bomberscore1", %obj.client);
schedule(2000, false, "bomberscore1", %obj.client);
schedule(3000, false, "bomberscore1", %obj.client);
schedule(4000, false, "bomberscore1", %obj.client);
schedule(5000, false, "bomberscore1", %obj.client);
}
function bomberscore1(%db, %tank, %client)
{
%tank.incScore(1,1);
bottomprintall(%tank.client.namebase SPC "has control and is scoring!",5,2);
}
Or this perhaps:
function goal1::onenter(%db, %this, %tank)
{
schedule(1000, false, "bomberscore1", %obj.client);
}
function bomberscore1(%db, %tank, %client)
{
%tank.incScore(1,1);
bottomprintall(%tank.client.namebase SPC "has control and is scoring!",5,2);
schedule(1000, false, "bomberscore2", %obj.client);
}
function bomberscore2(%db, %tank, %client)
{
%tank.incScore(1,1);
bottomprintall(%tank.client.namebase SPC "has control and is scoring!",5,2);
schedule(1000, false, "bomberscore1", %obj.client);
}
Of course, these are the easy way out, Art Crazy tends to like spending hours making everything so perfect... ;)
I haven't tested these, Art Crazy will correct my scripting I'm sure. :)
Last edited: Sunday, May 15, 2005 at 5:27:32 PM
If I understand correctly im supposed to replace the first 3 lines of my script with one of your scripts. I have tryed that and it doesn't seem to work. I can't even get it to say my name in front of the messege when I'm scoring now. Art wouldn't I just need a part of your CTF script for this to work (with a few adjustments)? Well thanks for the help guys! If I get this to work I can give you guys some credit for my mod when it's done.
@Baron
Well, you're right baron, it will work, but anyone can enter the goal, and leave and the counter would continue
Thats y I need to spend hours, so I can avoid having those bugs of counter continuing when someone leaves the goal
I had a bug that if someone left the goal and get back on the timer would continue FOREVER, fixed after spending many hours fixing it
Oh, and do I know you? [edit]Oh yea, hi chilly lizzy![/edit]
@Bomber
Well, if you want I'll be releasing the source of the fixed CTF script (without the bug mentioned above) soon, you'll just have to wait and edit it, of course you wont be able to release the modifications tough (Unless you have a TGE license tough, even if I dont have one, I made it COMPLETLY from scratch)
Last edited: Monday, May 16, 2005 at 11:47:34 AM
Just use an OnLeave thing like this:
function goal1::onleave(%db, %this, %tank)
{
bottomprintall( "Get back in the goal, you idiot!",5,2);
}
Last edited: Monday, May 16, 2005 at 8:20:19 PM
Ok the counter will still keep on going though with that. And art you say it will work then I must have done some thing wrong. What do I do witth one of thoses scripts? I'v tryed replaceing the first 3 lines of my script with it and it don't work. I may just wait for the open source for CTF.
Get it here
On it you just have to remove the checkforflag function and the part that checks for the flag in the CTF goals function
Last edited: Tuesday, May 17, 2005 at 8:15:39 AM
Page : <1> :
I want it so when you enter a scrum goal you get 1 point for every second you are in it. So far all I got it to do is give me 1 point every time I enter. This is what I got:
function goal1::onenter(%db, %this, %tank) {
bottomPrintall(%tank.client.namebase SPC "has control and is scoring!",5,2);
$goal1:schedule1 = %tank.schedule(1000, incscore, 1, 1, 1);
}
datablock PowerUpData(goal1)
{
category = "goal";
shape = "~/data/shapes/common/scrumgoal.dts";
type = "goal";
startOn = true;
shadow = true;
shadowAnimation = true;
aiPickup = true;
Sound = "PupOnSound";
soundOff = "PupOffSound";
And this at the bottom
new PowerUp() {
dataBlock = "goal1";
position = "0 0 100";
rotation = "1 0 0 0";
scale = "1 1 1";
lightBoost = "0";
Thanks for the help!
Last edited: Sunday, May 15, 2005 at 10:35:34 AM