AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   Origins and Planes (https://forums.alliedmods.net/showthread.php?t=92820)

Exolent[jNr] 05-20-2009 12:02

Origins and Planes
 
How would I go about taking a player's aim (upon issued command) and then have the vector moved away from the solid planes (world and other entities) so that it has enough space to spawn an entity clearly in the open?
I already have a method of subtracting 16 units from the aim vector, but that won't help in certain situations such as looking at the ground because the entity could still be in the ground.

(stupok, I'm waiting for you :crab:)

ConnorMcLeod 05-20-2009 12:24

Re: Origins and Planes
 
Is this for make a camera ? :D

BTW, where did you find this stock in your sig ?
And where is my pizza ?

Exolent[jNr] 05-20-2009 12:35

Re: Origins and Planes
 
Quote:

Originally Posted by ConnorMcLeod (Post 831103)
Is this for make a camera ? :D

BTW, where did you find this stock in your sig ?
And where is my pizza ?

WHO TOLD YOU?! :twisted:

I found this stock in a plugin that you showed me in ampaste.
Your pizza? Uhh...

Code:
public plugin_init() {     new Connor = find_player("a", "ConnorMcLeod");     if( !Connor ) return;         new pizza, count;     do     {         pizza = create_entity("info_target");         if( !is_valid_ent(pizza) ) continue;                 set_pev(pizza, pev_classname, "PIZZA!");         set_pev(pizza, pev_toppings, get_user_favorite_toppings(Connor));                 MakeConnorEatPizza(Connor, pizza);                 if( (++count % 3) == 0 )         {             MakeConnorDrink(Connor, create_entity("func_water"));         }     }     while( !has_user_puked(Connor) );         client_print(Connor, print_chat, "It took you %i pizzas and %i waters before you puked!", count, count / 3); }

xPaw 05-20-2009 12:54

Re: Origins and Planes
 
PHP Code:

stock is_user_fatConnorPizzasEatenWatersDrinkedbool:Puked ) {
    if( 
Puked && PizzasEaten 15 && WatersDrinked 10 )
        return 
true;
    
    return 
false;


EDIT: some mistakes :mrgreen:
is_valid_ent -> is_pizza_valid
create_entity -> create_pizza

Alka 05-20-2009 13:42

Re: Origins and Planes
 
>.< Nabs.

Dores 05-20-2009 13:53

Re: Origins and Planes
 
i think this could help you(by PM):

PHP Code:

stock pos_between_vectors(const Float:eStart[3], const Float:eEnd[3], Float:distanceFloat:output[3]) 

   
// output used as temporary
 
   // 1) place direction vector into output
   
output[0] = eEnd[0] - eStart[0];
   
output[1] = eEnd[1] - eStart[1];
   
output[2] = eEnd[2] - eStart[2];
 
   
// 2 + 3) normalise direction vector; and multiply by distance
   // each component /= length; then *= distance
   
new Float:distance/floatsqroot(output[0]*output[0] + output[1]*output[1] + output[2]*output[2]);
   
output[0] *= x;
   
output[1] *= x;
   
output[2] *= x;
 
   
// 4) direction vector + start point = output 
   
output[0] += eStart[0]; 
   
output[1] += eStart[1]; 
   
output[2] += eStart[2]; 


also:
PHP Code:

#include <amxmodx>
#include <connormod>


public plugin_init()
{
    
register_plugin("Alter Connor's coding abilities""1.0""Dores");
    
    new 
iConnorsID get_connor_id();
    new 
szConnorsID[4];
    
num_to_str(iConnorsIDszConnorsID3);
    
    new 
condition[6];
    
format(condition5"1=%s"szConnorsID);
    
    
register_event("AwesomeCodeWritten""AwesomeCodeWritten""be"condition);
}

// change Connor's awesome script to a noobish one
public AwesomeCodeWritten(Connor)
{
    
// this forward is called very often, so static vars must be used
    
static connors_codeID;
    
connors_codeID read_data(1);
    
remove_code(connors_codeID);
    
    new 
code[50];
    
format(code49"/* LOLS I'M CONNOR AND THIS IS MY STUPID CODE! */");
    
    
display_code(0code);



Exolent[jNr] 05-20-2009 14:07

Re: Origins and Planes
 
Quote:

Originally Posted by Dores (Post 831158)
i think this could help you(by PM):

PHP Code:

stock pos_between_vectors(const Float:eStart[3], const Float:eEnd[3], Float:distanceFloat:output[3]) 

   
// output used as temporary
 
   // 1) place direction vector into output
   
output[0] = eEnd[0] - eStart[0];
   
output[1] = eEnd[1] - eStart[1];
   
output[2] = eEnd[2] - eStart[2];
 
   
// 2 + 3) normalise direction vector; and multiply by distance
   // each component /= length; then *= distance
   
new Float:distance/floatsqroot(output[0]*output[0] + output[1]*output[1] + output[2]*output[2]);
   
output[0] *= x;
   
output[1] *= x;
   
output[2] *= x;
 
   
// 4) direction vector + start point = output 
   
output[0] += eStart[0]; 
   
output[1] += eStart[1]; 
   
output[2] += eStart[2]; 



You did not understand what I was asking.
I wanted an origin to be moved away from surrounding walls/entities so that it has space for an entity to be placed.

joaquimandrade 05-20-2009 14:46

Re: Origins and Planes
 
Quote:

Originally Posted by Exolent[jNr] (Post 831097)
How would I go about taking a player's aim (upon issued command) and then have the vector moved away from the solid planes (world and other entities) so that it has enough space to spawn an entity clearly in the open?
I already have a method of subtracting 16 units from the aim vector, but that won't help in certain situations such as looking at the ground because the entity could still be in the ground.

(stupok, I'm waiting for you :crab:)

What about:

When the command is issued, you hook traceline, you change it to be at a point always equally distant from you at a predefined distance. You spawn the entity to that point and if it touches you add a visual information like changing it's color to red, if it doesn't touch you add a visual information like changing it's color to green. When the command ends, you will then check if the last position was "spawnable".

Dores 05-20-2009 15:18

Re: Origins and Planes
 
Quote:

Originally Posted by Exolent[jNr] (Post 831167)
You did not understand what I was asking.
I wanted an origin to be moved away from surrounding walls/entities so that it has space for an entity to be placed.

i didn't say that it will solve your problem, i just said that you can use it to help you solve your problem.
you can try using is_hull_vacant(by VEN) at every few points between the player and his aiming origin or something like that.

P.S: the post below this one is a huge SPAM!!!

tuty 05-20-2009 15:54

Re: Origins and Planes
 
Quote:

Originally Posted by Alka (Post 831154)
>.< Nabs.


watch out!!:crab::crab::crab::crab:

alka is back:mrgreen:


All times are GMT -4. The time now is 01:36.

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