Interesting adventures in scripting

Discussion for any ET/ETPro/BayonET bugs or cheats you find...

Moderators: Forum moderators, developers

Post Reply
User avatar
mortis
Posts: 360
Joined: Tue Jul 06, 2004 11:57 pm
Location: at the center of the e-universe
Contact:

Interesting adventures in scripting

Post by mortis »

My bugfix script for snatch2 has taken script mangling to a whole new level. I had delete a bad Team Wolf Objective and and 12 bad spawns, then spawn in a new TWO and new spawns, give them an on/off routine, adjust the autospawns and fix other bugs while I was at it. Full script is found here if you'd like to read along at home.

To remove entities, your must know their x y z coordinates. The script routine to remove them is very simple:

Code: Select all


		delete
		{

			origin "-864 -1966 318"	
	
		}
Then rinse and repeat for until all offending entities are removed, in the case of snatch2, that meant removing 13 entities. Any references to removed entities must be commented out! If you do not do so, Wolfy may completely freak out when those entities are called on!

New entities are added normally:

For the TWO

Code: Select all


		create
		{
			scriptName "snatchhq_obj"
			classname "team_WOLF_objective"
			targetname "snatchhq_obj"
			origin "-824 -1966 318"	// z = CC_FILTER_ALLIES(2) | CC_FILTER_SPAWNS(4)
			spawnflags 2	// TEAM_ALLIES(2)
		}
and for the spawns

Code: Select all

		create
		{
			scriptName "snatchhq_spawn1"
			classname "team_CTF_bluespawn"
			targetname "snatchhq_spawn"
			origin "-896 -1792 198"
			spawnflags 2	// TEAM_ALLIES
		}
I thieved bani's fueldump on/off/spawn routines...adjusted for my TWO and spawns, of course.

Code: Select all


snatchhq_obj
{
	spawn
	{
		set
		{
			//these have to be set inside the spawn{} function, not create{}
			description "Forest House Spawn"
			message "Forest House Spawn"
		}
		wait 50
		setstate snatchhq_obj invisible
		setstate snatchhq_spawn invisible

	}

	trigger on
	{               
		setstate snatchhq_obj default
		setstate snatchhq_spawn default
	}

	trigger off
	{
		setstate snatchhq_obj invisible
		setstate snatchhq_spawn invisible
	}
}

Activated / disabled it at CP features routines ( trigger disable_allied_features and trigger enable_allied_features):

Code: Select all


	// mortis
	wait 50
	trigger snatchhq_obj on
	wm_announce "The Allied Forest House Spawn has been enabled!"



and

Code: Select all

	wait 50
	trigger snatchhq_obj off
	wm_announce "The Allied Forest House Spawn has been disabled!"
And that's all folks. 22 mangled entities right before your very eyes.
Last edited by mortis on Wed Jun 14, 2006 7:33 am, edited 1 time in total.
User avatar
deej
Posts: 743
Joined: Fri Mar 19, 2004 12:44 am
Location: Belgium!
Contact:

Post by deej »

Dumb question probably but what is TWO?
Our servers now run on 64 bit steroids. Point your ET to:
- Forgotten Ground StopWatch Server with occasional wolfrof 1
- Fraggle Rock ETPub Server - Mix up ET/UT & Duke Nukem
User avatar
=FF=im2good4u
Posts: 3821
Joined: Wed Feb 05, 2003 7:30 am
Location: The Netherlands, HOLLAND
Contact:

Post by =FF=im2good4u »

nice job btw he means a Team_WOLF_Objective (its kinda a selecable spawn point)
User avatar
ReyalP
Posts: 1663
Joined: Fri Jul 25, 2003 11:44 am

Post by ReyalP »

FWIW, delete should work on the following keys:

Code: Select all

scriptname
classname
targetname
origin
You should even be able to combine them e.g.

Code: Select all

delete 
{
 classname "team_CTF_bluespawn"
 targetname "foobarspawns"
}
That means delete all the team_CTF_bluespawn entities with targetname "foobarspawns"
send lawyers, guns and money
User avatar
mortis
Posts: 360
Joined: Tue Jul 06, 2004 11:57 pm
Location: at the center of the e-universe
Contact:

Post by mortis »

I tried using multiple keys, but I got a bunch of errors.
User avatar
mortis
Posts: 360
Joined: Tue Jul 06, 2004 11:57 pm
Location: at the center of the e-universe
Contact:

Post by mortis »

deleting by targetname seems to work okay:

Code: Select all

		//mortis delete health ammo toi
		delete
		{

			targetname "south_hacabinet_toi"	
	
		}

		delete
		{

			targetname "north_hacabinet_toi"	
	
		}
It removed those TOIs flawlessly.
nUllSkillZ
Posts: 62
Joined: Mon Dec 29, 2003 12:25 pm

Post by nUllSkillZ »

Nice find.

If there's a scriptname entities can be "removed".
Example from "goldrush_lms.script":

Code: Select all

tankdepot_axis_spawns
{
	spawn
	{
		remove
	}
}
Not sure about the following:

Code: Select all

kill            <targetname> 
nUllSkillZ
Posts: 62
Joined: Mon Dec 29, 2003 12:25 pm

Post by nUllSkillZ »

Entities can not only be created in the game_manager/spawn-event but also in an entity_scriptname/spawn-event.

[edit]
Seems not to work with all entites.

Tested so far:
Not working with "info_train_spline_main".
Working with "team_WOLF_checkpoint".
[/edit]
nUllSkillZ
Posts: 62
Joined: Mon Dec 29, 2003 12:25 pm

Post by nUllSkillZ »

Is there a possibility to set scriptnames for entites without one?
If not it seems to be the only missing feature.
User avatar
ReyalP
Posts: 1663
Joined: Fri Jul 25, 2003 11:44 am

Post by ReyalP »

nUllSkillZ wrote:Is there a possibility to set scriptnames for entites without one?
If not it seems to be the only missing feature.
You may be able to remove the entity (as described above) and create a new one. Otherwise, you cannot, AFAIK.
send lawyers, guns and money
Post Reply