Raised This Month: $ Target: $400
 0% 

Add entity in map


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Phant
Veteran Member
Join Date: Sep 2009
Location: New Jersey
Old 09-29-2009 , 03:47   Add entity in map
Reply With Quote #1

Hello, i newbie in AMXX scripting, and i want to create plugin for add entity in special map.

Simple plan:
If current map = "de_dust2"
If Create Entity "cycler_sprite"
Add classname?
Add "origin" (coordinates)
Add "model" (sprites/*.spr)
Add "angles"
EndIf
EndIf

I try:
Code:
/* Script generated by Pawn Studio */

#include <amxmodx>
#include <fakemeta>

#define PLUGIN    "Add entity in map"
#define AUTHOR    "Phant"
#define VERSION    "1.0"

public plugin_init()
{
    register_plugin(PLUGIN, VERSION, AUTHOR)
    
    new s_Map[32];
    get_mapname(s_Map, charsmax(s_Map));
    if (equal(s_Map, "de_dust2"))
    {
        new entity = engfunc(EngFunc_CreateNamedEntity, engfunc(EngFunc_AllocString, "info_target"))
            set_pev(entity, pev_classname, "cycler_sprite")
            set_pev(entity, pev_model, "sprites/3dmflaora.spr")
            set_pev(entity, pev_angles, "0, 90, 0")
            set_pev(entity, pev_origin, "197.0, 2190.0, -31")
    }

}
Don't work , can you show an example?
Thanks & sorry!

And question: where to get a compiler? I use this: http://www.amxmodx.org/webcompiler.cgi.

Last edited by Phant; 09-29-2009 at 03:49.
Phant is offline
Send a message via ICQ to Phant
Arkshine
AMX Mod X Plugin Approver
Join Date: Oct 2005
Old 09-29-2009 , 05:58   Re: Add entity in map
Reply With Quote #2

Don't use info_target, use cycler_sprite as entity name and don't forget to spawn it ; dllfunc( DLLFunc_Spawn, entity )
__________________
Arkshine is offline
Phant
Veteran Member
Join Date: Sep 2009
Location: New Jersey
Old 11-10-2009 , 08:18   Re: Add entity in map
Reply With Quote #3

I added env_rain in de_dust2 map:
Code:
/* Plugin generated by AMXX-Studio */

#include <amxmodx>
#include <amxmisc>
#include <engine>

#define PLUGIN "Snow"
#define VERSION "1.0"
#define AUTHOR "Phant"

public plugin_init(){
    register_plugin(PLUGIN, VERSION, AUTHOR)
    
    new mapid[32];
    get_mapname(mapid, charsmax(mapid))
    
    if(equal(mapid, "de_dust2"))
    {
        new ent_snow = create_entity("env_snow")
        entity_set_origin(ent_snow,Float:{-160.0,2000.0,-80.0})
    }
}
But it does not work, why? Maybe "plugin_init" lately called for creation rain?
Phant is offline
Send a message via ICQ to Phant
Arkshine
AMX Mod X Plugin Approver
Join Date: Oct 2005
Old 11-10-2009 , 08:25   Re: Add entity in map
Reply With Quote #4

Try in plugin_precache()
__________________
Arkshine is offline
xPaw
Retired AMX Mod X Moderator
Join Date: Jul 2008
Old 11-10-2009 , 08:32   Re: Add entity in map
Reply With Quote #5

Also you dont need to put origin for env_snow, it will be overall anyway.
__________________
xPaw is offline
Phant
Veteran Member
Join Date: Sep 2009
Location: New Jersey
Old 11-11-2009 , 03:50   Re: Add entity in map
Reply With Quote #6

Quote:
Originally Posted by Arkshine View Post
Try in plugin_precache()
Thanks!
Quote:
Originally Posted by xPaw View Post
Also you dont need to put origin for env_snow, it will be overall anyway.
Ok, thanks, i thought that if entity without map border (in "space") — this error.
Phant is offline
Send a message via ICQ to Phant
SnoW
Veteran Member
Join Date: Oct 2008
Location: Finland WisdomNuggets: 8
Old 11-11-2009 , 09:28   Re: Add entity in map
Reply With Quote #7

Quote:
Originally Posted by xPaw View Post
Also you dont need to put origin for env_snow, it will be overall anyway.
Hi.
SnoW is offline
Send a message via MSN to SnoW
Phant
Veteran Member
Join Date: Sep 2009
Location: New Jersey
Old 11-14-2009 , 22:26   Re: Add entity in map
Reply With Quote #8

I successfully delete env_rain entity from de_aztec:
Code:
public plugin_init(){
   
   new mapid[32];
   get_mapname(mapid, charsmax(mapid))
   
   if(equal(mapid, "de_aztec"))
   {
      remove_entity_name("env_rain")
   }
}

But how to delete 5 ambient_generic from this map?
I try:
remove_entity_name("ambient_generic") — fail .
Phant is offline
Send a message via ICQ to Phant
KadiR
Unnecessary Member
Join Date: Aug 2008
Location: Zürich / Switzerland
Old 11-15-2009 , 06:22   Re: Add entity in map
Reply With Quote #9

ambient_generic should work fine, and try also trigger_multiple, it makes the big thunder sound on the bridge and more..
KadiR is offline
xPaw
Retired AMX Mod X Moderator
Join Date: Jul 2008
Old 11-15-2009 , 06:27   Re: Add entity in map
Reply With Quote #10

Quote:
Originally Posted by Phant View Post

But how to delete 5 ambient_generic from this map?
I try:
remove_entity_name("ambient_generic") — fail .
Did you tryed in plugin_init? Because it will fail if you try in plugin_precache
__________________
xPaw is offline
Reply


Thread Tools
Display Modes

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 22:41.


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