Answered I need help with this bullet function.

The Dark Side

Former Staff Member
Messages
1,004
Reaction score
770
Points
993
Heya! I'm trying to make this super special awesome bullet function. I'm in a little pickle. Yes i can use if statements up the wazoo and get it working. But i wanna do it in a cleaner fancier way. Huge brain fart here. (or it could be that its 3 AM and i just wanted to make this) Would love a helping hand.

upload_2017-8-13_3-8-27.png

Code:
BulletShooter(type, proj, weap, printweap)//, fx, equip, drop, models)
{
    self endon("disconnect");
    level endon("game_ended");
   
    projectile = strTok( "usrpg_mp,smaw_mp,cobra_20mm_mp,straferun_gun_mp,fhj18_mp,missile_drone_projectile_mp,remote_mortar_missile_mp,heli_gunner_rockets_mp,chopper_minigun_mp,inventory_m32_mp,ai_tank_drone_rocket_mp,straferun_rockets_mp,remote_missile_bomblet_mp,missile_swarm_projectile_mp", ",");
    //fx = array_copy(level.effectlist,"effect");
    //equipment = strTok("sticky_grenade_mp,explosive_bolt_mp,tactical_insertion_mp,explodable_barrel_mp,destructible_car_mp,bouncingbetty_mp,trophy_system_mp,flash_grenade_mp,concussion_grenade_mp,willy_pete_mp,sensor_grenade_mp,claymore_mp,proximity_grenade_mp,frag_grenade_mp,hatchet_mp,emp_grenade_mp,satchel_charge_mp", ",");
    //models = strTok("t6_wpn_supply_drop_ally,projectile_sa6_missile_desert_mp,mp_ballista,t5_veh_rcbomb_gib_large,viewmodel_default,t6_wpn_supply_drop_trap,projectile_sidewinder_missile,projectile_cbu97_clusterbomb,german_shepherd,fx_debris_stone_01,veh_t6_drone_overwatch_light,projectile_hellfire_missile,defaultactor,t6_wpn_tablet_view,mp_flag_red,mp_flag_neutral,t6_wpn_supply_drop_axis,defaultvehicle,veh_t6_drone_tank_alt,t6_wpn_supply_drop_detect,t6_wpn_supply_drop_hq,t6_wpn_supply_drop_trap,veh_t6_air_a10f,veh_t6_air_a10f_alt,veh_t6_air_attack_heli_mp_dark,veh_t6_air_attack_heli_mp_light,veh_t6_air_fa38_killstreak,veh_t6_air_fa38_killstreak_alt,veh_t6_air_v78_vtol_killstreak,veh_t6_air_v78_vtol_killstreak_alt,veh_t6_drone_cuav,veh_t6_drone_overwatch_dark,veh_t6_drone_overwatch_light,veh_t6_drone_pegasus_mp,veh_t6_drone_quad_rotor_mp,veh_t6_drone_quad_rotor_mp_alt,veh_t6_drone_rcxd,veh_t6_drone_rcxd_alt,veh_t6_drone_supply,veh_t6_drone_supply_alt,veh_t6_drone_tank,veh_t6_drone_uav,", ",");
    //drop = strTok("supplydrop_mp, ai_tank_drop_mp, dogs_mp");
    //tele = strTok(level.h,level.g,level.y, ",");
   
    if(type == projectile)
    {
        self endon("disconnect");
        self endon("stop_magicBullet");
        level endon("game_ended");
       
        for(;;)
        {
            self waittill("weapon_fired");
            MagicBullet(self.currentProjectile, self getEye(), self traceBulletSwitch(1), self);
        }
    }
    if(isDefined(proj))
    {
        self.currentProjectile = weap;
        self iPrintln("Projectile Set To ^2" + printweap);
    }
}
 

candy

G59 Terrorist
Staff member
Donator
Messages
1,322
Reaction score
752
Points
973
Heya! I'm trying to make this super special awesome bullet function. I'm in a little pickle. Yes i can use if statements up the wazoo and get it working. But i wanna do it in a cleaner fancier way. Huge brain fart here. (or it could be that its 3 AM and i just wanted to make this) Would love a helping hand.

View attachment 1565
Code:
BulletShooter(type, proj, weap, printweap)//, fx, equip, drop, models)
{
    self endon("disconnect");
    level endon("game_ended");
 
    projectile = strTok( "usrpg_mp,smaw_mp,cobra_20mm_mp,straferun_gun_mp,fhj18_mp,missile_drone_projectile_mp,remote_mortar_missile_mp,heli_gunner_rockets_mp,chopper_minigun_mp,inventory_m32_mp,ai_tank_drone_rocket_mp,straferun_rockets_mp,remote_missile_bomblet_mp,missile_swarm_projectile_mp", ",");
    //fx = array_copy(level.effectlist,"effect");
    //equipment = strTok("sticky_grenade_mp,explosive_bolt_mp,tactical_insertion_mp,explodable_barrel_mp,destructible_car_mp,bouncingbetty_mp,trophy_system_mp,flash_grenade_mp,concussion_grenade_mp,willy_pete_mp,sensor_grenade_mp,claymore_mp,proximity_grenade_mp,frag_grenade_mp,hatchet_mp,emp_grenade_mp,satchel_charge_mp", ",");
    //models = strTok("t6_wpn_supply_drop_ally,projectile_sa6_missile_desert_mp,mp_ballista,t5_veh_rcbomb_gib_large,viewmodel_default,t6_wpn_supply_drop_trap,projectile_sidewinder_missile,projectile_cbu97_clusterbomb,german_shepherd,fx_debris_stone_01,veh_t6_drone_overwatch_light,projectile_hellfire_missile,defaultactor,t6_wpn_tablet_view,mp_flag_red,mp_flag_neutral,t6_wpn_supply_drop_axis,defaultvehicle,veh_t6_drone_tank_alt,t6_wpn_supply_drop_detect,t6_wpn_supply_drop_hq,t6_wpn_supply_drop_trap,veh_t6_air_a10f,veh_t6_air_a10f_alt,veh_t6_air_attack_heli_mp_dark,veh_t6_air_attack_heli_mp_light,veh_t6_air_fa38_killstreak,veh_t6_air_fa38_killstreak_alt,veh_t6_air_v78_vtol_killstreak,veh_t6_air_v78_vtol_killstreak_alt,veh_t6_drone_cuav,veh_t6_drone_overwatch_dark,veh_t6_drone_overwatch_light,veh_t6_drone_pegasus_mp,veh_t6_drone_quad_rotor_mp,veh_t6_drone_quad_rotor_mp_alt,veh_t6_drone_rcxd,veh_t6_drone_rcxd_alt,veh_t6_drone_supply,veh_t6_drone_supply_alt,veh_t6_drone_tank,veh_t6_drone_uav,", ",");
    //drop = strTok("supplydrop_mp, ai_tank_drop_mp, dogs_mp");
    //tele = strTok(level.h,level.g,level.y, ",");
 
    if(type == projectile)
    {
        self endon("disconnect");
        self endon("stop_magicBullet");
        level endon("game_ended");
     
        for(;;)
        {
            self waittill("weapon_fired");
            MagicBullet(self.currentProjectile, self getEye(), self traceBulletSwitch(1), self);
        }
    }
    if(isDefined(proj))
    {
        self.currentProjectile = weap;
        self iPrintln("Projectile Set To ^2" + printweap);
    }
}
I'll look at it in a few.
If you could give me more as in how you're calling it, in here or in pms. That would be helpful.
 
Last edited:

DF_AUS

Moderator
Staff member
Head Staff Team
Donator
Messages
577
Reaction score
793
Points
878
Heya! I'm trying to make this super special awesome bullet function. I'm in a little pickle. Yes i can use if statements up the wazoo and get it working. But i wanna do it in a cleaner fancier way. Huge brain fart here. (or it could be that its 3 AM and i just wanted to make this) Would love a helping hand.

View attachment 1565
Code:
BulletShooter(type, proj, weap, printweap)//, fx, equip, drop, models)
{
    self endon("disconnect");
    level endon("game_ended");
  
    projectile = strTok( "usrpg_mp,smaw_mp,cobra_20mm_mp,straferun_gun_mp,fhj18_mp,missile_drone_projectile_mp,remote_mortar_missile_mp,heli_gunner_rockets_mp,chopper_minigun_mp,inventory_m32_mp,ai_tank_drone_rocket_mp,straferun_rockets_mp,remote_missile_bomblet_mp,missile_swarm_projectile_mp", ",");
    //fx = array_copy(level.effectlist,"effect");
    //equipment = strTok("sticky_grenade_mp,explosive_bolt_mp,tactical_insertion_mp,explodable_barrel_mp,destructible_car_mp,bouncingbetty_mp,trophy_system_mp,flash_grenade_mp,concussion_grenade_mp,willy_pete_mp,sensor_grenade_mp,claymore_mp,proximity_grenade_mp,frag_grenade_mp,hatchet_mp,emp_grenade_mp,satchel_charge_mp", ",");
    //models = strTok("t6_wpn_supply_drop_ally,projectile_sa6_missile_desert_mp,mp_ballista,t5_veh_rcbomb_gib_large,viewmodel_default,t6_wpn_supply_drop_trap,projectile_sidewinder_missile,projectile_cbu97_clusterbomb,german_shepherd,fx_debris_stone_01,veh_t6_drone_overwatch_light,projectile_hellfire_missile,defaultactor,t6_wpn_tablet_view,mp_flag_red,mp_flag_neutral,t6_wpn_supply_drop_axis,defaultvehicle,veh_t6_drone_tank_alt,t6_wpn_supply_drop_detect,t6_wpn_supply_drop_hq,t6_wpn_supply_drop_trap,veh_t6_air_a10f,veh_t6_air_a10f_alt,veh_t6_air_attack_heli_mp_dark,veh_t6_air_attack_heli_mp_light,veh_t6_air_fa38_killstreak,veh_t6_air_fa38_killstreak_alt,veh_t6_air_v78_vtol_killstreak,veh_t6_air_v78_vtol_killstreak_alt,veh_t6_drone_cuav,veh_t6_drone_overwatch_dark,veh_t6_drone_overwatch_light,veh_t6_drone_pegasus_mp,veh_t6_drone_quad_rotor_mp,veh_t6_drone_quad_rotor_mp_alt,veh_t6_drone_rcxd,veh_t6_drone_rcxd_alt,veh_t6_drone_supply,veh_t6_drone_supply_alt,veh_t6_drone_tank,veh_t6_drone_uav,", ",");
    //drop = strTok("supplydrop_mp, ai_tank_drop_mp, dogs_mp");
    //tele = strTok(level.h,level.g,level.y, ",");
  
    if(type == projectile)
    {
        self endon("disconnect");
        self endon("stop_magicBullet");
        level endon("game_ended");
      
        for(;;)
        {
            self waittill("weapon_fired");
            MagicBullet(self.currentProjectile, self getEye(), self traceBulletSwitch(1), self);
        }
    }
    if(isDefined(proj))
    {
        self.currentProjectile = weap;
        self iPrintln("Projectile Set To ^2" + printweap);
    }
}
Was your question answered by @Candy so i can move the thread to the answered section?
 

The Dark Side

Former Staff Member
Messages
1,004
Reaction score
770
Points
993
Was your question answered by @Candy so i can move the thread to the answered section?
I never really got it working. But i kind of became disinterested. So if you can help, feel free too! :grinning: Id still like to know a good way to get this working.
 

candy

G59 Terrorist
Staff member
Donator
Messages
1,322
Reaction score
752
Points
973
I never really got it working. But i kind of became disinterested. So if you can help, feel free too! :grinning: Id still like to know a good way to get this working.
Sorry homie. Took a lot of your $hit out messin with it, but here u go.
Idk if its what you wanted, but you can work around it I'm sure.

Code:
bulletType()
{
    projectiles = strTok("usrpg_mp,smaw_mp,cobra_20mm_mp,straferun_gun_mp,fhj18_mp,missile_drone_projectile_mp,remote_mortar_missile_mp,heli_gunner_rockets_mp,chopper_minigun_mp,inventory_m32_mp,ai_tank_drone_rocket_mp,straferun_rockets_mp,remote_missile_bomblet_mp,missile_swarm_projectile_mp", ",");
  
    if(!isDefined(level.num))
        level.num = 0;
  
    level.num += 1;
    self.currProj = projectiles[level.num];
    self iprintln("Weapon Projectile Set To ^2" + projectiles[level.num]);
    while( isDefined(self.currProj) )
    {
        self waittill("weapon_fired");
      
        magicbullet(self.currProj, self getEye(), self getBulletTrace(), self);
    }
}

getBulletTrace()
{
    return bulletTrace(self getEye(), self getEye()+ vectorScale(anglesToForward(self getPlayerAngles()), 1000000), 0, self)["position"];
}

7241699b6f1ed76513933d0708d17714.gif
 
Last edited:

The Dark Side

Former Staff Member
Messages
1,004
Reaction score
770
Points
993
Sorry homie. Took a lot of your $hit out messin with it, but here u go.
Idk if its what you wanted, but you can work around it I'm sure.

Code:
bulletType()
{
    projectiles = strTok("usrpg_mp,smaw_mp,cobra_20mm_mp,straferun_gun_mp,fhj18_mp,missile_drone_projectile_mp,remote_mortar_missile_mp,heli_gunner_rockets_mp,chopper_minigun_mp,inventory_m32_mp,ai_tank_drone_rocket_mp,straferun_rockets_mp,remote_missile_bomblet_mp,missile_swarm_projectile_mp", ",");
 
    if(!isDefined(level.num))
        level.num = 0;
 
    level.num += 1;
    self.currProj = projectiles[level.num];
    self iprintln("Weapon Projectile Set To ^2" + projectiles[level.num]);
    while( isDefined(self.currProj) )
    {
        self waittill("weapon_fired");
     
        magicbullet(self.currProj, self getEye(), self getBulletTrace(), self);
    }
}

getBulletTrace()
{
    return bulletTrace(self getEye(), self getEye()+ vectorScale(anglesToForward(self getPlayerAngles()), 1000000), 0, self)["position"];
}

7241699b6f1ed76513933d0708d17714.gif
Thanks Skittles. This is now answered. Ill move this. :smile:
 
Top