Gamestudio Links
Zorro Links
Newest Posts
Executing Trades on Next Bar Open
by vicknick. 06/13/24 08:51
Zorro Beta 2.61: PyTorch
by jcl. 06/10/24 14:42
New FXCM FIX Plugin
by flink. 06/04/24 07:30
AlpacaZorroPlugin v1.3.0 Released
by kzhao. 05/22/24 13:41
Free Live Data for Zorro with Paper Trading?
by AbrahamR. 05/18/24 13:28
AUM Magazine
Latest Screens
The Bible Game
A psychological thriller game
SHADOW (2014)
DEAD TASTE
Who's Online Now
0 registered members (), 1,209 guests, and 0 spiders.
Key: Admin, Global Mod, Mod
Newest Members
AemStones, LucasJoshua, Baklazhan, Hanky27, firatv
19059 Registered Users
Previous Thread
Next Thread
Print Thread
Rate Thread
bullet hole decals and error #286107
08/23/09 04:12
08/23/09 04:12
Joined: Jul 2009
Posts: 80
Area 51
F
fangedscorpion Offline OP
Junior Member
fangedscorpion  Offline OP
Junior Member
F

Joined: Jul 2009
Posts: 80
Area 51
Whenever I try to use a bullet hole decal and create it on an object, I receive an error.

Here is my code: (It is similar to an example in the lite-c manual)

// calculate the target vector
VECTOR trace_target;
vec_set(trace_target,vector(5000,0,0)); // the weapon has a firing range of 5000 quants
vec_rotate(trace_target, camera.pan);
vec_add(trace_target, camera.x);

// display a red spot at the target position
if (c_trace(camera.x,trace_target, IGNORE_PASSABLE | USE_POLYGON| SCAN_TEXTURE) > 0) // hit something?
draw_point3d(hit.x,vector(50,50,255),100,3);

// fire and then place a decal at the hit position
if (key_ctrl) // fire
{
PARTICLE* p = ent_decal(you,bmMark,you.x, you.y); // place a random sized decal at the hit entity
p.lifespan = 80;
wait(-0.5); // reload
}

What is wrong with the code?

Also, does anyone know how to make a bullet hole decal on the object more easily?

Last edited by fangedscorpion; 08/23/09 17:48.

"Pow! You are dead! Not big suprise!" -Heavy
Re: bullet hole decals and error [Re: fangedscorpion] #286438
08/25/09 10:37
08/25/09 10:37
Joined: Aug 2008
Posts: 482
B
bart_the_13th Offline
Senior Member
bart_the_13th  Offline
Senior Member
B

Joined: Aug 2008
Posts: 482
Well, I think ent_decal only work on Commercial version and above

But that you pointer in
Code:
PARTICLE* p = ent_decal(you,bmMark,you.x,you.y);


could be NULL and that will generate error..(No such thing as NULL.x)

How about using
Code:
PARTICLE* p = ent_decal(you,bmMark,8, random(360));




Last edited by bart_the_13th; 08/25/09 10:39.
Re: bullet hole decals and error [Re: bart_the_13th] #323508
05/14/10 23:37
05/14/10 23:37
Joined: Jul 2004
Posts: 1,710
MMike Offline
Serious User
MMike  Offline
Serious User

Joined: Jul 2004
Posts: 1,710
... im using a png 64x64 and this crashes, the only way to not crash is using p.material=NULL; but that will make the texture square black?

Re: bullet hole decals and error [Re: MMike] #323510
05/14/10 23:40
05/14/10 23:40
Joined: Jan 2002
Posts: 4,225
Germany / Essen
Uhrwerk Offline
Expert
Uhrwerk  Offline
Expert

Joined: Jan 2002
Posts: 4,225
Germany / Essen
Setting the material to null is not a good idea. PNG is even not the greatest idea. You should use .bmp, .tga or .dds. What exactly is the error message you're getting?


Always learn from history, to be sure you make the same mistakes again...
Re: bullet hole decals and error [Re: Uhrwerk] #323512
05/14/10 23:45
05/14/10 23:45
Joined: Jul 2004
Posts: 1,710
MMike Offline
Serious User
MMike  Offline
Serious User

Joined: Jul 2004
Posts: 1,710
well i was just "drunk" i did this:

PARTICLE* p= ent_decal(you,"d_map.png",0,0); // place a random sized decal at the hit

of course i have to define the BMAP first.. or use the bmap_create..

Anyway PNG always work 5 stars for me!

Now the only problem is that the texture is not wrapping very good to the surface, sometimes it gets bigger others smaller dependning on the face of the sphere .. (dont know why..)
Gs never is perfect..


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