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

Scripting: Model won't delete itself.. but trigger deletes just fine??

broken avatar :(
Created 5 years ago
by Nanikos
0 Members and 1 Guest are viewing this topic.
1,274 views
broken avatar :(
×
broken avatar :(
Location: au
Date Registered: 6 March 2019
Last active: 3 years ago
Posts
1
Respect
Forum Rank
Fresh Corpse
Primary Group
Member
×
Nanikos's Groups
Nanikos's Contact & Social Links
I have a model of a gas mask which has targetname item_pickup1 and then I've got a trigger over the top which is targetname item_pickup_trig1...
So I go in game and the script run's fine and comes up with my hintstring, I interact and I get my line prints in top left as it should, and the trigger deletes fine. But I can't delete the model at all??! Help!

Code Snippet
cpp
item_pickup()
{
item_model = GetEnt("item_pickup1", "targetname");
item_pickup_trig = GetEnt("item_pickup_trig1", "targetname");

item_pickup_trig sethintstring("Press and hold &&1 to pick up mask");

item_pickup_trig waittill("trigger", player);

item_model delete();
item_pickup_trig delete();

iPrintLn("Picked up Gas Mask");
}
Test height=100
Test2 height=100
broken avatar :(
×
broken avatar :(
Location: alDurrës
Date Registered: 6 June 2017
Last active: 9 months ago
Posts
222
Respect
Forum Rank
Mr. Elemental
Primary Group
Donator ♥
My Groups
More
My Contact & Social Links
More
Signature
My published cod maps:

Mansion of the Undead
Buros Der Toten
Minions by k3nt
×
klevi's Groups
Donator ♥ Benevolent Soul who has our eternal gratitude and exclusive access to betas and the donator section of the forum.
i am nab at scripting, you can try this 
item_pickup_trig waittill("trigger");  But what i was really wondering is that, in your map in radiant is it misc_model or script_model, it should be script_model as far as i know. That's what can i suggest right now, hope you solve it.
broken avatar :(
×
broken avatar :(
Location: fi
Date Registered: 2 January 2015
Last active: 3 years ago
Posts
125
Respect
Forum Rank
Pack-a-Puncher
Primary Group
Member
My Contact & Social Links
More
Signature
Beginner mapper trying to make something for the community to enjoy
×
ihmiskeho's Groups
ihmiskeho's Contact & Social Linksihmiskeho
Try this and check if it prints the error message. If it does, you have mispelled the kvp or haven´t set the model as script_model
Code Snippet
Plaintext
item_pickup()
{
item_model = GetEnt("item_pickup1", "targetname");
item_pickup_trig = GetEnt("item_pickup_trig1", "targetname");

item_pickup_trig sethintstring("Press and hold &&1 to pick up mask");

item_pickup_trig waittill("trigger", player);
        if(!isdefined(item_model) || item_model.size <= 0)
        {
             IPrintLnBold("Item model is missing!");
             return;
        }

item_model delete();
item_pickup_trig delete();

iPrintLn("Picked up Gas Mask");
}
broken avatar :(
×
broken avatar :(
Location: tr
Date Registered: 1 March 2013
Last active: 2 days ago
Posts
816
Respect
Forum Rank
The Decider
Primary Group
2015 Contest Winner
My Groups
More
My Contact & Social Links
More
Personal Quote
Caw caw caw
×
johndoe's Groups
Donator ♥ Benevolent Soul who has our eternal gratitude and exclusive access to betas and the donator section of the forum.
Community Mapper Has released one or more maps to the UGX-Mods community which have been added to the UGX Map Manager.
2015 Contest Winner
johndoe's Contact & Social Linksmyc153-johndoe
Are you sure the model is a script_model? You might have accidentally added a misc_model and those ones aren't able to be manupilated with scripts.

 
Loading ...