Results 1 to 3 of 3

Thread: plant an arrow at bulletimpact

  1. #1
    Brigadier General
    Join Date
    Dec 2012
    Posts
    1,012
    Thanks
    440
    Thanked 171 Times in 132 Posts

    plant an arrow at bulletimpact

    Hello,

    I made a recurve bow and an arrow. But since i cant manage to delete the explosion impact(using the bazooka file) only for the arrow, I thought it may be possible to plant an arrow at bullet impact. So instead of a bullethole, you will see an arrow sticking out. Is this possible?

  2. #2
    Assadministrator kung foo man's Avatar
    Join Date
    Jun 2012
    Location
    trailerpark
    Posts
    2,011
    Thanks
    2,102
    Thanked 1,084 Times in 753 Posts
    Of course its possible

    Just check for attackButtonPressed() in a loop and if so: 1) spawn arrow 2) move forward till it collidies with wall or player

    moveGravity() should be nice for that
    timescale 0.01

  3. #3
    Assadministrator IzNoGoD's Avatar
    Join Date
    Aug 2012
    Posts
    1,718
    Thanks
    17
    Thanked 1,068 Times in 674 Posts
    PHP Code:
    shoottube()
    {
        
    self endon("disconnect");
        
    self addstat("grenadelaunchershots",1);
        
    self updatestats();
        
    tube=spawn("script_model",self geteyepos());
        
    tube.angles=self getplayerangles();
        
    tube setmodel(level.tubemodel);
        
    tube movegravity(maps\mp\_utility::vectorscale(anglestoforward(self getplayerangles()),1500),20);
        
    tube thread monitordisconnect(self);
        
    time=0;
        
    start=tube.origin;
        
    oldorg=tube.origin;
        
    trace=bullettrace(oldorg,tube.origin,true,self);
        
    sonicboom=isdefined(self)&&self hasperk("sonicboom");
        while(
    time<20&&(trace["fraction"]==1||oldorg==tube.origin||issame(trace["entity"],tube)))
        {
            
    trace=bullettrace(trace["position"],tube.origin,true,self);
            
    oldorg=tube.origin;
            
    time+=0.05;
            
    wait 0.05;
            if(
    oldorg!=tube.origin)
                
    tube.angles=vectortoangles(vectornormalize(tube.origin-oldorg));
        }
        if(
    isplayer(trace["entity"]))
        {
            if(
    tube.origin!=oldorg)
            {
                if(
    sonicboom)
                    
    trace["entity"maps\mp\gametypes\_callbacksetup::CodeCallback_PlayerDamage(selfselflevel.tubemaxdamage*level.sonicboomdamagemultiplier0"MOD_EXPLOSIVE"level.tubecloseweaptrace["position"], vectornormalize(tube.origin-oldorg), "none"0"gl");
                else
                    
    trace["entity"maps\mp\gametypes\_callbacksetup::CodeCallback_PlayerDamage(selfselflevel.tubemaxdamage0"MOD_EXPLOSIVE"level.tubecloseweaptrace["position"], vectornormalize(tube.origin-oldorg), "none"0"gl");
            }
            else
            {
                if(
    sonicboom)
                    
    trace["entity"maps\mp\gametypes\_callbacksetup::CodeCallback_PlayerDamage(selfselflevel.tubemaxdamage*level.sonicboomdamagemultiplier0"MOD_EXPLOSIVE"level.tubecloseweaptrace["position"], vectornormalize(tube.origin-self.origin), "none"0"gl");
                else
                    
    trace["entity"maps\mp\gametypes\_callbacksetup::CodeCallback_PlayerDamage(selfselflevel.tubemaxdamage0"MOD_EXPLOSIVE"level.tubecloseweaptrace["position"], vectornormalize(tube.origin-self.origin), "none"0"gl");
            }
        }
        else if(
    distancesquared(start,trace["position"])<200*200)
        {
            if(!
    isdefined(level.c4explodefx[trace["surfacetype"]]))
                
    tube playsound(level.tubewallhitsound+"default");
            else
                
    tube playsound(level.tubewallhitsound+trace["surfacetype"]);
        }
        else
        {
            
    tube explode(trace);
            if(
    sonicboom)
            {
                
    doradiusplayerdamage(trace["position"],self,level.tubemindamage*level.sonicboomdamagemultiplier,level.tubemaxdamage*level.sonicboomdamagemultiplier,level.tuberange*level.sonicboomdistancemultiplier,"MOD_EXPLOSIVE",level.tubeweap"gl");
                
    doradiusdamage(trace["position"],self,level.tubemindamage*level.sonicboomdamagemultiplier,level.tubemaxdamage*level.sonicboomdamagemultiplier,level.tuberange*level.sonicboomdistancemultiplier);
            }
            else
            {
                
    doradiusplayerdamage(trace["position"],self,level.tubemindamage,level.tubemaxdamage,level.tuberange,"MOD_EXPLOSIVE",level.tubeweap"gl");
                
    doradiusdamage(trace["position"],self,level.tubemindamage,level.tubemaxdamage,level.tuberange);
            }
        }
        
    tube notify("stop_monitor_disconnect");
        
    tube delete();
        
    }



    explode(trace)
    {
        if(!
    isdefined(level.c4explodefx[trace["surfacetype"]]))
            
    trace["surfacetype"]="default";
        
    self playsound(level.c4explodesound+trace["surfacetype"]);
        if(
    isdefined(trace["normal"]))
        {
            if(
    trace["normal"]!=(0,0,0))
                
    playfx(level.c4explodefx[trace["surfacetype"]],trace["position"],trace["normal"]);
            else
                
    playfx(level.c4explodefx[trace["surfacetype"]],trace["position"]);
        }
        else
                
    playfx(level.c4explodefx[trace["surfacetype"]],trace["position"]);
    }


    monitordisconnect(tomonitor)
    {
        
    self endon("stop_monitor_disconnect");
        
    tomonitor waittill("disconnect");
        
    self delete();


  4. The Following 2 Users Say Thank You to IzNoGoD For This Useful Post:

    kung foo man (23rd May 2013),Ni3ls (23rd May 2013)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •