AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   Change hight of entities (https://forums.alliedmods.net/showthread.php?t=76834)

Xandaros 08-31-2008 10:39

Change hight of entities
 
Hey folks,
I want to change the y axis of an entity with 2 commands.

Every time you execute one of the commands, it will move 1 unit up/down.

How do I do that?

Xan

PS: I never scripted something for amxx...

Exolent[jNr] 08-31-2008 13:24

Re: Change hight of entities
 
Do you mean change its size or its origin?

[X]-RayCat 08-31-2008 13:54

Re: Change hight of entities
 
Code:
  //Fakemeta way: new origin[3] pev(ent, pev_origin, origin) engfunc(EngFunc_SetOrigin, ent, origin)   //Engine way: new Float:origin[3] entity_get_vector(ent, EV_VEC_ORIGIN, origin) entity_set_vector(ent, EV_VEC_ORIGIN, origin)   origin[0] = X coordinate origin[1] = Y coordinate origin[2] = Z coordinate

Xandaros 08-31-2008 13:57

Re: Change hight of entities
 
Ah... Very well :)

Okay... And how do I reposition entities? I don't mean yourself... I mean the entity you are currently aiming at. How is that possible?

Xan

@Exolent:
I thought it's impossible to change the size of entities Oo (at least point entities)

Xandaros 08-31-2008 14:16

Re: Change hight of entities
 
Sorry, I don't understand that code^^

Can you please explain:
pev
engfunc
prameters of entity_[get/set]_vector

Thanks in advance,
Xan

[X]-RayCat 08-31-2008 14:18

Re: Change hight of entities
 
Take a look at Engine module

Take a look at Fakemeta module

;)

Xandaros 08-31-2008 14:26

Re: Change hight of entities
 
I don't understand this page you sent me... Sorry^^
I don't understand the most documentations...

however

As far as i can see, this only set's the position of the entity "ent"...

How do I get the entity, the command executing player(or spectator), is looking at?

This way I can store it in "ent"...

I think I've understood the Engine way...

Long text... my question for short:
How to store the entity, you are looking at, in a variable?

Xan

[X]-RayCat 08-31-2008 14:39

Re: Change hight of entities
 
Quote:

Originally Posted by Xandaros (Post 679174)
I don't understand this page you sent me... Sorry^^
I don't understand the most documentations...

however

As far as i can see, this only set's the position of the entity "ent"...

How do I get the entity, the command executing player(or spectator), is looking at?

This way I can store it in "ent"...

I think I've understood the Engine way...

Long text... my question for short:
How to store the entity, you are looking at, in a variable?

Xan

I dont know how you can't understand the fakemeta way.

Code:
//look at the pev_* constants in the link i gave you set_pev(index, pev_*, ...) //set pev(index, pev_*, ...) //get   Engine EV_* works the same way.. :)

I suggest you to scroll all the functions on the both links. :)

Xandaros 08-31-2008 14:42

Re: Change hight of entities
 
Ah... however^^
How do I store an entity in a variable?

Xan

Xandaros 08-31-2008 15:00

Re: Change hight of entities
 
That's what I've done now:

Code:

#include <amxmodx>
register_clcmd("e_up", "MoveEntUp",0, "")
register_clcmd("e_down", "MoveEntDown",0, "")

public MoveEntUp() {
    new ent;
    new Float:origin[3]
    entity_get_vector(ent, EV_VEC_ORIGIN, origin)
    origin[2] = origin[2] + 1
    entity_set_vector(ent, EV_VEC_ORIGIN, origin)
}

I think the only thing I haven't got is, setting the "ent" value...

How do I do that?
Have I forgot anything else?

Please help,
Xan


All times are GMT -4. The time now is 03:07.

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