Login x
User Name:
Password:
Social Links Facebook Twitter YouTube Steam RSS News Feeds

Members Online

»
0 Active | 122 Guests
Online:

LATEST FORUM THREADS

»
CoD: Battle Royale
CoD+UO Map + Mod Releases
Damaged .pk3's
CoD Mapping
heli to attack ai
CoD4 SP Mapping

Forums

»

Welcome to the MODSonline.com forums. Looking for Frequently Asked Questions? Check out our FAQs section or search it out using the SEARCH link below. If you are new here, you may want to check out our rules and this great user's guide to the forums and the website.
For more mapping and modding information, see our Wiki: MODSonWiki.com

Jump To:
Forum: All Forums : Call of Duty 4
Category: CoD4 Scripting
Scripting and coding with Call of Duty 4.
Moderators: foyleman, Foxhound, Mystic, StrYdeR, batistablr, Welshy, DrBiggzz, supersword, playername, novemberdobby
Latest Posts
Subscribed Posts
Search
Restricted Access Topic is Locked
Page
Next Page
subscribe
Author Topic: Complicated thingy :(
acedlol
General Member
Since: Jul 19, 2011
Posts: 18
Last: Aug 6, 2011
[view latest posts]
Level 1
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 ? [cry]

Thanks in advance.


edited on Aug. 5, 2011 03:59 am by acedlol
Share |
IzNoGoD
General Member
Since: Nov 29, 2008
Posts: 694
Last: Nov 10, 2012
[view latest posts]
Level 6
Category: CoD4 Scripting
Posted: Friday, Aug. 5, 2011 09:25 am
Code:

main()
{
	teleporters=getentarray("teleport","targetname");
	for(i=0;i<teleporters.size;i++)
		teleporters[i] thread waitforplayers();
}

waitforplayers()
{
	target_axis=getent(self.target_axis,"targetname");
	target_allies=getent(self.target_allies,"targetname");
	weapon=self.weaponname;
	self waittill("trigger",player);
	if(player.pers["team"]=="axis")
		player.origin=target_axis.origin;
	else if(player.pers["team"]=="allies")
		player.origin=target_allies.origin;
	players=getentarray("player","classname")
	for(i=0;i<players.size;i++)
		players[i] setweaponslotweapon("primaryb",weapon);
}
Share |
acedlol
General Member
Since: Jul 19, 2011
Posts: 18
Last: Aug 6, 2011
[view latest posts]
Level 1
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.





Share |
IzNoGoD
General Member
Since: Nov 29, 2008
Posts: 694
Last: Nov 10, 2012
[view latest posts]
Level 6
Category: CoD4 Scripting
Posted: Friday, Aug. 5, 2011 10:57 am
Give the targets a random name, or something descriptive, like "teleport1axis" "teleport1allies" and put it in the key "target_axis" "teleport1axis" and "target_allies" "teleport1allies".
Share |
acedlol
General Member
Since: Jul 19, 2011
Posts: 18
Last: Aug 6, 2011
[view latest posts]
Level 1
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 [crazy]


edited on Aug. 5, 2011 07:31 am by acedlol
Share |
acedlol
General Member
Since: Jul 19, 2011
Posts: 18
Last: Aug 6, 2011
[view latest posts]
Level 1
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
Share |
acedlol
General Member
Since: Jul 19, 2011
Posts: 18
Last: Aug 6, 2011
[view latest posts]
Level 1
Category: CoD4 Scripting
Posted: Friday, Aug. 5, 2011 03:24 pm
Enabled developer_script

error was

"type undefined was not a vector"
[cry]
Share |
acedlol
General Member
Since: Jul 19, 2011
Posts: 18
Last: Aug 6, 2011
[view latest posts]
Level 1
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).
[cry]




edited on Aug. 6, 2011 04:22 am by acedlol
Share |
IzNoGoD
General Member
Since: Nov 29, 2008
Posts: 694
Last: Nov 10, 2012
[view latest posts]
Level 6
Category: CoD4 Scripting
Posted: Saturday, Aug. 6, 2011 09:12 am
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 );
	}
}
Share |
acedlol
General Member
Since: Jul 19, 2011
Posts: 18
Last: Aug 6, 2011
[view latest posts]
Level 1
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.
Share |
Restricted Access Topic is Locked
Page
Next Page
subscribe
MODSonline.com Forums : Call of Duty 4 : CoD4 Scripting

Latest Syndicated News

»
Codutility.com up and runn...
Nice, and there still using the logo and template for the screenshots, which...
Codutility.com up and runn...
dundy writes...Quote:Call of Duty modding and mapping is barly alive only a ...
Codutility.com up and runn...
Mystic writes...Quote:It seems to me the like the site is completely dead? ...
Codutility.com up and runn...
It seems to me the like the site is completely dead?

Partners & Friends

»