AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   Creating Entity Help(Searched none work.) (https://forums.alliedmods.net/showthread.php?t=14073)

Ninja_Munkey 06-08-2005 10:18

Creating Entity Help(Searched none work.)
 
Okay first of all here is the code I am using.
Code:

// ******************************************************************
// Credits **********************************************************
// <-Ninja_Munkey-> *************************************************
// All the people at http://www.AMXModX.org/forums ******************
// ******************************************************************
// Plugin Summon Creator ********************************************
// ******************************************************************

#include <amxmodx>
#include <amxmisc>
#include <string>
#include <fun>
#include <engine>

// **************************
// Begin Plugin INT
// **************************
public plugin_precache()
{
        if (file_exists("models/Summon/spider.mdl"))
        precache_model("models/Summon/spider.mdl")
        return PLUGIN_CONTINUE;
}

// **************************
// End Plugin INT
// **************************

// **************************
// Begin Plugin INT
// **************************
public plugin_init()
{
        register_plugin("Summon Creator", "0.1.0", "<-Ninja_Munkey->")
        register_clcmd("say /Summon", "SummonSpider(id)")
        return PLUGIN_CONTINUE;
}

// **************************
// End Plugin INT
// **************************

// **************************
// Begin SummonSpider
// **************************
public SummonSpider(id){

// **************************
// Create Basic Entity
// **************************
new entid
entid = create_entity("summoned_spider")

// **************************
// Set its classname
// **************************
entity_set_string(entid, EV_SZ_classname, "summon_spider")

// **************************
// Set its Model
// **************************
entity_set_model(entid, "models/summon/spider.mdl")

// **************************
// Set its origin
// **************************
new Float:origin[3]
entity_get_vector(id,EV_VEC_origin,origin);
entity_set_origin(entid, origin)

// **************************
// Set some basic properties
// **************************
entity_set_int(entid, EV_INT_solid, 1)
entity_set_int(entid, EV_INT_movetype, MOVETYPE_FOLLOW)
entity_set_edict(entid, EV_ENT_aiment, id)

// **************************
// Set to follow
// **************************
new entWeapon
entWeapon = create_entity("info_target")
entity_set_int(entWeapon, EV_INT_movetype, MOVETYPE_FOLLOW)
entity_set_int(entWeapon, EV_INT_solid, SOLID_NOT)
entity_set_edict(entWeapon, EV_ENT_aiment, entid)

// **************************
// Set creater health & armor
// **************************
        entity_set_int(entid, EV_FL_armortype, 50)
        entity_set_int(entid, EV_FL_health, 50)
}
// **************************
// End SummmonSpider
// **************************

I have the model set and everything, yet it still doesn't show up, what am I doing wrong?

Silverice146 06-08-2005 15:33

hmm not sure but first of all

Code:
#include <string>

^wtf is that i know thats in C++ but not in small, its not even in the include folder



Code:
"SummonSpider(id)"

some pro correct me if im wrong, but u dont need the (id) in there

n0obie4life 06-08-2005 23:43

www.amxmodx.org/funcwiki.php

The core told me that there is such a thing called string.inc in the core >.<

v3x 06-09-2005 03:40

You don't need to include it.

mobytoss 06-18-2005 16:55

Perhaps your problem is you havent given it a think (I dunno, i've never really done one without a think). Look up register_think() and entity_set_float(entid, EV_FL_nextthink, ... etc.)

Have a look at Twilight's guide to making an NPC if you don't know what i'm on about. Search "How to: make the perfect NPC".

Geesu 06-18-2005 20:38

This might give you an idea, it's sorta the same thing for creating the initial model, I wish I still had my code from my "clone" stuff...

http://forums.alliedmods.net/showthread.php?t=7553

LynX 06-19-2005 04:36

Loooooooooolll o0
Why dont u guys see the problem, and I do? o0

Here, this is the summon code for teh little brat which I want to sqeeze with mine leg ( read : SPIDER ).

Code:
// ****************************************************************** // Credits ********************************************************** // <-Ninja_Munkey-> ************************************************* // All the people at <a href="http://www.AMXModX.org/forums" target="_blank" rel="nofollow noopener">http://www.AMXModX.org/forums</a> ****************** // ****************************************************************** // Plugin Summon Creator ******************************************** // ****************************************************************** #include <amxmodx> #include <amxmisc> #include <string> #include <fun> #include <engine> // ************************** // Begin Plugin INT // ************************** public plugin_precache() {    if (file_exists("models/Summon/spider.mdl"))    precache_model("models/Summon/spider.mdl")    return PLUGIN_CONTINUE; } // ************************** // End Plugin INT // ************************** // ************************** // Begin Plugin INT // ************************** public plugin_init() {    register_plugin("Summon Creator", "0.1.0", "<-Ninja_Munkey->")    register_clcmd("say /Summon", "SummonSpider(id)")    return PLUGIN_CONTINUE; } // ************************** // End Plugin INT // ************************** // ************************** // Begin SummonSpider // ************************** new SpiderEnt[32] public SummonSpider(id){ // ************************** // Create Basic Entity // ************************** SpiderEnt[id] = create_entity("info_target") // you can change info_target to env_model if it doesnt work // ************************** // Set its classname // ************************** entity_set_string(SpiderEnt[id], EV_SZ_classname, "summon_spider") // ************************** // Set its Model // ************************** entity_set_model(SpiderEnt[id], "models/summon/spider.mdl") // ************************** // Set its origin // ************************** new Float:origin[3] entity_get_vector(id,EV_VEC_origin,origin); entity_set_origin(SpiderEnt[id], origin) // ************************** // Set some basic properties // ************************** entity_set_int(SpiderEnt[id], EV_INT_solid, 1) entity_set_int(SpiderEnt[id], EV_INT_movetype, MOVETYPE_FOLLOW) entity_set_edict(SpiderEnt[id], EV_ENT_aiment, id) // ************************** // Set to follow // ************************** new entWeapon entWeapon = create_entity("info_target") entity_set_int(entWeapon, EV_INT_movetype, MOVETYPE_FOLLOW) entity_set_int(entWeapon, EV_INT_solid, SOLID_NOT) entity_set_edict(entWeapon, EV_ENT_aiment, SpiderEnt[id]) // ************************** // Set creater health & armor // **************************    entity_set_int(SpiderEnt[id], EV_FL_armortype, 50)    entity_set_int(SpiderEnt[id], EV_FL_health, 50)    return PLUGIN_HANDLED } // ************************** // End SummmonSpider // **************************

And, btw, if you use so called "avatar" system, which takes bones&animations of current player model ( avatar system works so it places a model over the current model, which acts like current model ), I think maybe ur bones are incorrect.
Well, test the code, and lemme know if it doesn't compiles/runs well ingame/etc.

mobytoss 06-19-2005 04:47

Ahhhh I see now. He created a 'summoned_spider' entity, rather than an 'info_target'. *slaps forehead*

LynX 06-19-2005 05:11

Quote:

Originally Posted by mobytoss
Ahhhh I see now. He created a 'summoned_spider' entity, rather than an 'info_target'. *slaps forehead*

Yeah...
And one more thing - now he can remove that entity due to array ^^
If it was done his way of creating ,he couldnt remove it since it went out of scope :p

mobytoss 06-19-2005 05:20

Wait... Isn't yours going to go outta array?
You've got it at [32], but all the settings are added to [id] rather than [id-1] :O


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

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