Gamestudio Links
Zorro Links
Newest Posts
loading historical data 1st time
by AndrewAMD. 04/14/23 12:54
Trade at bar open
by juanex. 04/13/23 19:43
Bug in Highpass2 filter
by rki. 04/13/23 09:54
Adding Limit Orders For IB
by scatters. 04/11/23 16:16
FisherN
by rki. 04/11/23 08:38
AUM Magazine
Latest Screens
SHADOW (2014)
DEAD TASTE
Tactics of World War I
Hecknex World
Who's Online Now
2 registered members (juanex, AndrewAMD), 988 guests, and 8 spiders.
Key: Admin, Global Mod, Mod
Newest Members
rki, FranzIII, indonesiae, The_Judge, storrealba
18919 Registered Users
Previous Thread
Next Thread
Print Thread
Rate Thread
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 Offline OP
Serious User
darkinferno  Offline 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] #299247
11/22/09 15:15
11/22/09 15:15
Joined: May 2008
Posts: 2,113
NRW/Germany
alibaba Online
Expert
alibaba  Online
Expert

Joined: May 2008
Posts: 2,113
NRW/Germany
you could set the flag ENABLE_SCAN at all entities and at the event function you could check if model is scanned.


Professional Edition
A8.47.1
--------------------
http://www.yueklet.de
Re: realizing "good" explosives [Re: darkinferno] #299251
11/22/09 15:30
11/22/09 15:30
Joined: Oct 2009
Posts: 149
Germany
M
muffel Offline
Member
muffel  Offline
Member
M

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:
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: muffel] #299262
11/22/09 15:57
11/22/09 15:57
Joined: May 2009
Posts: 1,816
at my pc (duh)
darkinferno Offline OP
Serious User
darkinferno  Offline OP
Serious User

Joined: May 2009
Posts: 1,816
at my pc (duh)
my problem isnt in issuing damage, my problem is how to get the pointer of the entity that created the grenade, if the grenade killed 10 enemies, i want to add 10 points to the creating entity, so i need the pointer of the creator

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 Online
Expert
alibaba  Online
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.

Professional Edition
A8.47.1
--------------------
http://www.yueklet.de
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 Online
Senior Expert
Quad  Online
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: Quad] #299267
11/22/09 16:22
11/22/09 16:22
Joined: May 2009
Posts: 1,816
at my pc (duh)
darkinferno Offline OP
Serious User
darkinferno  Offline OP
Serious User

Joined: May 2009
Posts: 1,816
at my pc (duh)
yes quadraxes, i tried something like that, not your exact idea but very similar, i'll try yours and tell you how it goes

Re: realizing "good" explosives [Re: darkinferno] #299273
11/22/09 16:39
11/22/09 16:39
Joined: Nov 2007
Posts: 2,568
Germany, BW, Stuttgart
MasterQ32 Offline
Expert
MasterQ32  Offline
Expert

Joined: Nov 2007
Posts: 2,568
Germany, BW, Stuttgart
I would try something like this:
Code:
action grenade()
{
	ENTITY* creator = you;
	...
}



Richi007


Visit my site: www.masterq32.de
Re: realizing "good" explosives [Re: MasterQ32] #299274
11/22/09 16:47
11/22/09 16:47
Joined: Oct 2009
Posts: 149
Germany
M
muffel Offline
Member
muffel  Offline
Member
M

Joined: Oct 2009
Posts: 149
Germany
well here is my idea similiar to Quadraxas one
you probably have to use over skills:
Code:
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

Re: realizing "good" explosives [Re: muffel] #299314
11/22/09 23:25
11/22/09 23:25
Joined: May 2009
Posts: 1,816
at my pc (duh)
darkinferno Offline OP
Serious User
darkinferno  Offline OP
Serious User

Joined: May 2009
Posts: 1,816
at my pc (duh)
well quadraxas your idea ran ok, similar to muffels also, what i actually was doing:

-players toss grenades
-server side grenade movement and trigger
-deals damage
-increases/decreases score of the creator of the grenade based on what was damaged

theres a very minute chance that i'll be posting a video soon


Moderated by  HeelX, Lukas, rayp, Rei_Ayanami, Superku, Tobias, TWO, VeT 

Gamestudio download | chip programmers | Zorro platform | shop | Data Protection Policy

oP group Germany GmbH | Birkenstr. 25-27 | 63549 Ronneburg / Germany | info (at) opgroup.de

Powered by UBB.threads™ PHP Forum Software 7.7.1