UGX-Mods Login

or login with an authentication provider below
Sign In with Google
Sign In with Twitter
Sign In with Discord
Sign In with Steam
Sign In with Facebook
Sign In with Twitch

Delete model after trigger

broken avatar :(
Created 10 years ago
by fanmagic
0 Members and 1 Guest are viewing this topic.
3,854 views
broken avatar :(
×
broken avatar :(
Location: deDortmund
Date Registered: 20 December 2015
Last active: 2 years ago
Posts
307
Respect
Forum Rank
Perk Hacker
Primary Group
Scripter
My Groups
More
Personal Quote
Payback
Signature
Tears Of The Fallen | Join the project https://discord.gg/8gDNQRj
×
fanmagic's Groups
Scripter Has shown effort and knowledge in the area of scripting while being a part of the UGX-Mods community.
fanmagic's Contact & Social LinksTears Of The Fallen
Hello,
I want to know how i can delete a model after i use a trigger for example with this script:

Quote
main()
{
   iprintln ("Objectives");
   wait 5;
   iprintln ("Take the key!");
   
   trig = getEnt ("key","targetname");
   trig setHintString ("Press &&1 to take the key");
   trig setCursorHint ("HINT_NOICON");
   trig UseTriggerRequireLookAt();
   
   trig waittill ("trigger");
   trig Delete();
   iprintln ("Objective complete");
}

So it looks something like this:

Quote
main()
{
   iprintln ("Objectives");
   wait 5;
   iprintln ("Take the key!");
   
   trig = getEnt ("key","targetname");
   trig setHintString ("Press &&1 to take the key");
   trig setCursorHint ("HINT_NOICON");
   trig UseTriggerRequireLookAt();
   
   trig waittill ("trigger");
   trig Delete();

---> Delete model here <---

   iprintln ("Objective complete");
}

So when I use the trigger with the targetname "key" the model with the targetname "key1" will delete.

Thanks for your help.

-fanmagic.
This topic contains a post which is marked as the Best Answer. Click here to view it.
broken avatar :(
×
broken avatar :(
[UGX] Documentation Writer & Programmer
Location: usLos Angeles, CA
Date Registered: 23 August 2013
Last active: 3 years ago
Posts
1,322
Respect
Forum Rank
Zombie Colossus
Primary Group
UGX Team Member
My Groups
More
My Contact & Social Links
More
Personal Quote
(ง º ω º )ง u wont sum m8y?
Signature
Do not take life too seriously. You will never get out of it alive.
×
DidUknowiPwn's Groups
UGX Team Member
Donator ♥ Benevolent Soul who has our eternal gratitude and exclusive access to betas and the donator section of the forum.
Scripter Elite Has shown excellence and experience in the area of custom scripting in the UGX-Mods community.
BO3 Modtools Alpha
BO3 Modtools Alpha
This user has access to the Black Ops 3 Modtools Alpha
Either associate the trigger as a target to the model or set another targetname for it and delete it.

(ent.target = trigger, ent = model)
broken avatar :(
×
broken avatar :(
Location: deDortmund
Date Registered: 20 December 2015
Last active: 2 years ago
Posts
307
Respect
Forum Rank
Perk Hacker
Primary Group
Scripter
My Groups
More
Personal Quote
Payback
×
fanmagic's Groups
Scripter Has shown effort and knowledge in the area of scripting while being a part of the UGX-Mods community.
fanmagic's Contact & Social LinksTears Of The Fallen
Either associate the trigger as a target to the model or set another targetname for it and delete it.

(ent.target = trigger, ent = model)

Can you give me an example, please?
broken avatar :(
×
broken avatar :(
RadihaX
Location: caCanada
Date Registered: 2 September 2012
Last active: 5 years ago
Posts
978
Respect
Forum Rank
The Decider
Primary Group
Mapper Elite
My Groups
More
My Contact & Social Links
More
Signature
Overrun
Lockdown
Overrun (Black Ops Mod)
Snowglobe
Leviathan
Abandoned School
Ski Resort
Leviathan Redux
×
JBird632's Groups
Donator ♥ Benevolent Soul who has our eternal gratitude and exclusive access to betas and the donator section of the forum.
UGX V.I.P.
UGX V.I.P.
Mapper Elite Has shown excellence and experience in the area of custom mapping in the UGX-Mods community.
Scripter Elite Has shown excellence and experience in the area of custom scripting in the UGX-Mods community.
BO3 Modtools Alpha
BO3 Modtools Alpha
This user has access to the Black Ops 3 Modtools Alpha
JBird632's Contact & Social LinksJBird632JBird632JBird632JBird632JBird632Mapper
To elaborate on what Dukip said:
Either have the trigger target the script_model and then in script you can get the script_model by
Code Snippet
Plaintext
trig = GetEnt ("key","targetname");
model = GetEnt(trig.target, "targetname");
/* ... other code ... */
trig delete();
model delete();
Or you can just set the model up the same way you did the trigger, where you named the targetname of the trigger and called it in script.
Also remember to have the model as a script_model in radiant, and not just a model - as normal models cannot be called through script.
Last Edit: March 17, 2016, 04:47:26 pm by JBird632
broken avatar :(
×
broken avatar :(
Location: us
Date Registered: 30 December 2012
Last active: 2 years ago
Posts
577
Respect
Forum Rank
Zombie Enslaver
Primary Group
Scripter
My Groups
More
My Contact & Social Links
More
Signature
My preferred name is "xSanchez78".
Check me out here: www.steamcommunity.com/id/xSanchez78
×
alaurenc9's Groups
Donator ♥ Benevolent Soul who has our eternal gratitude and exclusive access to betas and the donator section of the forum.
Scripter Has shown effort and knowledge in the area of scripting while being a part of the UGX-Mods community.
alaurenc9's Contact & Social LinksxSanchez78xSanchez78xSanchez78xSanchez78xSanchez78xSanchez78
Code Snippet
Plaintext
model = GetEnt( "key_model", "targetname" );
model Delete();
Marked as best answer by fanmagic 10 years ago
broken avatar :(
×
broken avatar :(
Location: us
Date Registered: 14 September 2013
Last active: 6 years ago
Posts
1,895
Respect
Forum Rank
Zombie Destroyer
Primary Group
Scripter
My Groups
More
My Contact & Social Links
More
Personal Quote
BE ORIGINAL
Signature
×
MakeCents's Groups
Mapper Has released one or more maps to the UGX-Mods community.
Scripter Has shown effort and knowledge in the area of scripting while being a part of the UGX-Mods community.
BO3 Modtools Alpha
BO3 Modtools Alpha
This user has access to the Black Ops 3 Modtools Alpha
Not to add a third variation of the same thing but he asked:

So when I use the trigger with the targetname "key" the model with the targetname "key1" will delete.

-fanmagic.


Just for his benefit, to clarify... is all. While I wouldn't usually give it a static kvp, and I would agree with and recommend dukips answer, and jbirds explanation, to get a script_model with that kvp to delete you would:

Code Snippet
Plaintext
main()
{
   iprintln ("Objectives");
   wait 5;
   iprintln ("Take the key!");
   
   trig = getEnt ("key","targetname");
   trig setHintString ("Press &&1 to take the key");
   trig setCursorHint ("HINT_NOICON");
   trig UseTriggerRequireLookAt();
   
   trig waittill ("trigger");
   trig Delete();

//---> Delete model here <---
   model = getent("key1", "targetname");
   //would suggest this if using static kvps, cause I've seen people have frustrating issues which this will make easier to find.
   //model = getentarray("key1","targetname")[0];
   if(isdefined(model)) model delete();
   iprintln ("Objective complete");
}
Last Edit: March 17, 2016, 06:01:58 pm by MakeCents
broken avatar :(
×
broken avatar :(
Location: deDortmund
Date Registered: 20 December 2015
Last active: 2 years ago
Posts
307
Respect
Forum Rank
Perk Hacker
Primary Group
Scripter
My Groups
More
Personal Quote
Payback
×
fanmagic's Groups
Scripter Has shown effort and knowledge in the area of scripting while being a part of the UGX-Mods community.
fanmagic's Contact & Social LinksTears Of The Fallen
Thank you for all the answers.  ;)

 
Loading ...