Author |
Topic: Complicated thingy :( |
acedlol |
General Member Since: Jul 19, 2011 Posts: 18 Last: Aug 6, 2011 [view latest posts] |
|
|
Category: CoD4 Scripting Posted: Friday, Aug. 5, 2011 07:58 am |
|
I have a scripting job, which is essential for my map, and I don't have the amount of knowledge needed to write this myself. I've tried looking and searching and made attempts, but I've only produced miserable failures. I would greatly appreciate if anyone could help me with this, as its really driving me around the bend.
Basically, there are several segments I need, and if they can be done in one script, then that would be preferable.
1) When a player activates a trigger_use, the allied teams is teleported to a script_origin, the other team, axis, is likewise transported to another script_origin. (I believe this can be done).
2) When this happens, both teams are given 1 weapon (all players), like ak, smg, or deagle etc etc. If this is possible, then it should happen just after the player has been teleported.
This is a one time script, so it only would be activated once across the entire map.
I rather not use the basic teleport script, as I will require several of these scripts working along side each other, so making multiple inactive teleports really isn't a option for me, as it makes everything 10x complicated. If this is possible it's much more efficient.
I'd prefer it in a script of its own, rather in the main.
Please ?
Thanks in advance.
edited on Aug. 5, 2011 03:59 am by acedlol |
|
|
|
IzNoGoD |
General Member Since: Nov 29, 2008 Posts: 694 Last: Nov 10, 2012 [view latest posts] |
|
|
|
acedlol |
General Member Since: Jul 19, 2011 Posts: 18 Last: Aug 6, 2011 [view latest posts] |
|
|
Category: CoD4 Scripting Posted: Friday, Aug. 5, 2011 10:41 am |
|
Script is fine, up to the bit where you set the weapons
for(i=0;i
(Syntax error), but lets put that to one side for now, and solve the first bit.
---------------------------------------------------------------------------------------
Okay, so I made a test map.
3 rooms, when the player triggers the use trigger, he should teleport to one of the rooms depending on his team?
When looking at your script however, I seem to think its still coming from a trigger_multiple like in the original teleport script. I'm using a trigger_use, so I can only set one target, axis or allies. I'm also unsure what targetnames to give to the script_origins because of this.
|
|
|
|
IzNoGoD |
General Member Since: Nov 29, 2008 Posts: 694 Last: Nov 10, 2012 [view latest posts] |
|
|
|
acedlol |
General Member Since: Jul 19, 2011 Posts: 18 Last: Aug 6, 2011 [view latest posts] |
|
|
Category: CoD4 Scripting Posted: Friday, Aug. 5, 2011 11:31 am |
|
So I give the script_origins names:
teleportaxis1
teleportallies1
Put this into the script
target_axis=getent(teleportaxis1,"targetname");
target_allies=getent(teleportallies1,"targetname");
I get unitialised variable error at that point.
I don't want to take an array of teleports at the beginning either, I just want to get the trigger_use through a targetname, then when activated by a player pressing F, teleports either team to specific origins.
I did this, but I still get unitialised variable error
edited on Aug. 5, 2011 07:31 am by acedlol |
|
|
|
acedlol |
General Member Since: Jul 19, 2011 Posts: 18 Last: Aug 6, 2011 [view latest posts] |
|
|
Category: CoD4 Scripting Posted: Friday, Aug. 5, 2011 12:52 pm |
|
Fixed the syntax erros
Code:
main()
{
teleporter = getEnt ( "game1" , "targetname" );
targetaxis = getEnt ( "axis", "targetname");
targetallies = getEnt ( "allies" , "targetname");
teleporter waittill("trigger",player);
if(player.pers["team"]=="axis")
player.origin=targetaxis.origin;
else if(player.pers["team"]=="allies")
player.origin=targetallies.origin;
}
Although it still doesn't transport the player, it was in SD, and the match mode was on etc.
edited on Aug. 5, 2011 09:28 am by acedlol |
|
|
|
acedlol |
General Member Since: Jul 19, 2011 Posts: 18 Last: Aug 6, 2011 [view latest posts] |
|
|
Category: CoD4 Scripting Posted: Friday, Aug. 5, 2011 03:24 pm |
|
Enabled developer_script
error was
"type undefined was not a vector"
|
|
|
|
acedlol |
General Member Since: Jul 19, 2011 Posts: 18 Last: Aug 6, 2011 [view latest posts] |
|
|
Category: CoD4 Scripting Posted: Saturday, Aug. 6, 2011 08:22 am |
|
Okay, so I think I got it working, but now I have another problem.
Code:
main()
{
teleporter1 = getEnt ( "game1" , "targetname" );
targetaxis1 = getEnt ( "axis1", "targetname");
targetallies1 = getEnt ( "allies1", "targetname");
teleporter1 waittill("trigger",player);
if(player.pers["team"]=="axis")
player setOrigin( targetaxis1.origin );
player setplayerangles( targetaxis1.angles );
if(player.pers["team"]=="allies")
player setOrigin( targetallies1.origin);
player setplayerangles( targetallies1.angles );
}
But I have 2 problems now. Im using several of these scripts, about 5 atm. Heres a sample of the second one.
Code:
main()
{
teleporter2 = getEnt ( "game2" , "targetname" );
targetaxis2 = getEnt ( "axis2", "targetname");
targetallies2 = getEnt ( "allies2", "targetname");
teleporter2 waittill("trigger",player);
if(player.pers["team"]=="axis")
player setOrigin( targetaxis2.origin );
player setplayerangles( targetaxis2.angles );
if(player.pers["team"]=="allies")
player setOrigin( targetallies2.origin);
player setplayerangles( targetallies2.angles );
}
Whenever I run the map, I can only use the first trigger_use, none of the other ones work. I have put it in my fast file, AND referenced them in the main. I know they work as after using #1, I CAN use #2. I want to be able to use all of them at the same time :s
Also, the set player angles isn't working, which is very wierd
I've put them seperately as I need to add more to each script in the future ( weapons etc).
edited on Aug. 6, 2011 04:22 am by acedlol |
|
|
|
IzNoGoD |
General Member Since: Nov 29, 2008 Posts: 694 Last: Nov 10, 2012 [view latest posts] |
|
|
|
acedlol |
General Member Since: Jul 19, 2011 Posts: 18 Last: Aug 6, 2011 [view latest posts] |
|
|
Category: CoD4 Scripting Posted: Saturday, Aug. 6, 2011 09:30 am |
|
IzNoGoD writes...Quote: Code:
main()
{
teleporter2 = getEnt ( "game2" , "targetname" );
targetaxis2 = getEnt ( "axis2", "targetname");
targetallies2 = getEnt ( "allies2", "targetname");
player=undefined;
while(!isdefined(player)||!isplayer(player))
teleporter2 waittill("trigger",player);
if(player.pers["team"]=="axis")
{
player setOrigin( targetaxis2.origin );
player setplayerangles( targetaxis2.angles );
}
if(player.pers["team"]=="allies")
{
player setOrigin( targetallies2.origin);
player setplayerangles( targetallies2.angles );
}
}
You've fixed the angles problem :D !
I still can't however use any one I want, I can only use#1. Then afterwards #2, then #3, then #4 etcetc. Can't choose :(
I have this in my main map file
Code:
maps\mp\_teleportteams1::main();
maps\mp\_teleportteams2::main();
maps\mp\_teleportteams3::main();
maps\mp\_teleportteams4::main();
maps\mp\_teleportteams5::main();
And in my zone file
Code:
rawfile,maps/mp/_teleportteams1.gsc
rawfile,maps/mp/_teleportteams2.gsc
rawfile,maps/mp/_teleportteams3.gsc
rawfile,maps/mp/_teleportteams4.gsc
rawfile,maps/mp/_teleportteams5.gsc
Perhaps it has something to do with this?
The first script has to be "blocking" the rest in some sort of way, however I fail to see how.
|
|
|
|