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

Members Online

»
0 Active | 9 Guests
Online:

LATEST FORUM THREADS

»
warfare
CoD4 Map + Mod Releases
Voting menu on maps
CoD+UO General
Hauling 911
CoDBO3 General

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: World at War
Category: CoDWW Scripting
Scripting and coding with Call of Duty: World at War.
Moderators: foyleman, Foxhound, Mystic, StrYdeR, batistablr, Welshy, DrBiggzz, supersword, playername, novemberdobby
Latest Posts
Subscribed Posts
Search
Restricted Access Topic is Locked
Page
Previous Page
subscribe
Author Topic: multiple scripted prefabs
FAFFER
General Member
Since: May 1, 2005
Posts: 647
Last: Sep 17, 2011
[view latest posts]
Level 6
Category: CoDWW Scripting
Posted: Sunday, Dec. 20, 2009 11:24 pm
heh....why do we do anythin..[wink]

its ok, looks like i m doing it the long way...coulda had half of it done by now. [lol]

thanks for your help mate, i m sure this will come in handy for some other daft scheme of mine! [biggrin]

Share |
Sevenz
General Member
Since: Apr 24, 2006
Posts: 2390
Last: May 10, 2013
[view latest posts]
Level 8
Category: CoDWW Scripting
Posted: Monday, Dec. 21, 2009 12:21 am
you can use script_origins or script_structs if needed to mark coordinates in radiant and retrieve the origins in script later. No need to turn them into script_brushmodel / script_model, they are already script entities (all script_* are!)

this is an example script to move the player around from script_origin / script_struct to the next, but it will pick them in a random order.

Code:
main()
{
	player thread flyplayer();
}

flyplayer()
{
	faffers = getentarray("faffer", "targetname");

	for (i=0; i<faffers.size; i++)
	{
		self moveto(faffers[i].origin, 1.95);
		wait 2;
	}
}


if you want a real flight path, you need to connect the script_* (select the first, select the second, hit W. this will add a key-value-pair target). give the first script_* the targetname faffer when you're done connecting them so that radiant assigns names automatically (targetname auto#)

if you have only 1 starting node:

Code:
main()
{
	faffer = getent("faffer", "targetname");

	if (!isdefined(faffer))
		return;

	player flyplayer(faffer);
}

flyplayer(destination_ent)
{
	if ( !isdefined(destination_ent) || !isdefined(destination_ent.origin) )
		return;

	self moveto(destination_ent.origin, 1.95);
	wait 2;

	// recursive call
	if (isdefined(destination_ent.target))
		self flyplayer(destination_ent.target);
}


note: in the above examples i assumed player as the player entity you wanna move. you may have to change it to self or something, so that it's the right entity.

Quote:
is this for SP, COOP or MP? and why you want/need to force the player to take a specific path?

that was a serious question =)
if you tell me/us what you wanna achieve i/we might provide a better solution for you
Share |
Sevenz
General Member
Since: Apr 24, 2006
Posts: 2390
Last: May 10, 2013
[view latest posts]
Level 8
Category: CoDWW Scripting
Posted: Monday, Dec. 21, 2009 03:09 am
here is a tested script for multiple jump pads in your map:

Code:
main()
{
	//maps\mp\mp_pipeline_fx::main();
	//maps\createart\mp_pipeline_art::main();
	maps\mp\_load::main();

	//maps\mp\_compass::setupMiniMap("compass_map_mp_pipeline");

	//setExpFog(700, 1500, 0.5, 0.5, 0.5, 0);
	//ambientPlay("ambient_pipeline");
	//VisionSetNaked( "mp_pipeline" );
	
	game["allies"] = "sas";
	game["axis"] = "russian";
	game["attackers"] = "allies";
	game["defenders"] = "axis";
	game["allies_soldiertype"] = "woodland";
	game["axis_soldiertype"] = "woodland";

	setdvar( "r_specularcolorscale", "1" );

	setdvar("r_glowbloomintensity0",".1");
	setdvar("r_glowbloomintensity1",".1");
	setdvar("r_glowskybleedintensity0",".1");
	setdvar("compassmaxrange","2200");

	thread jumppad_init();
}

jumppad_init()
{
	pad_triggers = getentarray("jumppad_trigger", "targetname");
	
	for (p=0; p<pad_triggers.size; p++)
		pad_triggers[p] thread jumppad_idle();
}

jumppad_idle()
{

// self is a trigger_multiple (our Jump Pad trigger)

	while (1)
	{
		self waittill ("trigger", player);
		
		// ensure the player is touching the trigger (actually a double-check)
		if (player istouching(self))
		{
			// mover is our helper entity, which we need to move the player
			player.mover = spawn("script_origin", (0,0,0));
			
			player.mover.origin = player.origin;
			player.mover.angles = player.angles;
			
			player linkto(player.mover);
			
			// don't thread this call, we need to wait until the moving is done...
			self jumppad_action(player);
			
			player unlink();
			player.mover delete();
			
			// waits a server frame (at sv_fps 20) to free the mover entity
			// not necessarily needed i guess, but i find it nicer =)
			wait 0.05;
		}
	}
}

jumppad_action(player)
{
	if (isdefined(self.target) && isdefined(player.mover))
	{
		// prevent script errors if targetname isn't unique in the map
		target = getentarray(self.target, "targetname");
		
		if (target.size < 1) // or: !isdefined(target[0])
			return;
		
		/#
		// throw error in dev mode only!
		if (target.size > 1)
			assertmsg("More than 1 entity with targetname \"" + self.target + "\".\nMake sure you use unique names for the Jump Pad script_origins (automatically generated if you leave targetname blank and connect an entity to another; auto#");
		#/
		
		// adjust move speed here by changing the moveto and wait time
		player.mover moveto(target[0].origin, 0.2);
		
		wait 0.2; //or: player.mover waittill("movedone");
		
		// recursive call till we reach the last Jump Pad script_origin
		target[0] jumppad_action(player);
	}
}


create a trigger_multiple in radiant (like shown in the cod4 jump pad tutorial)

targetname jumppad_trigger

create a script_origin, DON'T give it a targetname!

duplicate the script_origin as many times you want you move them all into position (they will become the flight path)

then deselect everything (ESC)

shift select the trigger and the first script_origin (should be the closest to the trigger)

Hit W to connect them (radiant will automatically give the script_origin a unique targetname, auto#)

now with the 1st script_origin still selected, shift select the 2nd and hit W again

continue till the last script_origin for that jump pad

you can select all script_origins and the trigger, hit space to duplicate all entities and move them into the desired position

note: radiant will pick new unique names for the duplicated script_origins, and that's what we need!

this unique name thing does NOT work if you put the trigger and script_origins in a prefab! the only way to select all entites for a jump pad is to use layers, but it doesn't really save time imo (the time you need to create a layer, asign the entites of a jump pad to it, select all entites of a layer vs. having to shift select all entities one by one...)

shift select = the usual way of selecting stuff in radiant, hold shift and click your left mouse button
Share |
Sevenz
General Member
Since: Apr 24, 2006
Posts: 2390
Last: May 10, 2013
[view latest posts]
Level 8
Category: CoDWW Scripting
Posted: Monday, Dec. 21, 2009 03:22 am
oh i forgot to mention:
tested on cod4, should work without any problems for waw as well. the code not related to the jump pads will look different of course.
Share |
Restricted Access Topic is Locked
Page
Previous Page
subscribe
MODSonline.com Forums : Call of Duty: World at War : CoDWW 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

»