materials don't disappear


(blizzard) #1

I have got a gate that can be repaired my problem is the next:
if they build the gate the materials do not disappear.
how can i make them invisible?

thx
blizzard


(isbowhten) #2

in script:
the gate …
built
{
setstate name-of-materials invisible
}
death
{
setstate name-of-materials default
}

also other ways are possible but i think this is the easiest one


(blizzard) #3

what is the name of the materials?
this:
models/mapobjects/cmarker/cmarker_crates.md3
or this:
maingate_1_materials
or what else?


(blizzard) #4

i have got this in the script

maingate_1
{
spawn
{
wait 50
trigger self setup
constructible_class 3 // 2=Satchel 3=Dyna
}

trigger setup
{
	setstate maingate_1_materials default	// Crate Models
	setstate maingate_1_clip default		// Clip brushes
	setstate maingate_1_flag default
}

built final
{
	setstate maingate_1_materials invisible	// Crate Models
	setstate maingate_1_clip invisible	// Clip brushes
	setstate maingate_1_flag invisible

	wm_announce "Allied Team have built the maingate!"
}

decayed final
{
	trigger self setup
}

death
{
	trigger self setup
	wm_announce "Axis have destroyed the maingate!" 
}

}

and this doesn’t work


(isbowhten) #5

with the name i meant the targetname of the entity.
if maingate_1_materials is the targetname it should work.

decayed trigger is senseless here. cause materials do disappear when it is built and not earlier.


(blizzard) #6

i don’t get it
as you see in my script everything is right
i removed the “decayed trigger”
the targetname is the one in the script

is there a diference between built and built final?


(kamikazee) #7

isbowhten is referring to your map - entities in your map need to have a name so that you can address them from your script.
If you select the bunch of materials in the map editor and press ‘N’ to open the entity editor, what is the value of the “targetname” key?

[QUOTE=blizzard;188776]is there a diference between built and built final?[/QUOTE]There is a difference, but unless you want to make a construction which needs two steps (e.g. the bridge in fueldump) you don’t need to care about it - just use “built” and “decayed” instead of “built final” and “decayed final”.
It could even be the solution to your problem.


(blizzard) #8

kamikazee i understand you but the targetname has got the same name as the one in the script so i’m confused now i don’t know what else could it be


(TomTom7777) #9

When all else fails troubleshoot. Verify that your script events are being triggered. The less verbose way is to add print or wm_announce statements in the event blocks. If they are not being triggered (i.e your debug strings not occuring in the console) then check your script and func_construct (and associated trigger_objective_info jic).
If the event scripts are being triggered then check are you getting setstate errors in the console when the events happen? That would likely mean the gamemodels etc are not properly targeted (check their targetnames). If no setstate errors occur and the events print your debug message, check for anything that might be re-defaulting them after the event. At this point you can add more debug prints or enable (set to 1) the verbose script debug cvar g_scriptdebug. Also check does any other entity target them by mistake.


(kamikazee) #10

Kamikazee slaps forehead

I actually meant the “scriptname” key. Check you have those right, as targetnames are only used entities within your map.