Raised This Month: $ Target: $400
 0% 

Entities following others


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
purple_pixie
Veteran Member
Join Date: Jun 2007
Location: Winchester, England
Old 08-28-2007 , 09:21   Entities following others
Reply With Quote #1

Hi people,

I'm incorporating targetted powers atm, and the WC3-style instant-hit-ultimates just aren't cool enough, tbh.

I'm thinking of creating an entity, and having it move towards the player, before colliding and dealing damage.

I'm not asking for anyone to tell me how to do this, just to tell me anything I should know before trying this (like, it's very, very hard [ and why ] or w/e)

Also, if anyone could point me in the right direction of quite how to do this it'd be handy.
(Just a point, I would like to try this for myself)

I've little experience with entities, but how hard can they be? ;-)
purple_pixie is offline
potatis_invalido
BANNED
Join Date: Jul 2007
Location: 0 (world)
Old 08-28-2007 , 09:29   Re: Entities following others
Reply With Quote #2

I do not know how expirienced you are, and therefor can't say how hard it is. Personally I think it's very easy, but a year ago I tought it was very hard.
I recomend that you use register_touch to detect when the entity touches another entity/player/world (world is the floor, walls, sky etc., not doors, glass or buttons, those are entities).
potatis_invalido is offline
Alka
AMX Mod X Plugin Approver
Join Date: Dec 2006
Location: malloc(null)
Old 08-28-2007 , 09:34   Re: Entities following others
Reply With Quote #3

Hum...is not so hard! You must find check if someone or something is in the radius , and set the the ent following other ent and make a fake damage! *Pwd By Fakemeta*
__________________
Still...lovin' . Connor noob! Hello
Alka is offline
purple_pixie
Veteran Member
Join Date: Jun 2007
Location: Winchester, England
Old 08-28-2007 , 09:44   Re: Entities following others
Reply With Quote #4

Thanks, lads.

I can make the created entity damage (hamsandwich - tested, and in use for many other things)
and detecting touch is easy enough (register_touch )

I'm just not entirely sure how to:
a) spawn an entity (of a made-up class, hopefully)
<> create_entity("valid_class_name") (duh ...)
b) create said class
<>entity_set_string(ent,EV_SZ_classname,"new_ class_name")

c) make it follow [ this I can work out, most likely ]
<something to do with setting its movetype, and assigning it an owner? >

d) give it a model.
<> entity_set_model(ent,"model_name")

I'll have a play with the following part later.
(I do my development while at work, so I can't test it ... so infuriating)

Last edited by purple_pixie; 08-28-2007 at 09:56. Reason: Found some of this out
purple_pixie is offline
Zenith77
Veteran Member
Join Date: Aug 2005
Old 08-28-2007 , 09:51   Re: Entities following others
Reply With Quote #5

To make it follow, simply set the pev_aiment field to a player you want it to follow (or another entity) then set move type to MOVETYPE_FOLLOW.

All the information on how to do this is availabe in turtorials and other plugins. The only thing I see you having trouble with is following, so here's come quick code:

Code:
// 'ent' is your entity, 'id' is the index of the player. set_pev(ent, pev_aiment, id); set_pev(ent, pev_movetype, MOVETYPE_FOLLOW);
__________________
Quote:
Originally Posted by phorelyph View Post
your retatred

Last edited by Zenith77; 08-28-2007 at 09:53.
Zenith77 is offline
Alka
AMX Mod X Plugin Approver
Join Date: Dec 2006
Location: malloc(null)
Old 08-28-2007 , 09:54   Re: Entities following others
Reply With Quote #6

Hum...you can make this only with fakemeta! "register_touch" ?! O_o that sounds a engine ?! *Blah*...Here are some e.g

Code:
a)  new Ent = engfunc(EngFunc_CreateNamedEntity,engfunc(EngFunc_AllocString,"classname_of_entity"));
b) a...
c) hum...
set_pev(Ent, pev_movetype, MOVETYPE_FOLLOW");
set_pev(Ent, pev_aiment, index_of_target_to_follow);
d)engfunc(EngFunc_SetModel, Ent*, const model*)
;)
__________________
Still...lovin' . Connor noob! Hello
Alka is offline
purple_pixie
Veteran Member
Join Date: Jun 2007
Location: Winchester, England
Old 08-28-2007 , 10:18   Re: Entities following others
Reply With Quote #7

Thanks, Zenith - I was getting aiment (entity you are aiming at?) confused with owner.

I rather assumed something on movetype_follow would move towards its owner.

Right atm I use either FM or Engine, whichever function has a less stupid name (so usually Engine :-P) but before getting my plugin approved I'll probably switch it all to FM.

Maybe. If people stop whining about Engine.

EDIT: After testing (purely console - takes a lot of log_amx's ;-) ) it seems that movetype_follow doesn't make it "move" at all. It teleports.
I'm really looking for actual following, rather than attaching, so I'll use tasks + maths to point towards it, I think.

Thanks again, everyone. Alka can have thanks too if he stops using ! marks everywhere :-D

Last edited by purple_pixie; 08-28-2007 at 12:06.
purple_pixie is offline
Zenith77
Veteran Member
Join Date: Aug 2005
Old 08-28-2007 , 22:49   Re: Entities following others
Reply With Quote #8

Honestly, I forget why it's called aiment.
__________________
Quote:
Originally Posted by phorelyph View Post
your retatred
Zenith77 is offline
purple_pixie
Veteran Member
Join Date: Jun 2007
Location: Winchester, England
Old 08-29-2007 , 04:13   Re: Entities following others
Reply With Quote #9

Well cheers, anyways.

I've got it all working (missile spawns and tracks the player, causing damage on hit)

Though it took me a good half hour to discover than when I had aiment set I couldn't see the entity ... this could be because it was set to me so it would be right on top of me, I suppose.

Anywhoo, I'm going to play around and see if I can't make it track people without using 0.1 repeating tasks to change direction.

Thanks again, everybody.
purple_pixie is offline
Zenith77
Veteran Member
Join Date: Aug 2005
Old 08-29-2007 , 09:58   Re: Entities following others
Reply With Quote #10

Quote:
Originally Posted by purple_pixie View Post
Well cheers, anyways.

I've got it all working (missile spawns and tracks the player, causing damage on hit)

Though it took me a good half hour to discover than when I had aiment set I couldn't see the entity ... this could be because it was set to me so it would be right on top of me, I suppose.

Anywhoo, I'm going to play around and see if I can't make it track people without using 0.1 repeating tasks to change direction.

Thanks again, everybody.
Yes. Use HL's think system. If you don't know what I'm talking about, just respond and I'll show you.
__________________
Quote:
Originally Posted by phorelyph View Post
your retatred
Zenith77 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 16:05.


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