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

"is touching" help

HOT
broken avatar :(
Created 10 years ago
by jjbradman
0 Members and 1 Guest are viewing this topic.
4,356 views
broken avatar :(
×
broken avatar :(
drago
Location: mx
Date Registered: 5 July 2013
Last active: 4 years ago
Posts
941
Respect
Forum Rank
The Decider
Primary Group
Member
My Contact & Social Links
More
×
jjbradman's Groups
jjbradman's Contact & Social Linksjjbradmanjjbradmanjjbradman
i am trying to use istouching to wait until an ent is being touched by the player can someone say me a better way of doing this as my while and for loops keep acting as if the player would be touching the ent while it's not D:
This topic contains a post which is marked as the Best Answer. Click here to view it.
broken avatar :(
×
broken avatar :(
Location: us
Date Registered: 14 September 2013
Last active: 4 years ago
Posts
1,895
Respect
Forum Rank
Zombie Destroyer
Primary Group
Community Scripter
My Groups
More
My Contact & Social Links
More
Personal Quote
BE ORIGINAL
Signature
×
MakeCents's Groups
Community Mapper Has released one or more maps to the UGX-Mods community which have been added to the UGX Map Manager.
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
i am trying to use istouching to wait until an ent is being touched by the player can someone say me a better way of doing this as my while and for loops keep acting as if the player would be touching the ent while it's not D:

I use something like this:
Code Snippet
Plaintext
ent = getent("name","targetname");
ent thread touchme();
touchme(){
while(1){
players = get_players();
for(i=0;i<players.size;i++)
{
if(players[i] istouching(self)){
//do something if player is touching ent
}

}
wait(.5);
}
}
Last Edit: April 18, 2014, 05:56:24 am by MakeCents
broken avatar :(
×
broken avatar :(
drago
Location: mx
Date Registered: 5 July 2013
Last active: 4 years ago
Posts
941
Respect
Forum Rank
The Decider
Primary Group
Member
My Contact & Social Links
More
×
jjbradman's Groups
jjbradman's Contact & Social Linksjjbradmanjjbradmanjjbradman
I use something like this:
Code Snippet
Plaintext
ent = getent("name","targetname");
ent thread touchme();
touchme(){
        players = get_players();
while(1){

for(i=0;i<players.size;i++)
{
if(players[i] istouching(self)){
//do something if player is touching ent
}

}
wait(.5);
}
}
thanks gonna try it :) this proves that im a noob using while(1) loops xD
broken avatar :(
×
broken avatar :(
Location: us
Date Registered: 14 September 2013
Last active: 4 years ago
Posts
1,895
Respect
Forum Rank
Zombie Destroyer
Primary Group
Community Scripter
My Groups
More
My Contact & Social Links
More
Personal Quote
BE ORIGINAL
×
MakeCents's Groups
Community Mapper Has released one or more maps to the UGX-Mods community which have been added to the UGX Map Manager.
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
thanks gonna try it :) this proves that im a noob using while(1) loops xD

NP.

I had to put the get players back inside the while loop for it to work for me though. I edited it above.
broken avatar :(
×
broken avatar :(
Location: de
Date Registered: 6 August 2012
Last active: 4 years ago
Posts
277
Respect
Forum Rank
Mr. Elemental
Primary Group
Community Scripter Elite
My Groups
More
×
YaPh1l's Groups
Community Scripter Elite Has shown excellence and experience in the area of custom scripting in the UGX-Mods community.
YaPh1l's Contact & Social Links
Place a trigger_multiple around the entity and waittill("trigger")... Done.

- Phil.
broken avatar :(
×
broken avatar :(
Location: us
Date Registered: 14 September 2013
Last active: 4 years ago
Posts
1,895
Respect
Forum Rank
Zombie Destroyer
Primary Group
Community Scripter
My Groups
More
My Contact & Social Links
More
Personal Quote
BE ORIGINAL
×
MakeCents's Groups
Community Mapper Has released one or more maps to the UGX-Mods community which have been added to the UGX Map Manager.
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
Place a trigger_multiple around the entity and waittill("trigger")... Done.

- Phil.

Side note, kind of....
I am assuming he wants this for the car ride script, where the vehicle is moving. I have a moving thing in my map as well. I have been working through things I didn't like about it, just before this post. I attempted linking the trigger or moving the trigger, but failed. I just figured you were not able to and I addressed it other ways and finally settled with a script similar to the previous one I mentioned. I would prefer to link the trigger to it. Do you know if trigger move or trigger linkto is possible?
broken avatar :(
×
broken avatar :(
drago
Location: mx
Date Registered: 5 July 2013
Last active: 4 years ago
Posts
941
Respect
Forum Rank
The Decider
Primary Group
Member
My Contact & Social Links
More
×
jjbradman's Groups
jjbradman's Contact & Social Linksjjbradmanjjbradmanjjbradman
no i dont want it for the car ride and i cant use a trigger cause the thing that player is supposed to touch spawns when a zombie dies. so i cant spawn a trigger or put one in the specific place where it died

Post Merge: April 18, 2014, 04:01:47 pm
and makecents, i dont think that trigger link to is posible cause yesterday i tried to use movez with a trigger and everything moved fine except for the trigger :/
Last Edit: April 18, 2014, 04:01:47 pm by jjbradman
broken avatar :(
×
broken avatar :(
Location: de
Date Registered: 6 August 2012
Last active: 4 years ago
Posts
277
Respect
Forum Rank
Mr. Elemental
Primary Group
Community Scripter Elite
My Groups
More
×
YaPh1l's Groups
Community Scripter Elite Has shown excellence and experience in the area of custom scripting in the UGX-Mods community.
YaPh1l's Contact & Social Links
It is possbile, you have to EnableLinkTo(). Also, you can spawn a trigger_radius via script. But if it is something powerup-like (where there might be more), it would indeed be better to use IsTouching() or even just a proximity check (DistanceSquared()) like the powerups do.

- Phil.
broken avatar :(
×
broken avatar :(
Location: us
Date Registered: 14 September 2013
Last active: 4 years ago
Posts
1,895
Respect
Forum Rank
Zombie Destroyer
Primary Group
Community Scripter
My Groups
More
My Contact & Social Links
More
Personal Quote
BE ORIGINAL
×
MakeCents's Groups
Community Mapper Has released one or more maps to the UGX-Mods community which have been added to the UGX Map Manager.
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
It is possbile, you have to EnableLinkTo(). Also, you can spawn a trigger_radius via script. But if it is something powerup-like (where there might be more), it would indeed be better to use IsTouching() or even just a proximity check (DistanceSquared()) like the powerups do.

- Phil.

Wow, you're AWESOME.  :rainbow: :gusta: Can't believe that was the answer. Thanks so much. Now I can get rid of those nested loops and just thread a loop once.
broken avatar :(
×
broken avatar :(
drago
Location: mx
Date Registered: 5 July 2013
Last active: 4 years ago
Posts
941
Respect
Forum Rank
The Decider
Primary Group
Member
My Contact & Social Links
More
×
jjbradman's Groups
jjbradman's Contact & Social Linksjjbradmanjjbradmanjjbradman
It is possbile, you have to EnableLinkTo(). Also, you can spawn a trigger_radius via script. But if it is something powerup-like (where there might be more), it would indeed be better to use IsTouching() or even just a proximity check (DistanceSquared()) like the powerups do.

- Phil.
actually the trigger radious idea i think is better o.O that way the script could wait till the trigger has been touched? o.O
broken avatar :(
×
broken avatar :(
Location: de
Date Registered: 6 August 2012
Last active: 4 years ago
Posts
277
Respect
Forum Rank
Mr. Elemental
Primary Group
Community Scripter Elite
My Groups
More
×
YaPh1l's Groups
Community Scripter Elite Has shown excellence and experience in the area of custom scripting in the UGX-Mods community.
YaPh1l's Contact & Social Links
It depends on how many you have. A trigger_radius is an entity just like anything else that is scriptable. It will count towards the entity limit.

- Phil.
broken avatar :(
×
broken avatar :(
drago
Location: mx
Date Registered: 5 July 2013
Last active: 4 years ago
Posts
941
Respect
Forum Rank
The Decider
Primary Group
Member
My Contact & Social Links
More
×
jjbradman's Groups
jjbradman's Contact & Social Linksjjbradmanjjbradmanjjbradman
but the trigger radious would be deleted within 15 seconds of being spawned anywas and only 1 zombie in every 10 zombies would need the radious to be spawned
broken avatar :(
×
broken avatar :(
Location: de
Date Registered: 6 August 2012
Last active: 4 years ago
Posts
277
Respect
Forum Rank
Mr. Elemental
Primary Group
Community Scripter Elite
My Groups
More
×
YaPh1l's Groups
Community Scripter Elite Has shown excellence and experience in the area of custom scripting in the UGX-Mods community.
YaPh1l's Contact & Social Links
I'm not stopping you from anything, I'm just stating facts.

- Phil.
broken avatar :(
×
broken avatar :(
drago
Location: mx
Date Registered: 5 July 2013
Last active: 4 years ago
Posts
941
Respect
Forum Rank
The Decider
Primary Group
Member
My Contact & Social Links
More
×
jjbradman's Groups
jjbradman's Contact & Social Linksjjbradmanjjbradmanjjbradman
oh, lol then how would i spawn a trigger radious?
also what is the entity limit? and what goes to that count?
Marked as best answer by jjbradman 10 years ago
broken avatar :(
×
broken avatar :(
Location: de
Date Registered: 6 August 2012
Last active: 4 years ago
Posts
277
Respect
Forum Rank
Mr. Elemental
Primary Group
Community Scripter Elite
My Groups
More
×
YaPh1l's Groups
Community Scripter Elite Has shown excellence and experience in the area of custom scripting in the UGX-Mods community.
YaPh1l's Contact & Social Links
oh, lol then how would i spawn a trigger radious?
Code Snippet
Plaintext
// flags = same as spawnflags when putting one down in Radiant
ent = Spawn("trigger_radius", origin, flags, radius, height);

also what is the entity limit?
I think it's 1024.

and what goes to that count?
As I said, all entities, basically any game object that can be accessed by script in any way, except script_structs.

- Phil.

 
Loading ...