Script problem

Have questions about CoD/UO mapping that aren't covered in the tutorials section? Post here!

Moderator: Core Staff

Post Reply
All-Killer
CJ Worshipper
CJ Worshipper
Posts: 383
Joined: December 16th, 2005, 6:38 pm

Script problem

Post by All-Killer » September 17th, 2006, 2:34 pm

I tried to make a script for a Singleplayer map but it doenst work. It is supossed that you will be drop down by a parachute in youre map.

This is the tutorial: http://www.modsonline.com/Tutorials-read-266.html

This is the script that i use.

Code: Select all

main()
{
setCullFog (0, 8000, 0.8, 0.8, 0.8, 0);
ambientPlay("amb_burnville");	
	
	maps\mp\_load::main();
	maps\mp\_load::parachute();
level._effect["fire"] = loadfx ("fx/fire/tinybon.efx");
maps\mp\_fx::loopfx("fire", (-157, 435, 30), 0.6);
level._effect["smoke"] = loadfx ("fx/smoke/ash_smoke.efx");
maps\mp\_fx::loopfx("smoke", (-157, 435, 85), 0.7);

game["allies"] = "american";
game["axis"] = "german";

game["american_soldiertype"] = "airborne";
game["american_soldiervariation"] = "normal";
game["german_soldiertype"] = "fallschirmjagercamo";
game["german_soldiervariation"] = "normal";

game["attackers"] = "allies";
game["defenders"] = "axis";
}

Code: Select all

parachute()
{
level.player allowProne (false);
level.player allowCrouch (false);

start = level.player.origin;

startheight = start[2];

level.player.origin = level.player.origin + (0,0,0);

parachute = spawn ("script_model",(0,0,0));
parachute setmodel ("xmodel/parachute_animrig");

parachute.origin = level.player.origin;

level.player linkto (parachute,"TAG_player",(0,0,0),(0,0,0));

while (1)
{
wait 0.05;

direction = (0,0,-9);
parachute.origin=parachute.origin+direction;

start = level.player.origin;
end = start + (0,0,-64);

hitcharacters = 1;
results=[];results=bulletTrace(start,end,hitcharacters,level.player);

if (results["fraction"]!=1)
{
level.player.origin = results["position"];
level.player unlink();

level.player allowProne (true);
level.player allowCrouch (true);

break;
}
}
parachute hide();
}
I dont get any script errors, but the parachute just dont work.

Hope some one can see the problem.
Image

User avatar
Drofder2004
Core Staff
Core Staff
Posts: 13315
Joined: April 13th, 2005, 8:22 pm
Location: UK, London

Post by Drofder2004 » September 18th, 2006, 12:53 pm

atm, I have to shoot out, so I cannot fully examine the script, but I can see things that don't quite add up...

i.e
level.player.origin = level.player.origin + (0,0,0);

That line above is pointless.

You are basically saying

1 = 1 + 0
Or
(1,1,1) = (1,1,1) + (0,0,0)

I am guessing what you need in that position is something like

level.player.origin = level.player.origin + (0,0,300);

That will move the player 300 units above the spawn point...

I will look into this further when I get home.
Image
Virgin Media 20Mb Broadband:
"Perfect for families going online at the same time, downloading movies, online gaming and more."
Borked internet since: 22-07-2010

All-Killer
CJ Worshipper
CJ Worshipper
Posts: 383
Joined: December 16th, 2005, 6:38 pm

Post by All-Killer » September 18th, 2006, 2:31 pm

to quote from the tut:
the BLUE line tells you where you'll spawn, but as we have already placed our spawn point high in the sky, we leave the coordinates (0,0,0)
Image

User avatar
Drofder2004
Core Staff
Core Staff
Posts: 13315
Joined: April 13th, 2005, 8:22 pm
Location: UK, London

Post by Drofder2004 » September 18th, 2006, 7:28 pm

This is why I needed some time to look over it. There are obvious mistakes ;)

Code: Select all

main()
{
setCullFog (0, 8000, 0.8, 0.8, 0.8, 0);
ambientPlay("amb_burnville");   

////////////////////////////////////////
maps\mp\_load::main();
maps\mp\_load::parachute();
////////////////////////////////////////

level._effect["fire"] = loadfx ("fx/fire/tinybon.efx");
maps\mp\_fx::loopfx("fire", (-157, 435, 30), 0.6);
level._effect["smoke"] = loadfx ("fx/smoke/ash_smoke.efx");
maps\mp\_fx::loopfx("smoke", (-157, 435, 85), 0.7);

game["allies"] = "american";
game["axis"] = "german";

game["american_soldiertype"] = "airborne";
game["american_soldiervariation"] = "normal";
game["german_soldiertype"] = "fallschirmjagercamo";
game["german_soldiervariation"] = "normal";

game["attackers"] = "allies";
game["defenders"] = "axis";
}
I have put /'s around the error.

Firstly.
maps\mp\_load::main();

As you can see, you are using "mp". For SP you need
maps\_load::main();

Secondly.
maps\mp\_load::parachute();

You don't need this line at all. Parachute does not exist inside _load.gsc
thread parachute();

You also do not need any of the attackers or defenders referenced.

Code: Select all

main()
{
maps\_load::main();

setCullFog (0, 8000, 0.8, 0.8, 0.8, 0);
ambientPlay("amb_burnville");

thread parachute(); 

level._effect["fire"] = loadfx ("fx/fire/tinybon.efx");
level._effect["smoke"] = loadfx ("fx/smoke/ash_smoke.efx");

maps\_fx::loopfx("fire", (-157, 435, 30), 0.6);
maps\_fx::loopfx("smoke", (-157, 435, 85), 0.7); 
}

parachute()
{
level.player allowProne (false);
level.player allowCrouch (false);

start = level.player.origin;
startheight = start[2];

parachute = spawn ("script_model",(0,0,0));
parachute setmodel ("xmodel/parachute_animrig");

parachute.origin = level.player.origin;

level.player linkto (parachute,"TAG_player",(0,0,0),(0,0,0));

while (1)
{
wait 0.05;

parachute.origin = parachute.origin + (0,0,-9);

start = level.player.origin;
end = start + (0,0,-64);

hitcharacters = 1;
results = [];
results = bulletTrace(start, end, hitcharacters, level.player);

if (results["fraction"] != 1)
{
level.player.origin = results["position"];
level.player unlink();

level.player allowProne (true);
level.player allowCrouch (true);

break;
}
}
parachute hide();
}
If the above works fine, I would recommend you change the last line of
"parachute hide();"
to
"parachute delete();"
and test that. Hiding something is not as effective as getting rid of it completely.
Image
Virgin Media 20Mb Broadband:
"Perfect for families going online at the same time, downloading movies, online gaming and more."
Borked internet since: 22-07-2010

All-Killer
CJ Worshipper
CJ Worshipper
Posts: 383
Joined: December 16th, 2005, 6:38 pm

Post by All-Killer » September 19th, 2006, 1:37 pm

Oke i test it tonight, thanks for youre help im not the bigest star is scripting and it is my first SP map. Tell you tonight if it works
Image

All-Killer
CJ Worshipper
CJ Worshipper
Posts: 383
Joined: December 16th, 2005, 6:38 pm

Post by All-Killer » September 19th, 2006, 6:45 pm

Oke i tested it but still i doenst work. I also noticed that the fire and smoke FX also dont work.
Image

creator
CJ Worshipper
CJ Worshipper
Posts: 492
Joined: July 6th, 2006, 11:37 pm
Location: The Netherlands
Contact:

Post by creator » September 19th, 2006, 7:55 pm

killer send me on xfire or msn i got time to test now [ did not had time in the passed ]
Cod 1 Mapper&Modder&Moddeler

All-Killer
CJ Worshipper
CJ Worshipper
Posts: 383
Joined: December 16th, 2005, 6:38 pm

Post by All-Killer » September 19th, 2006, 8:31 pm

I look back into my pk3 and saw there was a .arena file. Do i need that for a singleplayer map, and if i need it what do i need to put in it.
Image

creator
CJ Worshipper
CJ Worshipper
Posts: 492
Joined: July 6th, 2006, 11:37 pm
Location: The Netherlands
Contact:

Post by creator » September 19th, 2006, 8:41 pm

ok i fixed it, it was no script problem, i send u tomorrow on xfire/msn + how i fixed
Cod 1 Mapper&Modder&Moddeler

Post Reply

Who is online

Users browsing this forum: No registered users and 2 guests