Senior Member
|
11-13-2006
, 16:25
[?]Origin/Vector/Velocity - Help!?!
|
#1
|
I thought this would be rather easy, but I'm having some trouble. I've muffed with the code for about an hour and I know am I having trouble with the syntax I believe.
All I want to do, is make a projectile shoot with an added value to its axis'.
Instead of you pointing forward and shooting forward, I want to point forward and have the object shoot up.
Here is my code brick I am trying to edit
Code:
//make_rocket(userindex,commandtype,missilespeed,antimissleid)
make_rocket(id,icmd,iarg1,antimissile)
{
new args[16]
new Float:vOrigin[3]
new Float:vAngles[3]
Entvars_Get_Vector(id, EV_VEC_origin, vOrigin)
Entvars_Get_Vector(id, EV_VEC_v_angle, vAngles)
new notFloat_vOrigin[3]
notFloat_vOrigin[0] = floatround(vOrigin[0])
notFloat_vOrigin[1] = floatround(vOrigin[1])
notFloat_vOrigin[2] = floatround(vOrigin[2])
gBazookaSelected[id]=gHasBazookaPowers[id]
new accessLevel[10]
get_cvar_string("bazooka_adminflag", accessLevel, 9)
if(icmd == 5){
new aimvec[3]
get_user_origin(id,aimvec,3)
new dist = get_distance(notFloat_vOrigin,aimvec)
new found
new dist1 = 20000
new players[32], inum
get_players(players,inum,"a")
for(new i = 0 ;i < inum ;++i){
if(players[i] == id) continue
new soutput[8],output
get_user_info(players[i],"JP",soutput,7)
output = str_to_num(soutput)
if(output == 1){
new temp[3]
get_user_origin(players[i],temp)
dist1 = get_distance(temp,aimvec)
if(dist1 < dist){
dist = dist1
found = 1
args[6] = players[i]
}
}
}
if(!found){
client_print(id,print_chat,"[SH](Bazooka) Cannot fire Heat-Seeking Missile, no running JetPacks in view.")
if(get_cvar_num("bazooka_buy") == 1){
new umoney = get_user_money(id)
new m_cost = get_cvar_num("bazooka_cost5")
if ((get_user_flags(id)&read_flags(accessLevel)) ) {
set_user_money(id,umoney+(m_cost/100),1)
}
else {
set_user_money(id,umoney+m_cost,1)
}
}
else {
missile_inv[id][5] += 1
show_missile_inv(id)
}
if(using_menu[id])
show_main_menu(id)
return PLUGIN_HANDLED
}
}
else if(icmd == 6){
new aimvec[3]
get_user_origin(id,aimvec,3)
new dist = get_distance(notFloat_vOrigin,aimvec)
new found
new dist1 = 20000
new players[32], inum
get_players(players,inum,"a")
for(new i = 0 ;i < inum ;++i){
if(players[i] == id) continue
new soutput[8],output
get_user_info(players[i],"ROPE",soutput,7)
output = str_to_num(soutput)
if(output == 1){
new temp[3]
get_user_origin(players[i],temp)
dist1 = get_distance(temp,aimvec)
if(dist1 < dist){
dist = dist1
found = 1
args[6] = players[i]
}
}
}
if(!found){
client_print(id,print_chat,"[SH](Bazooka) Cannot fire Rope-Seeking Missile, no Ropes in view.")
if(get_cvar_num("bazooka_buy") == 1){
new umoney = get_user_money(id)
new m_cost = get_cvar_num("bazooka_cost6")
if ((get_user_flags(id)&read_flags(accessLevel)) ) {
set_user_money(id,umoney+(m_cost/100),1)
}
else {
set_user_money(id,umoney+m_cost,1)
}
}
else {
missile_inv[id][6] += 1
show_missile_inv(id)
}
if(using_menu[id])
show_main_menu(id)
return PLUGIN_HANDLED
}
}
using_menu[id] = 0
new NewEnt
NewEnt = CreateEntity("info_target")
if(NewEnt == 0) {
client_print(id,print_chat,"[SH](Bazooka) Rocket Failure")
return PLUGIN_HANDLED
}
has_rocket[id] = NewEnt
missile_inv[id][0] = 0
Entvars_Set_String(NewEnt, EV_SZ_classname, "bazooka_missile_ent")
ENT_SetModel(NewEnt, "models/rpgrocket.mdl")
new Float:fl_vecminsx[3] = {-1.0, -1.0, -1.0}
new Float:fl_vecmaxsx[3] = {1.0, 1.0, 1.0}
Entvars_Set_Vector(NewEnt, EV_VEC_mins,fl_vecminsx)
Entvars_Set_Vector(NewEnt, EV_VEC_maxs,fl_vecmaxsx)
ENT_SetOrigin(NewEnt, vOrigin)
Entvars_Set_Vector(NewEnt, EV_VEC_angles, vAngles)
Entvars_Set_Int(NewEnt, EV_INT_effects, 64)
Entvars_Set_Int(NewEnt, EV_INT_solid, 2)
if(get_cvar_num("bazooka_obeygravity")) {
Entvars_Set_Int(NewEnt, EV_INT_movetype, 6)
}
else {
Entvars_Set_Int(NewEnt, EV_INT_movetype, 5)
}
Entvars_Set_Edict(NewEnt, EV_ENT_owner, id)
Entvars_Set_Float(NewEnt, EV_FL_health, 10000.0)
Entvars_Set_Float(NewEnt, EV_FL_takedamage, 100.0)
Entvars_Set_Float(NewEnt, EV_FL_dmg_take, 100.0)
new Float:fl_iNewVelocity[3]
new iNewVelocity[3]
VelocityByAim(id, iarg1, fl_iNewVelocity)
Entvars_Set_Vector(NewEnt, EV_VEC_velocity, fl_iNewVelocity)
iNewVelocity[0] = floatround(fl_iNewVelocity[0])
iNewVelocity[1] = floatround(fl_iNewVelocity[1])
iNewVelocity[2] = floatround(fl_iNewVelocity[2])
emit_sound(NewEnt, CHAN_WEAPON, "weapons/rocketfire1.wav", VOL_NORM, ATTN_NORM, 0, PITCH_NORM)
emit_sound(NewEnt, CHAN_VOICE, "weapons/rocket1.wav", VOL_NORM, ATTN_NORM, 0, PITCH_NORM)
args[0] = id
args[1] = NewEnt
args[2] = iarg1
args[3] = iNewVelocity[0]
args[4] = iNewVelocity[1]
args[5] = iNewVelocity[2]
args[8] = notFloat_vOrigin[0]
args[9] = notFloat_vOrigin[1]
args[10] = notFloat_vOrigin[2]
switch(icmd){
case 1: {
make_trail(NewEnt,icmd)
Entvars_Set_Float(NewEnt, EV_FL_gravity, 0.25)
set_task(0.1,"guide_rocket_comm",NewEnt,args,16,"b")
set_task(get_cvar_float("bazooka_fuel"),"rocket_fuel_timer",NewEnt,args,16)
}
case 2: {
make_trail(NewEnt,icmd)
Entvars_Set_Float(NewEnt, EV_FL_gravity, 0.25)
set_task(0.1,"guide_rocket_las",NewEnt,args,16)
set_task(get_cvar_float("bazooka_fuel"),"rocket_fuel_timer",NewEnt,args,16)
}
case 3: {
make_trail(NewEnt,icmd)
Entvars_Set_Float(NewEnt, EV_FL_gravity, 0.25)
Entvars_Set_Int(NewEnt, EV_INT_rendermode,1)
AttachView(id, NewEnt)
args[11] = 1
set_task(0.1,"guide_rocket_dir",NewEnt,args,16,"b")
set_task(get_cvar_float("bazooka_fuel"),"rocket_fuel_timer",NewEnt,args,16)
}
case 4: {
make_trail(NewEnt,icmd)
args[6] = antimissile
Entvars_Set_Float(NewEnt, EV_FL_gravity, 0.25)
set_task(0.1,"guide_rocket_anti",NewEnt,args,16)
set_task(get_cvar_float("bazooka_fuel"),"rocket_fuel_timer",NewEnt,args,16)
}
case 5: {
is_heat_rocket[id] = 1
make_trail(NewEnt,icmd)
Entvars_Set_Float(NewEnt, EV_FL_gravity, 0.25)
set_task(0.1,"guide_rocket_het",NewEnt,args,16)
set_task(get_cvar_float("bazooka_fuel"),"rocket_fuel_timer",NewEnt,args,16)
}
case 6: {
make_trail(NewEnt,icmd)
Entvars_Set_Float(NewEnt, EV_FL_gravity, 0.25)
set_task(0.1,"guide_rocket_rope",NewEnt,args,16)
set_task(get_cvar_float("bazooka_fuel"),"rocket_fuel_timer",NewEnt,args,16)
}
case 7: {
Entvars_Set_Float(NewEnt, EV_FL_gravity, 0.000001)
SD_CircleRockets(NewEnt)
set_task(0.1,"guide_rocket_swirl",NewEnt,args,16)
set_task(get_cvar_float("bazooka_sdfuel"),"rocket_fuel_timer",NewEnt,args,16)
}
}
return PLUGIN_HANDLED
}
Yeah this is a complex chunk of code I'm aware, its part of the 7 variety bazooka plugin. I simply want my baz shot 1 to shoot staight up, instead of straight out.
This is where I got confused..from what I gather from reading the function wiki I should change the values of my x or y or z before passing them back to these statements.
Code:
ENT_SetOrigin(NewEnt, vOrigin)
Entvars_Set_Vector(NewEnt, EV_VEC_angles, vAngles)
I tried using someone like vAngles[0] = vAngles[0] + 90
and yeah, got no result - no change of any kind =(.
Help my noob self out, please? - Thanks in advance,
-helium
|
|