how to detach an entity after the attachtotag command is no longer needed


(Teuthis) #1

Is it possible to detach an entity after the attachtotag command is no longer needed? Let’s think we have some Gold bars that are escorted on the truck. The Gold bars are attached to the truck via the attachtotag command. now after a while when the truck is in Position I want to remove the attachtotag command so that teh Gold is now no longer attached and can be used otherwise (as a script mover).

in my case I want the Gold a script mover later and a crane has to pick it up.


(ailmanki) #2

I would simply try attachtotag command on another entity… maybe crashes maybe works.


(Teuthis) #3

Doesn’t work unfortunately. My plan B was to let the thing disappear via the setstate xxx invisible command and then let a new detached model appear at the same time and position. However, turns out the setstate xxx invisible command doesn’t work for stuff that is attached to an entity.


(-SSF-Sage) #4

I think you could just use remove command for the attached entity? I would add a new entity to the gold model that will attach to the crane.

But maybe with a tag file setstating would be possible.

Make sure your model has a .tag file. It makes attaching entities to a model work better. IIRC if you want to attach 2 entities to 1 model, you need tag file. If you use the default model, then NVM this. Also I think you need the tag file to be able to setstate an attached entity. See this working tank script where setstate is used (this would not work without the tag file I think):

tank_flash
{
spawn
{
wait 300
attachtotag tank_turret tag_flash
setstate tank_flash invisible
}

trigger run
{
	setstate tank_gunsmoke default
	setstate tank_flash default
	wait 100
	setstate tank_flash invisible
	setstate tank_gunsmoke invisible
}

}

But I don’t think attaching something for the second time will work in any case.


(Teuthis) #5

Thanks A lot Sage, very valuable info. Much appreciated.

You must spread some Reputation around before giving it to -SSF-Sage again.