AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   Spawning models (entities) (https://forums.alliedmods.net/showthread.php?t=13034)

v3x 05-01-2005 23:38

Spawning models (entities)
 
Alright, I know almost nothing about this.. So here's my choppy code:

[EDIT] Disregard this part, continue to the next part. >>

Also what I want to know is.. How do I go by assigning a specific ID for each one of them, and removing them later on (all of them, by their ID's)?

BioHazardousWaste 05-02-2005 07:50

um... entities? or just random models? I'm going to assume you mean entities, which I also know very little about. But I think you would do it like this.

Code:
//variables New MaxEntities = 10 New Entity[10] = 0 public SpawnEntities {      for(new i=1;i<=10;i++)      {            Entity[i] = create_entity("info_target")            //stuff to set models, make solid, hp etc etc      } } public KillEntities {      for(new i=1;1<=10;i++)      {          //you might want to add some checks          remove_entity(Entity[i])       } }

Something like that... hope it helps

v3x 05-02-2005 13:36

Alright, thanks. Now, I know how to give it health, but what about checking it's health?

LynX 05-02-2005 13:54

Erm... get_pev of entity?

v3x 05-02-2005 14:00

Hrm..

Code:
new health = pev(ent,pev_health)
:?:

[EDIT]
What would I use to constantly check the health?

XxAvalanchexX 05-02-2005 17:57

What do you mean "constantly" check the health?

Ced 05-02-2005 18:13

I think he wants to assign a health and destroy the ent when its health is <= 0 so wants to know how to check to see if the ent needs to be removed

v3x 05-02-2005 18:28

Well, after I shoot it a bunch of times it eventually disappears. I just want to do something WHEN it disappears. (health >= 0)

XxAvalanchexX 05-02-2005 21:36

After you create it, change its classname to something unique, and then use register_think to grab its think. Every think see if its health is <= 0, and then do something.

v3x 05-02-2005 21:48

Ah yes! So that's what that forward does.. Thanks :).


All times are GMT -4. The time now is 16:40.

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