Entities following others
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? ;-) |
Re: Entities following others
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). |
Re: Entities following others
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*
|
Re: Entities following others
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) |
Re: Entities following others
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:
|
Re: Entities following others
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")); |
Re: Entities following others
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 |
Re: Entities following others
Honestly, I forget why it's called aiment.
|
Re: Entities following others
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. |
Re: Entities following others
Quote:
|
| All times are GMT -4. The time now is 16:05. |
Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.