Raised This Month: $51 Target: $400
 12% 

How do I do things with Entities?


Post New Thread Reply   
 
Thread Tools Display Modes
Batman/Gorlag
Senior Member
Join Date: Aug 2005
Old 08-24-2005 , 19:17  
Reply With Quote #21

Cool thanks again Freecode =D. BTW what are the two parameters for, and do i do anything to them?
__________________
GRR If only the amxmod programming were in Java.....
Java and C used to be two different languages, now Java is turning into another C. My logevent plugin
Batman/Gorlag is offline
Freecode
Never Fall Asleep
Join Date: Jan 2004
Old 08-24-2005 , 19:45  
Reply With Quote #22

hmm read a few threads down.
Quote:
Originally Posted by vittu
I'm sorry Gorlag/Batman but I'm gonna have to refuse help on this from anyone, nothing against you cause you at least seem decent but it's against where you come from. I can not allow help to be provided to a server (specifically the one person that runs that sever) that sends nothing but troubles in our direction, in particular all that spam that has come to our forums as of late. And I was informed of the credit stealing going on at that site, which is just wrong. So good luck to you.
I cannot dissobey Dev members. Sorry.
Freecode is offline
Batman/Gorlag
Senior Member
Join Date: Aug 2005
Old 08-24-2005 , 19:53  
Reply With Quote #23

Yeah don't worry i remember that post, that's alright though i'll just google it hopefully giving me a description.

10 min. later: Okay now i know that ptr is the toucher and ptd is the touched!!! Nice sweet!

P.S. I could get help from the amxmod forum right?

Next day: Alright so here's my coding for my hero so far...I suppose I could also add hp armor, gravity and all those stuff a lil later. But for some reason the server keeps crashing, getting four warnings about tag mismatch exceptions at lines 142, 148, 151, and 175. I know I probably won't get help because of where I come from, but I just wanted show anyone that is reading this forum of what I have done so far.

Code:
//Cell #include <amxmod.inc> #include <superheromod.inc> #include <engine.inc> #include <Vexd_Utilities.inc> #include <amxmisc.inc> #include <xtrafun.inc> new gHeroName[] = "Cell" new bool:g_hasCellPowers[SH_MAXSLOTS+1] new diskTimer[SH_MAXSLOTS+1] //This variable will represent the disk being made. new NewEnt //------------------------------------------------------------------------------------ public plugin_init() {     register_plugin("SUPERHERO Cell", "1.0", "Gorlag/Batman")     //THE CVARS     register_cvar("cell_level", "4")     register_cvar("cell_damage", "75")     register_cvar("cell_radius", "50")         register_cvar("cell_cooldown", "50")         register_cvar("cell_diskspeed", "750")     register_cvar("cell_disklife", "5")         register_cvar("cell_blastdecal", "1")     //THIS LINE MAKES THE HERO SELECTABLE         shCreateHero(gHeroName, "Energy Disk", "Unleash an energy disk and take control of where it flies!", true, "cell_level")     //INITIAL ACTIONS     register_srvcmd("cell_init", "cell_init")     shRegHeroInit(gHeroName, "cell_init")         //KEY DOWN COMMAND     register_srvcmd("cell_kd", "cell_kd")     shRegKeyDown(gHeroName, "cell_kd")     //SPAWNING EVENT     register_event("ResetHUD", "newSpawn", "b")     //SET THE LIFE OF THE DISK     set_task(1.0, "cell_disklife", 0, "", 0, "b")     for(new id = 1; id <= SH_MAXSLOTS; id++)         diskTimer[id] = -1 } //-------------------------------------------------------------------------------------- public plugin_precache() {     precache_model("models/shmod/friezadisc.mdl")     //boom = precache_model("sprites/zerogxplode.spr") } //--------------------------------------------------------------------------------------- public cell_init() {     new temp[6] //To store temporary information     //First Argument is the id of the player     read_argv(1,temp,5) //Converts the string to a number     new id = str_to_num(temp)     //Second Argument is either 0 or 1 depending on whether the person has the hero or not     read_argv(2,temp,5)     new hasPowers = str_to_num(temp) //Makes the string into a number     g_hasCellPowers[id] = (hasPowers != 0)     if(!hasPowers && diskTimer[id] > 0){         diskTimer[id] = -1         remove_entity(NewEnt)     } } //--------------------------------------------------------------------------------------- public cell_kd() {     if(!hasRoundStarted()) return     new temp[6]     //Get the id of the player     read_argv(1,temp,5)     new id = str_to_num(temp)     if(!is_user_alive(id) || !g_hasCellPowers[id] || gPlayerUltimateUsed[id]) return     if(gPlayerUltimateUsed[id]){         playSoundDenySelect(id)         return     }     diskTimer[id] = get_cvar_num("cell_disklife")     fire_disk(id)     if(get_cvar_float("cell_cooldown") > 0.0)         ultimateTimer(id, get_cvar_float("cell_cooldown")) } //---------------------------------------------------------------------------------------- public newSpawn(id) {     gPlayerUltimateUsed[id] = false  //Makes you able to use power again } //---------------------------------------------------------------------------------------- public cell_disklife(){     for(new id = 1; id <= SH_MAXSLOTS; id++){         if(g_hasCellPowers[id] && is_user_alive(id)){             if(diskTimer[id] > 0){                 diskTimer[id]--             }             else{                 remove_entity(NewEnt)                 diskTimer[id]--             }         }     } } //---------------------------------------------------------------------------------------- public fire_disk(id) {     //Makes an array of origin in the (x,y,z) coordinate system.     new origin[3]     //Makes an array of velocity, specifically in the (x,y,z) coordinate system     new velocity[3]     get_user_origin(id, origin, 0)     create_disk(id, origin, velocity) } //---------------------------------------------------------------------------------------- public create_disk(id, origin[3], velocity[3]) {     NewEnt = CreateEntity("info_target")  //Makes an object     entity_set_string(NewEnt, EV_SZ_classname, "cell_disk_ent")     //This tells what the object will look like     ENT_SetModel(NewEnt, "models/shmod/friezadisc.mdl")     //This will set the origin of the entity     entity_set_vector(NewEnt, EV_VEC_origin, origin)     //This will set the movetype of the entity     entity_set_int(NewEnt,EV_INT_movetype, MOVETYPE_FLY)     //This will set the velocity of the entity     velocity_by_aim(NewEnt, get_cvar_num("cell_maxspeed"), velocity)     //This will set the entity in motion     entity_set_vector(NewEnt, EV_VEC_velocity, velocity) } //----------------------------------------------------------------------------------------- public pfn_touch(ptr, ptd)  //ptr is the toucher, and ptd is the touched! {     //Checks to make sure that the entity is valid!     if(!is_valid_ent(ptr) || !is_valid_ent(ptd))     return PLUGIN_CONTINUE     //Checks to make sure that the victim is alive and connected to the server!     if(!is_user_alive(ptd) || !is_user_connected(ptd))     return PLUGIN_CONTINUE     //Now to deal the damage to the victim (touched) and remove the toucher (the disk)     new resulting_string[41]  //Makes a new empty string that will store 40 characters.     //Allows you to retrieve the entity of the toucher, in this case the disk.     entity_get_string(ptr, EV_SZ_classname, resulting_string, 40)     //Now because the data above is a string, the "==" would not work, when comparing.     //Instead I will use the equal method.     //Makes sure that the toucher entity is the disk.     if(equal(resulting_string, "cell_disk_ent")){         new aimvec[3]  //This is the position where the disk collides         get_user_origin(ptd, aimvec, 0)         RadiusDamage(aimvec, get_cvar_num("cell_damage"), get_cvar_num("cell_radius"))         remove_entity(ptr)  //Makes sure the entity is removed after contact.     }     else{         remove_entity(ptr)     }     return PLUGIN_CONTINUE } //-----------------------------------------------------------------------------------------

I'll add some animation to it when it collides against another object a lil later. And I'll make the disk follow wherever you aim a lil later as well.
__________________
GRR If only the amxmod programming were in Java.....
Java and C used to be two different languages, now Java is turning into another C. My logevent plugin
Batman/Gorlag is offline
Batman/Gorlag
Senior Member
Join Date: Aug 2005
Old 08-25-2005 , 22:15  
Reply With Quote #24

hey look at this so far guys, Cell is still far from complete but I think I'm making progress =D

Many thanks to Freecode and Rockell for helping me out so far =D.

BTW how do I post my image, so that you guys don't have to dl from zip files?
And my cell disk aren't moving......I'll fix that soon.
Attached Images
File Type: jpg cell.jpg (648.8 KB, 118 views)
__________________
GRR If only the amxmod programming were in Java.....
Java and C used to be two different languages, now Java is turning into another C. My logevent plugin
Batman/Gorlag is offline
vittu
SuperHero Moderator
Join Date: Oct 2004
Location: L.A. County, CA
Old 08-25-2005 , 23:31  
Reply With Quote #25

Quote:
Originally Posted by Gorlag/Batman
BTW how do I post my image, so that you guys don't have to dl from zip files?
you just attach the file same as you did with the zip...
vittu is offline
Send a message via AIM to vittu Send a message via MSN to vittu Send a message via Yahoo to vittu
Batman/Gorlag
Senior Member
Join Date: Aug 2005
Old 08-26-2005 , 07:09  
Reply With Quote #26

Well, special thanks to avalanche from the amxmod forum, for helping me to make the disk able to move =D. And another good news, I finally installed the guiding system, I'm thinking of releasing cell as like a tutorial entity hero, because messing with entities can be a hassle I swear. Well, I just wanted to give everyone the heads-up on my hero. Here are the things I still need to do:

1. Install a sound for releasing the disk.
2. Add animation when entity makes contact with another entity.
3. Change the damage from being explosive into being something that slices through everything, because the RadiusDamage method makes the victum look like he commited suicide, thanks to the note by Freecode about that function.
4. Maybe also add a sound when it touches something, not that THUD sound you hear when a bullet makes contact with a victim. If anyone has like a SLICING sound or something, please give it to me, I'll be sure to include the donor in my special thanks section that'll I'll be doing soon, when I'm finished with this project.
a) A slicing sound when it makes contact with an inanimate object like a box, or wall.
b) A slicing sound when it makes contact with living flesh, like the players.
__________________
GRR If only the amxmod programming were in Java.....
Java and C used to be two different languages, now Java is turning into another C. My logevent plugin
Batman/Gorlag is offline
Reply



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 12:08.


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