Raised This Month: $ Target: $400
 0% 

Creating Mines..


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
BioHazardousWaste
Senior Member
Join Date: Apr 2005
Location: Ontario, Canada =)
Old 04-30-2005 , 00:11   Creating Mines..
Reply With Quote #1

Hey guys, I know i've been posting like a nub tonight , but i've been trying a bunch of new things, and there is still a lot I don't know

My latest is trying to make a landmine. I made an entity, did a bunch of code to check radius and whatnot, then got to the detonate mine procedure:

Code:
public DetonateMine(ident[],TaskID) {     if(PlayerMinePlanted[id]) //avoid multiple explosions of the same mine     {         new id = str_to_num(ident)         PlayerMinePlanted[id] = 0         new Float:MineLocation[3]         MineLocation[0] = PlayerMineOrigin[Mine][0]         MineLocation[1] = PlayerMineOrigin[Mine][1]         MineLocation[2] = PlayerMineOrigin[Mine][2]                 RadiusDamage(MineLocation, PlayerLevel[id], PlayerLevel[id])     } }

Seems simple enough, but is there a way to check if anyone in that radius was killed so that I can give the killer appropriate experience and frag count?
__________________
"What then is truth? Truths are illusions which we have forgotten are illusions - they are metaphors that have become worn out... this (truth) is the duty to lie according to a fixed convention.

-Friedrich Nietzsche
BioHazardousWaste is offline
Send a message via MSN to BioHazardousWaste
KCE
Senior Member
Join Date: Jan 2005
Location: Los Angeles, CA
Old 04-30-2005 , 00:23  
Reply With Quote #2

What mod's this for?

Quote:
Falloff damage from a grenade or other explosive

Code:
stock Float:dfalloff_damage(Float:dist, Float:maxdist, Float:maxdamage)
return maxdamage * (1.0 - (dist / maxdist))
For damage radius, try something like this:
Code:
for (new i=1;i<=g_maxplayers;++i) {     if (is_valid_ent(i))     {         //get distance between the player damaged and the source of the damage, then check if in damage radius         if (get_entity_distance(dmginflictor,i) <= DMG_RADIUS)          {             //do damage, exp, score,...         }     } }

There's some more checks you need to do also, like check if player is alive and connected and also check the teams.
__________________

My 3D Art: http://k-c-e.deviantart.com/

[img]http://img213.**************/img213/7132/userbar152416mp2.gif[/img]
[img]http://img65.**************/img65/5606/userbar152433ie5.gif[/img]
[img]http://img223.**************/img223/7576/userbar152440yk6.gif[/img]
KCE is offline
BioHazardousWaste
Senior Member
Join Date: Apr 2005
Location: Ontario, Canada =)
Old 04-30-2005 , 00:29  
Reply With Quote #3

I'm making a new matrix mod... but is it possible to check if anyone in that radius was killed so that I can give the killer appropriate experience and frag count?
__________________
"What then is truth? Truths are illusions which we have forgotten are illusions - they are metaphors that have become worn out... this (truth) is the duty to lie according to a fixed convention.

-Friedrich Nietzsche
BioHazardousWaste is offline
Send a message via MSN to BioHazardousWaste
Ced
Member
Join Date: Oct 2004
Old 04-30-2005 , 00:31  
Reply With Quote #4

first of all the id in the playermineplanted array will b undefined and i don't think radius damage works anymore. Do
Code:
for ( new i = 0; i < g_MAXPLAYERS; i++ ) {    if ( is_user_alive( i ) {       new Float:Origin1[3], Float:Origin2[3], Float:fDistance       entity_get_vector( i, EV_VEC_origin, Origin1 )       entity_get_vector( entity, EV_VEC_origin, Origin2 )       fDistance = vector_distance( Origin1, Origin2 )       if (  fDistance <= MINERADIUS ) {          //whatever       }    } }
And u would have to define an entity, mine radius, and get the maxplayers of the time
Ced is offline
BioHazardousWaste
Senior Member
Join Date: Apr 2005
Location: Ontario, Canada =)
Old 04-30-2005 , 00:37  
Reply With Quote #5

ok... so are you telling me I can't make an array of entities?
__________________
"What then is truth? Truths are illusions which we have forgotten are illusions - they are metaphors that have become worn out... this (truth) is the duty to lie according to a fixed convention.

-Friedrich Nietzsche
BioHazardousWaste is offline
Send a message via MSN to BioHazardousWaste
Ced
Member
Join Date: Oct 2004
Old 04-30-2005 , 00:38  
Reply With Quote #6

um, u might b able to get the players origin in the death event, if not, u can get the origin from the damage event when the players health is <= 0 and compare it to your mine and check the distance to see if its in the radius
Ced is offline
Ced
Member
Join Date: Oct 2004
Old 04-30-2005 , 00:39  
Reply With Quote #7

no, i said id would be undefined since u have ident and there is not an id, lol. Btw, why don't u just make ident id and why do u have the task id? I would define all my taskid's.
Code:
#define TASK_CHECKMINE 100
Ced is offline
BioHazardousWaste
Senior Member
Join Date: Apr 2005
Location: Ontario, Canada =)
Old 04-30-2005 , 00:40  
Reply With Quote #8

it's iffy ced.. the person could have been shot while within the radius (unlikely, but possible) I think KCE has got the idea, i'm going to try to implement that... but seriously, how do you make an array of entities?
__________________
"What then is truth? Truths are illusions which we have forgotten are illusions - they are metaphors that have become worn out... this (truth) is the duty to lie according to a fixed convention.

-Friedrich Nietzsche
BioHazardousWaste is offline
Send a message via MSN to BioHazardousWaste
Ced
Member
Join Date: Oct 2004
Old 04-30-2005 , 00:42  
Reply With Quote #9

thats why u make sure they r dead first by checking their health, heh
Depends how u want to save your entities. U could do it like this
Code:
#define MAXPLAYERS 33 #define MAXMINES 5 new g_Mines[MAXPLAYERS][MAXMINES]

That could save them if u were looking by each individual, if u just want 1 big list, just make a normal array like KCE did
Ced is offline
KCE
Senior Member
Join Date: Jan 2005
Location: Los Angeles, CA
Old 04-30-2005 , 00:46  
Reply With Quote #10

Quote:
Originally Posted by BioHazardousWaste
it's iffy ced.. the person could have been shot while within the radius (unlikely, but possible) I think KCE has got the idea, i'm going to try to implement that... but seriously, how do you make an array of entities?
There's plenty of ways to do this. Look through some of the other programs.

well to do it for all entities in the game...

Code:
new i for (i = 1; i <= entity_count(); i++) { ...

What do you mean an array of entities?

hmm...I had this problem once before...forgot how I solved it...see if this'll work

Code:
new entities_list[]
__________________

My 3D Art: http://k-c-e.deviantart.com/

[img]http://img213.**************/img213/7132/userbar152416mp2.gif[/img]
[img]http://img65.**************/img65/5606/userbar152433ie5.gif[/img]
[img]http://img223.**************/img223/7576/userbar152440yk6.gif[/img]
KCE 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 16:39.


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