|
2 registered members (juanex, AndrewAMD),
988
guests, and 8
spiders. |
|
Key:
Admin,
Global Mod,
Mod
|
|
|
realizing "good" explosives
#299244
11/22/09 14:55
11/22/09 14:55
|
Joined: May 2009
Posts: 1,816 at my pc (duh)
darkinferno
OP
Serious User
|
OP
Serious User
Joined: May 2009
Posts: 1,816
at my pc (duh)
|
ok, so i guess the first thing people use for explosions is c_scan, but i have a prob with that however, basically what i want to do:
explosion occurs: -damages all entities in range and arent behind walls -increases the score of the creating entity
now, obviously when i create the explosive, the you pointer is set to the creating entity, this is the entity's score in which i want to increase
c_scan only returns the closest entity so it doesnt help much, tried using multiple methods, what i did nos is to check if the entities were scanned then trace to the grenade, this would inflict damage based on range and not damage entities behind walls, but i lose connection to the creating entity so i cant increase its score
so a few ideas would help
|
|
|
Re: realizing "good" explosives
[Re: darkinferno]
#299251
11/22/09 15:30
11/22/09 15:30
|
Joined: Oct 2009
Posts: 149 Germany
muffel
Member
|
Member
Joined: Oct 2009
Posts: 149
Germany
|
Use the Entity of the exploding object or create another Entity to handle the explosion. Set the emask ENABLE DETECT to the Entity and use c_scan after this. For each scanned Entity the event function is called. the you pointer of these function is set to the scanned Entity an untested example code:
function grenade_event()
{
if(event_type==EVENT_DETECT)
{
var dist;
dist=c_trace(me.x,you.x,IGNORE_ME);
if(dist>0)
{
//do the code which happens if the entity is influenced
//by the explosion(is in range and not behind a wall)
}
}
}
action grenade_action()
{
me.emask = (ENABLE_DETECT);
me.event = grenade_event;
//code before c_scan
s_can(me.x,me.pan,vector(360,0,100),SCAN_ENTS);
//scans a sphere with an radius of 100 quants
//code after c_scan
}
This code has some problems, because its effect every entity also weapons etc. Additionally you can hide yourself behind another Entity. But I think there are solutions for these problems muffel
|
|
|
Re: realizing "good" explosives
[Re: darkinferno]
#299264
11/22/09 16:05
11/22/09 16:05
|
Joined: May 2008
Posts: 2,113 NRW/Germany
alibaba
Expert
|
Expert
Joined: May 2008
Posts: 2,113
NRW/Germany
|
do you have different pointers for the player and for the enemies?
Last edited by alibaba; 11/22/09 16:07.
|
|
|
Re: realizing "good" explosives
[Re: alibaba]
#299266
11/22/09 16:14
11/22/09 16:14
|
Joined: Oct 2007
Posts: 5,209 İstanbul, Turkey
Quad
Senior Expert
|
Senior Expert
Joined: Oct 2007
Posts: 5,209
İstanbul, Turkey
|
why don't just
temp = ent_create(blalba);//create the nade temp.skillsomething = creator;
??
Last edited by Quadraxas; 11/22/09 16:15.
3333333333
|
|
|
Re: realizing "good" explosives
[Re: MasterQ32]
#299274
11/22/09 16:47
11/22/09 16:47
|
Joined: Oct 2009
Posts: 149 Germany
muffel
Member
|
Member
Joined: Oct 2009
Posts: 149
Germany
|
well here is my idea similiar to Quadraxas one you probably have to use over skills:
function grenade_event()
{
if(event_type==EVENT_DETECT)
{
var dist;
dist=c_trace(me.x,you.x,IGNORE_ME);
if(dist>0)
{
me.skill2 += 1;//counts every hit Entity
//do the code which happens if the entity is influenced
//by the explosion(is in range and not behind a wall)
}
}
}
action grenade_action()
{
wait(1); //to become sure that the handle is applyed to the skill(don't know if you'll need this)
ENTITY* actor;
actor = ptr_for_handle(me.skill1); //apply the address to another Pointer
me.emask = (ENABLE_DETECT);
me.event = grenade_event;
//code before c_scan
c_scan(me.x,me.pan,vector(360,0,100),SCAN_ENTS);//scans a sphere with an radius of 100 quants
actor.skill2 += me.skill2;//adds the num of hits to the skill which holds the score of the actor
//code after c_scan
}
function throw_grenade(ENTITY* actor)
{
ENTITY* grenade;
grenade = ent_create(...,grenade_action);//creates grenade
grenade.skill1 = handle(actor);//puts the adress of the actor Entity into a skill
//do the throwing code
}
muffel
|
|
|
|