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

Playing fx with a specific weapon

broken avatar :(
Created 11 years ago
by thebromonkey
0 Members and 1 Guest are viewing this topic.
2,750 views
broken avatar :(
×
broken avatar :(
Location: se
Date Registered: 27 December 2013
Last active: 8 years ago
Posts
64
Respect
Forum Rank
Rotting Walker
Primary Group
Member
×
thebromonkey's Groups
thebromonkey's Contact & Social Links
Hello again  :)
So I was wondering is there a way to play a fx with a trigger_damage but with a specific weapon?
I'm pretty sure it requires scripting and I quite suck at scripting  :P
I know there's a tut how to open a door with a specific weapon is that something similar?
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: 11 March 2014
Last active: 5 years ago
Posts
264
Respect
Forum Rank
Mr. Elemental
Primary Group
Member
Signature
"Always code as if the guy who ends up maintaining your code will be a violent psychopath who knows where you live."
×
buttkicker845's Groups
buttkicker845's Contact & Social Links
Hello again  :)
So I was wondering is there a way to play a fx with a trigger_damage but with a specific weapon?
I'm pretty sure it requires scripting and I quite suck at scripting  :P
I know there's a tut how to open a door with a specific weapon is that something similar?
just to make sure your wanting to play an fx in the world when a player damages something with a specific weapon?
broken avatar :(
×
broken avatar :(
Location: se
Date Registered: 27 December 2013
Last active: 8 years ago
Posts
64
Respect
Forum Rank
Rotting Walker
Primary Group
Member
×
thebromonkey's Groups
thebromonkey's Contact & Social Links
just to make sure your wanting to play an fx in the world when a player damages something with a specific weapon?
Yes you got me all right  :P
broken avatar :(
×
broken avatar :(
Location: us
Date Registered: 11 March 2014
Last active: 5 years ago
Posts
264
Respect
Forum Rank
Mr. Elemental
Primary Group
Member
×
buttkicker845's Groups
buttkicker845's Contact & Social Links
if you use this tutorial you can edit it in order to play an fx
http://ugx-mods.com/forum/index.php/topic,4508.msg49909.html#msg49909
instead of move a door
broken avatar :(
×
broken avatar :(
Location: se
Date Registered: 27 December 2013
Last active: 8 years ago
Posts
64
Respect
Forum Rank
Rotting Walker
Primary Group
Member
×
thebromonkey's Groups
thebromonkey's Contact & Social Links
if you use this tutorial you can edit it in order to play an fx
http://ugx-mods.com/forum/index.php/topic,4508.msg49909.html#msg49909
instead of move a door
Okey, I will try but I have no idea what i'm doing  :P
Scripting I do not know, yet
Marked as best answer by thebromonkey 11 years ago
broken avatar :(
×
broken avatar :(
Location: us
Date Registered: 11 March 2014
Last active: 5 years ago
Posts
264
Respect
Forum Rank
Mr. Elemental
Primary Group
Member
×
buttkicker845's Groups
buttkicker845's Contact & Social Links
this edited version the tutorial script will play an fx on the trigger once its been activated
Code Snippet
Plaintext
ShootTrigger(){
shoot = getentarray("shoot_door", "targetname");
requiredWeapon = "none"; //change to weapon specific name
for(trig=0;trig<shoot.size;trig++){
door = getentarray(shoot[trig].target, "targetname");
for(d=0;d<door.size;d++){
door[d] thread TrigAction(shoot[trig],requiredWeapon,"door"); //change for other action
}
shoot[trig] thread TrigAction(shoot[trig],requiredWeapon,"sound"); //change for other action
shoot[trig] thread TrigAction(shoot[trig], requiredWeapon,"fx");
}
}
TrigAction(trig,requiredWeapon,action){
while(1){
trig waittill("trigger", player);
weapon = player getcurrentweapon();
if(requiredWeapon == "none" || weapon==requiredWeapon){
break;
}
wait(.1);
}
if(action=="door"){
move = (0,0,100);
if(isdefined(self.script_vector)){ //adjust in radiant or the door will just move up 100
move = self.script_vector;
}
speed = 1;
self moveto(self.origin + move,1);
self ConnectPaths();
trig delete();
wait(1);
// self delete(); //if you want to delete the door after it moves
}else if(action=="sound"){
play_sound_at_pos("door_slide_open", self.origin);
}
else if(action=="fx"){ //un-comment these lines and add your own action for something if you want
playFXOnTag(level._effects["name_of_effect"],trig,"tag_origin");
}
}
this is done using the method playFXOnTag() which plays an fx on a specified tag of an entity(in this case "tag_origin"). this can be used to move an fx with an entity as its being moved

if the fx you want to play isnt being used anywhere else in the level you will need to make sure you load the fx using the line
Code Snippet
Plaintext
level._effect["name_fo_effect"] 				= loadfx( "location_of_fx_in_you_fx_folder_in_raw" );//long string name xD
please make sure to give makecents credit for the origin script. and let me know if you need any more help :)
broken avatar :(
×
broken avatar :(
Location: se
Date Registered: 27 December 2013
Last active: 8 years ago
Posts
64
Respect
Forum Rank
Rotting Walker
Primary Group
Member
×
thebromonkey's Groups
thebromonkey's Contact & Social Links
this edited version the tutorial script will play an fx on the trigger once its been activated
Code Snippet
Plaintext
ShootTrigger(){
shoot = getentarray("shoot_door", "targetname");
requiredWeapon = "none"; //change to weapon specific name
for(trig=0;trig<shoot.size;trig++){
door = getentarray(shoot[trig].target, "targetname");
for(d=0;d<door.size;d++){
door[d] thread TrigAction(shoot[trig],requiredWeapon,"door"); //change for other action
}
shoot[trig] thread TrigAction(shoot[trig],requiredWeapon,"sound"); //change for other action
shoot[trig] thread TrigAction(shoot[trig], requiredWeapon,"fx");
}
}
TrigAction(trig,requiredWeapon,action){
while(1){
trig waittill("trigger", player);
weapon = player getcurrentweapon();
if(requiredWeapon == "none" || weapon==requiredWeapon){
break;
}
wait(.1);
}
if(action=="door"){
move = (0,0,100);
if(isdefined(self.script_vector)){ //adjust in radiant or the door will just move up 100
move = self.script_vector;
}
speed = 1;
self moveto(self.origin + move,1);
self ConnectPaths();
trig delete();
wait(1);
// self delete(); //if you want to delete the door after it moves
}else if(action=="sound"){
play_sound_at_pos("door_slide_open", self.origin);
}
else if(action=="fx"){ //un-comment these lines and add your own action for something if you want
playFXOnTag(level._effects["name_of_effect"],trig,"tag_origin");
}
}
this is done using the method playFXOnTag() which plays an fx on a specified tag of an entity(in this case "tag_origin"). this can be used to move an fx with an entity as its being moved

if the fx you want to play isnt being used anywhere else in the level you will need to make sure you load the fx using the line
Code Snippet
Plaintext
level._effect["name_fo_effect"] 				= loadfx( "location_of_fx_in_you_fx_folder_in_raw" );//long string name xD
please make sure to give makecents credit for the origin script. and let me know if you need any more help :)
Thanks you very much  :D
I will be sure to credit you aswell

 
Loading ...