Raised This Month: $ Target: $400
 0% 

Finding and manupulating objects XYZ?


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
frozenarmageddon
Junior Member
Join Date: Dec 2008
Location: Israel, Haifa, Hatizonut
Old 12-24-2008 , 09:41   Finding and manupulating objects XYZ?
Reply With Quote #1

Erm, how do I do that? I wanted to make like a build mode, so I kinda need that for precise building, and I hope you forgive me for not checking all the 501 pages for a semiliar post ^_^
__________________
My website actualy contains more than you see.
frozenarmageddon is offline
CodeMaster
Junior Member
Join Date: Dec 2008
Old 12-24-2008 , 13:03   Re: Finding and manupulating objects XYZ?
Reply With Quote #2

You might want to check funcwiki.
As far as I know you can move only entities, so you could check something about entities.

So the gag is all about origins.Origin is representation of X,Y and Z as an array.
Code:
new Float:origin[3] - Vector of position
origin[0] - X
origin[1] - Y
origin[2] - Z
How do you get origins?
I'd suggest using Fakemeta module.
It's one of the most flexible tools of amxmodx.
Origin's are stored in entity edict data, and with Fakemeta you get it using pev() function, and then set it with set_pev().
Code:
#include <amxmodx>
#include <amxmisc>
#include <fakemeta>

// Later part of code
new Float:origin[3]
pev(entity_id, pev_origin,origin)
origin[2] += 2.0
set_pev(entity_id,pev_origin,origin)
That should increase Z coordinate by two units, so object would be positioned higher.

If you need anything, just post I'll try to help. Right now I don't have time to finish this, but I'll do later

Cheers ;)

Nidza
__________________
+karma me if you found me useful
[60% -- ||||||||||] Learning AMXModX functions for better adaption to AMXModX Pawn
[100% - ||||||||||] Pawn Readaptation

CodeMaster is offline
ConnorMcLeod
Veteran Member
Join Date: Jul 2006
Location: France (95)
Old 12-24-2008 , 13:22   Re: Finding and manupulating objects XYZ?
Reply With Quote #3

To set an entity origin, use EngFunc_SetOrigin.

See from fakemeta_util.inc :

Code:
stock fm_entity_set_origin(index, const Float:origin[3]) {     new Float:mins[3], Float:maxs[3];     pev(index, pev_mins, mins);     pev(index, pev_maxs, maxs);     engfunc(EngFunc_SetSize, index, mins, maxs);     return engfunc(EngFunc_SetOrigin, index, origin); }

Also, don't use this stock if you are already setting entity size.
__________________
- tired and retired -

- my plugins -
ConnorMcLeod is offline
CodeMaster
Junior Member
Join Date: Dec 2008
Old 12-24-2008 , 15:53   Re: Finding and manupulating objects XYZ?
Reply With Quote #4

Ok, I just gave the practical idea how to do it.
I'm not actually sure would it work, so Connor, is my idea right?

Nidza
__________________
+karma me if you found me useful
[60% -- ||||||||||] Learning AMXModX functions for better adaption to AMXModX Pawn
[100% - ||||||||||] Pawn Readaptation

CodeMaster is offline
frozenarmageddon
Junior Member
Join Date: Dec 2008
Location: Israel, Haifa, Hatizonut
Old 12-24-2008 , 16:41   Re: Finding and manupulating objects XYZ?
Reply With Quote #5

ConnorMcLeod, could really help if you explain XD

Thanks CodeMaster, You help ALOT, because the Oregin manupulating is basicly the main part of my addon, I wont forget to Credit you with it

Btw, where to get the FakeMeta module? lol

I got a bad feeling that it comes with the plugin [can't check it right now, because I use amxx only for Sven coop, and I just deleted it to update from 3.0 to 4.0b, and gotta reinstall amxx now ^_^]

If im allready at it... I wanted to know how to add karma to someone, because I will +karma you (CodeMaster) as soon as I find out if it works XD
__________________
My website actualy contains more than you see.

Last edited by frozenarmageddon; 12-24-2008 at 16:54. Reason: If im allready at it...
frozenarmageddon is offline
danielkza
AMX Mod X Plugin Approver
Join Date: May 2007
Location: São Paulo - Brasil
Old 12-24-2008 , 17:33   Re: Finding and manupulating objects XYZ?
Reply With Quote #6

Quote:
Originally Posted by frozenarmageddon View Post
ConnorMcLeod, could really help if you explain XD

Thanks CodeMaster, You help ALOT, because the Oregin manupulating is basicly the main part of my addon, I wont forget to Credit you with it

Btw, where to get the FakeMeta module? lol

I got a bad feeling that it comes with the plugin [can't check it right now, because I use amxx only for Sven coop, and I just deleted it to update from 3.0 to 4.0b, and gotta reinstall amxx now ^_^]

If im allready at it... I wanted to know how to add karma to someone, because I will +karma you (CodeMaster) as soon as I find out if it works XD
Fakemeta comes with the default AMXX installation. And to +/-karma a post, click the [+-] sign right below the user's avatar.
__________________

Community / No support through PM
danielkza is offline
frozenarmageddon
Junior Member
Join Date: Dec 2008
Location: Israel, Haifa, Hatizonut
Old 12-24-2008 , 20:28   Re: Finding and manupulating objects XYZ?
Reply With Quote #7

thx :D
____________
Quote:
Originally Posted by CodeMaster View Post
[code]#include <amxmodx>
#include <amxmisc>
#include <fakemeta>

// Later part of code
new Float:origin[3]
pev(entity_id, pev_origin,origin)
origin[2] += 2.0
set_pev(entity_id,pev_origin,origin)
[/code]
ok, im both a newbie and trying to understand, so lets break it down, shall we?

[includes]

new Float:origin[3]
Declares that origin is a "Group" of 3 "members" that all are Floats?

pev(entity_id, pev_origin,origin)
Sets origin as enitity_id's pev_origin [that is, its origin]?

[addition]

set_pev(entity_id,pev_origin,origin)
Updates the entity_id's pev_origin with the values of origin?

as for example, and quick step by step explanation [of what I understand] will be:

Code:
//includes
#include <amxmodx>
#include <amxmisc>
#include <fakemeta>
 
// Later part of code
new Float:position[3]  //declaration
pev(1253, pev_origin,position) //"fills" position with 1253's origin
position[2] += 10.0 //adds 10 to position's third "member" [shouldnt I add f after a float number? i.e. 10.0f]
set_pev(1253,pev_origin,position) //updates ent. 1253's pev_origin with "position"
Edit: Yea, im bored, thats why I colored.
Edit2: I found out something random... my naighbor snorts so loud I can hear him ._.
__________________
My website actualy contains more than you see.

Last edited by frozenarmageddon; 12-24-2008 at 21:03. Reason: So it wont be called spam :D
frozenarmageddon is offline
frozenarmageddon
Junior Member
Join Date: Dec 2008
Location: Israel, Haifa, Hatizonut
Old 12-24-2008 , 21:14   Re: Finding and manupulating objects XYZ?
Reply With Quote #8

Ok, started anuther message because the one before really was abit too huge ._.

If im allready into all this stuff, [still on topic] is there any way to retourn the ID of an entity im looking at?
__________________
My website actualy contains more than you see.
frozenarmageddon is offline
CodeMaster
Junior Member
Join Date: Dec 2008
Old 12-25-2008 , 06:51   Re: Finding and manupulating objects XYZ?
Reply With Quote #9

pev(entity_id, pev_origin,origin)
Gets enitity_id's pev_origin.

And yes, there is way to get entity you're looking at.
I assume you mean the one you're aiming at.

PHP Code:
new aimed_entity
new body_part
get_user_aiming
(player_id,aimed_entity,body_part
aimed_entity is what you need. It points to player or entity you're aiming at, and if you're not aiming to anything, it'll return 0.0

If you're looking for a coordinate, you can use a function from fakemeta_util.inc

PHP Code:
new Float:aim_origin[3]
fm_get_aim_origin(id,end_origin 
That'd get player's aim origin coordinate, so if it'd hit a wall it'd return the origin of the point where it hit the wall.
__________________
+karma me if you found me useful
[60% -- ||||||||||] Learning AMXModX functions for better adaption to AMXModX Pawn
[100% - ||||||||||] Pawn Readaptation

CodeMaster is offline
frozenarmageddon
Junior Member
Join Date: Dec 2008
Location: Israel, Haifa, Hatizonut
Old 12-25-2008 , 08:53   Re: Finding and manupulating objects XYZ?
Reply With Quote #10

Quote:
Originally Posted by CodeMaster View Post
pev(entity_id, pev_origin,origin)
Gets entity_id's pev_origin.
Yea, but it stores what it Gets to "origin" right?

also, I didn't understand how to use:
Code:
 
new aimed_entity
new body_part
get_user_aiming(player_id,aimed_entity,body_part)
it just gets the values from get_user_aiming and puts them into vars? [not so sure about the name, didn't code at any language for a while :\]
like player's ID into player_id but will write in 0.0 if its null?
same with aimed_entity will return ent_id but 0.0 if its not an entity?
if thats correct, so I didn't know that gold-source had different ids for different body-parts or something, any way I can find info about it?

oh, and it seems like I'm gonna ask you about how to code the whole plug-in step by step, so don't worry... I am trying to learn the most from any piece of information I get

Otherwise, you are a REALLY helpful guy
I guess there's no chance we can somehow talk over an IM software, right?
[me no want to spam forums with questions =^.^=][But I will if its OK XD]
__________________
My website actualy contains more than you see.

Last edited by frozenarmageddon; 12-25-2008 at 09:00. Reason: just installed ieSpell :D
frozenarmageddon is offline
Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -4. The time now is 09:15.


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