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

Problem with

broken avatar :(
Created 9 years ago
by Wolf_Silver
0 Members and 1 Guest are viewing this topic.
2,441 views
broken avatar :(
×
broken avatar :(
Location: frPontault-Combault, France
Date Registered: 18 October 2014
Last active: 2 months ago
Posts
86
Respect
Forum Rank
Rotting Walker
Primary Group
Member
My Contact & Social Links
More
Signature
Visitez mon site : http://www.fr-mapping.net/index.php pour rejoindre la communauté Française sur le mod tools!
visit my website : http://www.fr-mapping.net/index.php to join french communauty on mod tools
×
Wolf_Silver's Groups
Hello guys i want that if a specific models (viewmodel_bo2_hachet) touch a trig he si trigered i have already try to fix myself problem but i fail  :'(

Here my current script:
Code Snippet
Plaintext
Crane3()
{
    Crane3 = getEnt("crane3", "targetname");
    Crane3_trig = getEnt("crane3_trig", "targetname");

while(true)
{
hatchet_detect = spawn("script_model", self.origin);
hatchet_detect setmodel("viewmodel_bo2_hachet");
Crane3_trig waittill("trigger", hatchet_detect);
if(hatchet_detect isTouching(Crane3_trig))
{
iprintlnbold("ok");
}

With this script it doesn't work and trig is actived when i move around the triggers...

thanks you for reading this and double thank you to try to help me ^^
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: 27 January 2015
Last active: 7 years ago
Posts
337
Respect
Forum Rank
Perk Hacker
Primary Group
Member
Signature
×
liamsa669's Groups
liamsa669's Contact & Social Links
Hello guys i want that if a specific models (viewmodel_bo2_hachet) touch a trig he si trigered i have already try to fix myself problem but i fail  :'(

Here my current script:
Code Snippet
Plaintext
Crane3()
{
    Crane3 = getEnt("crane3", "targetname");
    Crane3_trig = getEnt("crane3_trig", "targetname");

while(true)
{
hatchet_detect = spawn("script_model", self.origin);
hatchet_detect setmodel("viewmodel_bo2_hachet");
Crane3_trig waittill("trigger", hatchet_detect);
if(hatchet_detect isTouching(Crane3_trig))
{
iprintlnbold("ok");
}

With this script it doesn't work and trig is actived when i move around the triggers...

thanks you for reading this and double thank you to try to help me ^^
Code Snippet
Plaintext
Crane3()
{
    Crane3 = getEnt("crane3", "targetname");
        Crane3_trig = getEnt("crane3_trig", "targetname");
    hatchet_detect = spawn("script_model", self.origin);
        hatchet_detect.angles = self.angles;
        hatchet_detect setmodel("viewmodel_bo2_hachet"); // moved this outside the loop so you dont keep spawning models
    while(true)
    {
               
                //Crane3_trig waittill("trigger", hatchet_detect); this waits till a player hits the trig -_- then defines the player as hatchet_detect
                if(hatchet_detect isTouching(Crane3_trig))
                {
                        iprintlnbold("ok");
                }
                wait .5; // this wait is really important
        }
}
try that, i added comments to what you did wrong
broken avatar :(
×
broken avatar :(
Location: frPontault-Combault, France
Date Registered: 18 October 2014
Last active: 2 months ago
Posts
86
Respect
Forum Rank
Rotting Walker
Primary Group
Member
My Contact & Social Links
More
×
Wolf_Silver's Groups
Thanks man!

Comment are very useful! but i just know when and why put wait?

script don't work : in game i see "ok" show up in looping but after modification i replaced:
Code Snippet
Plaintext
if(hatchet_detect isTouching(Crane3_trig))
by:
Code Snippet
Plaintext
if( IsDefined( hatchet_detect.HitTrigger ) )

And now trigger says in looping that trigger is not trigered (i have also add a
Code Snippet
Plaintext
else
{
iprintlnbold("not trigered")
}
) even when i launch my tomahawh in trig /:
broken avatar :(
×
broken avatar :(
Location: nlApeldoorn
Date Registered: 17 December 2013
Last active: 1 year ago
Posts
1,187
Respect
1,404Add +1
Forum Rank
Zombie Colossus
Primary Group
Community Scripter Elite
My Groups
More
My Contact & Social Links
More
Personal Quote
It aint much, if it aint Dutch
Signature
×
BluntStuffy's Groups
Donator ♥ Benevolent Soul who has our eternal gratitude and exclusive access to betas and the donator section of the forum.
Community Scripter Elite Has shown excellence and experience in the area of custom scripting in the UGX-Mods community.
Oil Rig Beta Access
Oil Rig Beta Access
BluntStuffy's Contact & Social LinksBluntstuffy@BluntZombieBluntStuffyStuffyZombie
Thanks man!

Comment are very useful! but i just know when and why put wait?

script don't work : in game i see "ok" show up in looping but after modification i replaced:
Code Snippet
Plaintext
if(hatchet_detect isTouching(Crane3_trig))
by:
Code Snippet
Plaintext
if( IsDefined( hatchet_detect.HitTrigger ) )

And now trigger says in looping that trigger is not trigered (i have also add a
Code Snippet
Plaintext
else
{
iprintlnbold("not trigered")
}
) even when i launch my tomahawh in trig /:

If you simply replaced:

Code Snippet
Plaintext
if(hatchet_detect isTouching(Crane3_trig))

with

Code Snippet
Plaintext
if( IsDefined( hatchet_detect.HitTrigger ) )

That wont work.. Isdefined only checks if the ent or var exists and then returns true or false. I dont see you define hatchet_detect.HitTrigger anywhere, so it will just return false..

Also not sure what you're trying to do here, so cant really give any advice on how to do it  :P
broken avatar :(
×
broken avatar :(
Location: frPontault-Combault, France
Date Registered: 18 October 2014
Last active: 2 months ago
Posts
86
Respect
Forum Rank
Rotting Walker
Primary Group
Member
My Contact & Social Links
More
×
Wolf_Silver's Groups
In my map i have included tomahawk and i want that when player launch them in the trigger he change his tomahawk for upgraded version like this:
Code Snippet
Plaintext
	players = getplayers();	
for(i = 0; i < players.size; i++)
{
players[i] takeweapon("tomahawk");
players[i] giveweapon("tomahawk_up");
players[i] switchtoweapon("tomahawk_up");
}
Marked as best answer by Wolf_Silver 9 years ago
broken avatar :(
×
broken avatar :(
Location: us
Date Registered: 27 January 2015
Last active: 7 years ago
Posts
337
Respect
Forum Rank
Perk Hacker
Primary Group
Member
×
liamsa669's Groups
liamsa669's Contact & Social Links
Code Snippet
Plaintext
cat(){
noobs = get_players();
for(i=0;i<noobs.size;i++)
noobs[i] meow();
}
meow(){
for(;;)
{
trig = getEnt("crane3_trig", "targetname");
self waittill("grenade_fire", grenade, weapname);
if ( weapname == "tomahawk" && grenade istouching(trig) )
{
grenade delete();
self takeweapon("tomahawk");
self giveweapon("tomahawk_up");
self switchtoweapon("tomahawk_up");
}
}
}
This only works if your tomahawk is a grenade, if not then you would have to use a diffrent method
Last Edit: June 28, 2015, 08:11:04 pm by liamsa669
broken avatar :(
×
broken avatar :(
Location: frPontault-Combault, France
Date Registered: 18 October 2014
Last active: 2 months ago
Posts
86
Respect
Forum Rank
Rotting Walker
Primary Group
Member
My Contact & Social Links
More
×
Wolf_Silver's Groups
yeah it's a secondary grenade

that's worked! thanks for help!
Last Edit: June 29, 2015, 04:37:02 am by Wolf_Silver

 
Loading ...