AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   Help with plasma shoot. (https://forums.alliedmods.net/showthread.php?t=251036)

FromTheFuture 11-04-2014 13:41

Help with plasma shoot.
 
1 Attachment(s)
Hi, I need help with plasma shoot on predator mod.
Shot can not pass through the door.
Watch the video http://www.youtube.com/watch?v=bfibP...ature=youtu.be
Full source in attachment, source part with create entity:
PHP Code:

 public cmdShoot(id)
 {
    if(
g_predator[id] >= 0)
    {
        if(
plasma[id] > 0)
        {
            
plasma[id]--;
            
ColorPrint(id"You got %i plasma left"plasma[id]);

            new 
origin[3], Float:fOrigin[3]//player origin... and float origin
            
new Float:velocity[3// speed of the entity to move

            
get_user_origin(id,origin,1)//get user origin - int
            
IVecFVec(originfOrigin)// convert the int into float

            
new ePlasmaBall create_entity("info_target"// create the plasma ball
            
entity_set_string(ePlasmaBallEV_SZ_classname"PlasmaBall"//set name of the entity "PlasmaBall"

            
new Float:posAdjust[3//Used for adjusting the starting position
            
velocity_by_aim(id50posAdjust)  //was 70//You can replace 50 with whatever , get origin of the AIM
            
fOrigin[0] += posAdjust[0]
            
fOrigin[1] += posAdjust[1]
            
fOrigin[2] += posAdjust[2]
            
entity_set_vector(ePlasmaBallEV_VEC_originfOrigin)//set the shot's direction

            
entity_set_size(ePlasmaBallFloat:{-0.005, -0.005, -0.005}, Float:{0.0050.0050.005})//set size
            
entity_set_int(ePlasmaBall,     EV_INT_solid,         SOLID_BBOX)//make solid
            
entity_set_int(ePlasmaBall,     EV_INT_movetype,     MOVETYPE_FLYMISSILE)//set movetype
            
            
entity_set_float(ePlasmaBall,     EV_FL_framerate,     1.0)//framerate
            
entity_set_int(ePlasmaBall,     EV_INT_rendermode,     5)//randermode
            
entity_set_float(ePlasmaBall,     EV_FL_renderamt,     255.0)//visable
            
entity_set_float(ePlasmaBall,     EV_FL_scale,         1.20)//dunno
            
entity_set_model(ePlasmaBall,     "sprites/plasma.spr")//model
            
emit_sound(ePlasmaBallCHAN_AUTO"predator/plasma_shoot.wav"1.0ATTN_NORM0PITCH_NORM)//sound
            
VelocityByAim(id,1150,velocity)//speed
            
entity_set_vector(ePlasmaBall,EV_VEC_velocity,velocity)//set the shot's speed
            
entity_set_edict(ePlasmaBallEV_ENT_ownerid)

            
// Create a trail...
            /* Broadcast to all players*/
            
message_begin(MSG_BROADCASTSVC_TEMPENTITY)     // TE_BEAMFOLLOW ( msg #22) create a line of decaying beam segments until entity stops moving
            
write_byte(22)                // msg id
            
write_short(ePlasmaBall)      // short (entity:attachment to follow)
            
write_short(gTrailModel)      // short (sprite index)
            
write_byte(25)                // byte (life in 0.1's)
            
write_byte(5)                 // byte (line width in 0.1's)
            
write_byte(42)                // byte (color)
            
write_byte(170)               // byte (color)
            
write_byte(255)               // byte (color)
            
write_byte(255)               // byte (brightness)
            
message_end()
            return 
PLUGIN_HANDLED
        
}
        else
        {
            
set_hudmessage(0,30,200,-1.0,0.75,0,3.0,10.0,0.15,0.5,1)
            
show_hudmessage(id,"You are out of ammo")
            return 
PLUGIN_HANDLED
        
}
    }
    return 
PLUGIN_HANDLED
 



GuskiS 11-04-2014 14:42

Re: Help with plasma shoot.
 
Try setting size -1.0, -1.0, -1.0; 1.0, 1.0, 1.0

FromTheFuture 11-04-2014 15:53

Re: Help with plasma shoot.
 
Quote:

Originally Posted by GuskiS (Post 2220130)
Try setting size -1.0, -1.0, -1.0; 1.0, 1.0, 1.0

The problem was not solved

Fr33m@n 11-04-2014 16:27

Re: Help with plasma shoot.
 
try lower value like 0.5, if it's still not working try 0.4 and so on. You see what i mean ?

FromTheFuture 11-04-2014 16:56

Re: Help with plasma shoot.
 
Quote:

Originally Posted by Fr33m@n (Post 2220177)
try lower value like 0.5, if it's still not working try 0.4 and so on. You see what i mean ?

But -0.005 is lower than 0.5.

FromTheFuture 11-06-2014 10:17

Re: Help with plasma shoot.
 
No idea? I solved part of this -> change model from spr to small mdl. And I wanna ask, entity size is take model size?

RateX 11-06-2014 11:02

Re: Help with plasma shoot.
 
^It's any size according to what you set regardless of model size.

Fr33m@n 11-06-2014 11:33

Re: Help with plasma shoot.
 
don't try to think in a mathematic way, i was talking about absolute value.
keep the - where they are.

And there is nothing related to the models here.
Models don't affect touchability.

FromTheFuture 11-06-2014 13:01

Re: Help with plasma shoot.
 
Anyway any manipulation no has effect with this, only change the model.

Lycode 11-06-2014 18:00

Re: Help with plasma shoot.
 
Set the size after the model. You don't need to use anything smaller than 1.0 for the size. That's small enough as it is.

PHP Code:

entity_set_model(ePlasmaBall"sprites/plasma.spr")//model
entity_set_size(ePlasmaBallFloat:{-1.0, -1.0, -1.0}, Float:{1.01.01.0})//set size 



All times are GMT -4. The time now is 17:32.

Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.