AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   Need to easify an insane Function (https://forums.alliedmods.net/showthread.php?t=45390)

Silencer123 10-01-2006 07:20

Need to easify an insane Function
 
The Title of this Thread was "All about Entities...".
The Problem was solved, but I got a new Problem and did not want
to create a new Thread. See Post #42 for the new Problem.
Between below here and Post #42 is the Stuff from the previous Problem...


Okay, I need to know how:
- Execute a public function when an entity is triggered and get the ent-id.
- Then read the entities classname.
- Then read keys with their values from the entity.
- Then find entities by targetname (NOT classname) and trigger them.

Thanks in advance!

VEN 10-01-2006 08:04

Re: All about Entities...
 
Did you tried http://www.amxmodx.org/funcwiki.php ?
1. FM_Spawn?
2. pev(ent, pev_classname, ...)?
3. key value data or pev (for the last see #2)?
4. engfunc(EngFunc_FindEntityByString, -1, "targetname", "my_targetname")?

Silencer123 10-01-2006 08:36

Re: All about Entities...
 
FM_Spawn is called when entitiy spawns, not when it is triggered. :/
EDIT: btw I was thinking of a Plugin which allows you to have new entities.
For example amx_trigger_countdown where you have a key value for time
and all those for how and where the hudmessage shall appear and what shall
be triggered if time is up but abort the countdown if the entity is triggered again.
With your words I sadly cannot create more than this:
Code:
/* Entity Addon by Silencer. ** Allows you to do more in game. ** You need to copy the following lines to the end of your *.fgd's: --- To do: Add new entities for *.fgd here --- ** STOP COPYING ONE LINE ABOVE HERE +++ STOP COPYING ONE LINE ABOVE HERE +++ STOP COPYING ONE LINE ABOVE HERE **/ #include <amxmodx> #include <fakemeta> #define VERSION "1.0" new all_entities[65][33] new position new bool:fatal_error public plugin_init() {     register_plugin("Entity Addon",VERSION,"Silencer")     register_forward(FM_Spawn,"EA_Check") } public EA_Check(ent) {     new classname[32]     pev(ent,pev_classname,classname)     if(equali(classname,"amx_trigger_countdown"))     {         if(position>=64)         {             server_print("[ENTITY ADDON] Error: Map is using more than 64 'Entity Addon' Entities!")             fatal_error=true         }         else         {             all_entities[position][32]=classname[31]             position+=1         }     } }

VEN 10-01-2006 10:45

Re: All about Entities...
 
Quote:

FM_Spawn is called when entitiy spawns, not when it is triggered. :/

Because you said "an" instead of "and" i missed your point. i though you want to catch the moment when the entity is recieved index, i.e. created. :/

Silencer123 10-01-2006 11:00

Re: All about Entities...
 
My bad!
But how do I call a Function when an entity is triggered and get the ent-id then?
If there is no way I had to totally rebuild the Maps Entity System which I do not want to do.

VEN 10-01-2006 11:37

Re: All about Entities...
 
triggered == used. I can't remember now whether this valid for all triggers or not, but for example: on de_vertigo when you falling you touch invisible trigger that trigger (use) ambient_generic entity that emit sound.
(i'm not mean actual "+use" command but game engine's pfnUse).
But here is the problem: FM_Use is never called. It's not a bug (search for more info in this issue if interested).

EDIT: It may be that i messed the "triggered entity" term. I assumed that it is the trigger entity that is triggered the other entity (not the other entity that is triggered the trigger).

Silencer123 10-01-2006 13:16

Re: All about Entities...
 
Lets say a Map contains a trigger_auto.
5 Seconds after Map Start it triggers an Entity.
That is the moment in which my Plugin shall find out everything about the triggered/targeted Entity.
And if there seriously is no easy Function included in AMXModX which is called when an Entity
is triggered then I will fall off my chair, because Entites are goddamn important.
EDIT: I also need to know how to read spawnflags!

VEN 10-02-2006 03:39

Re: All about Entities...
 
variable = pev(ent, pev_spawnflags) ?

Silencer123 10-02-2006 03:54

Re: All about Entities...
 
Thanks, but my idea seems to be impossible since it is said Entity Triggering
cannot be hooked to a Function. Makes me sad!
:(
I even started making Sprites for 3D View in VHE.

Silencer123 10-02-2006 09:30

Re: All about Entities...
 
I got an idea, but there is no function to find an entid by target. @_@
I tried http://www.amxmodx.org/funcwiki.php?go=func&id=346 but you
cannot define a target to search for in there (should be fixed/finished maybe)


All times are GMT -4. The time now is 04:47.

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