[mapscripts] Changing values and keys at existing entities

Discussions about ET modding (sdk code, player/weapon modeling)

Moderators: Forum moderators, developers

Post Reply
User avatar
Father
Posts: 107
Joined: Sat Jul 22, 2006 1:30 pm
Location: Czech Republic
Contact:

[mapscripts] Changing values and keys at existing entities

Post by Father »

Hello,

how can I change value for existing key at at existing map entity (concretely trigger_objective_info)?

I spent whole afternoon with searching solution but Google, Wolfwiki and Image Search didn't help.

I tried to use 'remove' function and remove old entity + create new entity with wanted keys and values. But it didn't work (I used 'targetname' with function 'remove'), becouse (imo) entity has not defined key 'scriptname'.
Entity has only these keys: classname, score, shortname, spawnflags, target, track. (I want to change track and shortname)


Thanx in advance
If you don't do it, someone else will.
User avatar
ReyalP
Posts: 1663
Joined: Fri Jul 25, 2003 11:44 am

Post by ReyalP »

Look for spawn and set in http://wolfwiki.anime.net/index.php/Map_scripting

Note that not all values can be meaningfully set this way. Some are used by the compiler, and some are treated in special ways by the gamecode that won't react nicely to being fiddled in mapscript.
send lawyers, guns and money
User avatar
Father
Posts: 107
Joined: Sat Jul 22, 2006 1:30 pm
Location: Czech Republic
Contact:

Post by Father »

Thaks, but it still don't work.. :oops:

I read: #955 - some trigger_objective_info fields cannot be modified from mapscript. We now allow trigger_objective_info fields to be changed in mapscript spawn section. Some (spawnflags, customimage, score, target, track, message) must be changed in the first frame, or first 3 frames. --> what does it mean for me?

Here is original part of script:

Code: Select all

barrier1
{
	spawn
	{
		wait 200
		constructible_class 3

	}
	death
	{
		wm_addteamvoiceannounce 0 "lostchildren_obj1_des"
		wm_addteamvoiceannounce 1 "lostchildren_obj1_des"

		trigger game_manager obj1_des	
	}
}
If I add 'set' command + change 'track' and 'shortname' - it don't work -->

Code: Select all

barrier1
{
	spawn
	{
		wait 50
		set
		{
			shortname "^3The First Barrier^7"
			track "The First Barrier"
		}

		wait 200
		constructible_class 3

	}
	death
	{
		wm_addteamvoiceannounce 0 "lostchildren_obj1_des"
		wm_addteamvoiceannounce 1 "lostchildren_obj1_des"

		trigger game_manager obj1_des	
	}
}
I tried add (before 'set') 'wait' 50, 100, 150, 200 - nothing helped.

Related Entity:
Image

So.. what did I omit at that script? Where is a problem?

Thnaks for any ideas
If you don't do it, someone else will.
Dersaidin
Posts: 197
Joined: Fri Aug 06, 2004 1:55 pm
Location: Australia

Post by Dersaidin »

Father wrote:Thaks, but it still don't work.. :oops:

I read: #955 - some trigger_objective_info fields cannot be modified from mapscript. We now allow trigger_objective_info fields to be changed in mapscript spawn section. Some (spawnflags, customimage, score, target, track, message) must be changed in the first frame, or first 3 frames. --> what does it mean for me?
The first three frames thing would mean that those fields are read from the bsp when the map is loaded, they're used then aren't looked at again.

Your script waits 50 (frames I think) then sets the value. So your new value will not have been set when the game first loads that entity. And the game doesn't check that particular field once it is loaded. You could try it without the wait 50.

With the idea of removing the entity and making it again, as in your previous post, I think you can also remove entities by their origin. So if you were having problems there with deleting it since it doesnt have a script name, that may help.
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 »

Dersaidin wrote:
Father wrote:Thaks, but it still don't work.. :oops:

I read: #955 - some trigger_objective_info fields cannot be modified from mapscript. We now allow trigger_objective_info fields to be changed in mapscript spawn section. Some (spawnflags, customimage, score, target, track, message) must be changed in the first frame, or first 3 frames. --> what does it mean for me?
The first three frames thing would mean that those fields are read from the bsp when the map is loaded, they're used then aren't looked at again.

Your script waits 50 (frames I think) then sets the value. So your new value will not have been set when the game first loads that entity. And the game doesn't check that particular field once it is loaded. You could try it without the wait 50.

With the idea of removing the entity and making it again, as in your previous post, I think you can also remove entities by their origin. So if you were having problems there with deleting it since it doesnt have a script name, that may help.
Give the man a cookie!

And keep in mind that the game doesn't always accept all changed values. Try removing the offending entity and replacing it with another that has the desired values, if all else fails. Note that this may change any script-dependent routines, as well.
User avatar
Father
Posts: 107
Joined: Sat Jul 22, 2006 1:30 pm
Location: Czech Republic
Contact:

Post by Father »

Moving or removing that TOI don't work - I tried everything what you mentiond above.. and nothing works. :?
If you don't do it, someone else will.
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 »

Try creating a new TOI and make set the old TOI to invisible. Connect the script block to your new TOI.
User avatar
Father
Posts: 107
Joined: Sat Jul 22, 2006 1:30 pm
Location: Czech Republic
Contact:

Post by Father »

mortis wrote:Try creating a new TOI and make set the old TOI to invisible. Connect the script block to your new TOI.

Code: Select all

setstate barrier1 invisible
don't work too.

TOI without 'scripname' is evil.. :(
If you don't do it, someone else will.
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 »

Have you tried removing the entity by using its origin (aka xyz coordinates)?
User avatar
Father
Posts: 107
Joined: Sat Jul 22, 2006 1:30 pm
Location: Czech Republic
Contact:

Post by Father »

mortis wrote:Have you tried removing the entity by using its origin (aka xyz coordinates)?
Yes, it don't work too. :?
If you don't do it, someone else will.
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 don't know what to suggest to you at this point. I have found that some entities simply cannot be removed by any method. Maybe that is what is happening in this case.
Post Reply