Call of Duty: Black Ops 3 => Help Desk => Scripting => Topic started by: DeletedUser on January 08, 2017, 02:09:00 pm
Title: How to make a trigger remove objects when player uses it?
Post by: DeletedUser on January 08, 2017, 02:09:00 pm
The whole idea is to have a button on my map so that the player can interact with it and some object would just get removed or deleted from the map. Is there any way to do that? Thanks!
Title: Re: How to make a trigger remove objects when player uses it?
Post by: All0utWar on January 08, 2017, 08:57:29 pm
This should work. You can name the variables whatever you want. Just make sure that the targetnames match with Radiant.
Title: Re: How to make a trigger remove objects when player uses it?
Post by: DeletedUser on January 09, 2017, 05:18:54 am
This should work. You can name the variables whatever you want. Just make sure that the targetnames match with Radiant.
Thanks for your solution but it didn't work. I added a trigger_use on the button, edited trigger_use target name as remove_tree (Since I'm removing tree as a object). I replaced target name of the button as remove_tree_button. I've also renamed targetnames of trees to tree.
On the script side I was confused, I renamed object_name as remove_tree_button, on the second line, I replaced object_trigger_name as remove_tree and that was it. Do I have to edit the targetname of the trigger to match the tree's targetname?
Title: Re: How to make a trigger remove objects when player uses it?
Post by: buttkicker845 on January 09, 2017, 02:51:19 pm
this would only work on one trigger and one object. something like this would work better,
Title: Re: How to make a trigger remove objects when player uses it?
Post by: MakeCents on January 09, 2017, 02:58:29 pm
I made a tutorial series that will work for this. In the tutorial it is for shootables, but if you use trigger uses, and add a hintstring and hintcursor, it will work the same.
your right about that, i guess thats what happens when you walk away from the computer while writing code that youre not commenting
fixed it here
Cool, but there is still a slight issue with your code, such as if the player does not have enough points the script will end anyway, and i think a typo on your .size(). And If may make a slight adjustment...
Title: Re: How to make a trigger remove objects when player uses it?
Post by: buttkicker845 on January 09, 2017, 04:17:55 pm
yeah no problem, im glad you checked it. i havent scripted in cod for way too long and made some very stupid mistakes on that one. Thanks :)
Title: Re: How to make a trigger remove objects when player uses it?
Post by: DeletedUser on January 10, 2017, 04:04:52 am
Thanks for you all for helping, I have got the script in my gsc, however how do I get this to work on Radient side? I renamed trigger_use on the elevator button, added hint_string (Which doesn't display in-game) and added a target on trigger_use to target the trees.
Sorry I am quite new to scripting, majority of gsc scripts are from tutorials etc.