SA-MP Forums

Go Back   SA-MP Forums > SA-MP Scripting and Plugins > Scripting Help

Reply
 
Thread Tools Display Modes
Old 19/02/2012, 08:42 PM   #1
Mike_Peterson
Gangsta
 
Mike_Peterson's Avatar
 
Join Date: Apr 2009
Location: In a concrete(used to brick) house
Posts: 844
Reputation: 37
Cool Grenade launcher

Hi y'all, been inactive on the forums for a small time..
Anyway, I felt like making a grenade launcher script, but I've spotted a problem..
Is there any way, to detect if the grenade hits a building/wall/mountain?
Plus, I think my GetPosFromView is kinda f... up, is there a better way to find where the player is aiming at?
Any help will be appreciated ofcourse.
Best regards, Martin.
__________________
I'm looking for some small-time paid work, no MySQL preferably.
Search before you post!

Got a problem? Debug your script (add prints to it).
If that doesn't help, use ******!
Still having issues? Create a thread on the SA-MP Forums.
If nothing helps, send me a PM.
And I'll try to figure it out with you.
Mike_Peterson is offline   Reply With Quote
Old 19/02/2012, 09:10 PM   #2
Babul
High-roller
 
Babul's Avatar
 
Join Date: Sep 2009
Location: in a cement block
Posts: 1,783
Reputation: 251
Default Re: Grenade launcher

is your script applying some sort of "fake gravity"? i mean, is the grenade object falling down after you threw it away? if so, then you can check if the grenade falls down (the z axis height decrementing). the mapandras plugin will detect if it hits the ground, and even if it hits a wall bigger than 1 unitē regardless its direction.
__________________
FireWorks

new sscanf2 custom specifiers available for Download, read the Release Topic
Babul is offline   Reply With Quote
Old 19/02/2012, 09:35 PM   #3
TheArcher
High-roller
 
TheArcher's Avatar
 
Join Date: Dec 2009
Location: Home
Posts: 2,333
Reputation: 251
Default Re: Grenade launcher

Quote:
Originally Posted by Babul View Post
is your script applying some sort of "fake gravity"? i mean, is the grenade object falling down after you threw it away? if so, then you can check if the grenade falls down (the z axis height decrementing). the mapandras plugin will detect if it hits the ground, and even if it hits a wall bigger than 1 unitē regardless its direction.
You stole my words. LOL

I've already did that method and its working.
__________________
TheArcher is offline   Reply With Quote
Old 19/02/2012, 11:11 PM   #4
Mike_Peterson
Gangsta
 
Mike_Peterson's Avatar
 
Join Date: Apr 2009
Location: In a concrete(used to brick) house
Posts: 844
Reputation: 37
Default Re: Grenade launcher

Actually, my grenade's just fucked up, it moves to where i clicked the grenade launcher to, if it's on the ground, if i shoot it in the air, the explosion & grenade will simply be on the ground, and their positions are crap too, not where i am at.. so that's why i wonder how to improve aim position..
__________________
I'm looking for some small-time paid work, no MySQL preferably.
Search before you post!

Got a problem? Debug your script (add prints to it).
If that doesn't help, use ******!
Still having issues? Create a thread on the SA-MP Forums.
If nothing helps, send me a PM.
And I'll try to figure it out with you.
Mike_Peterson is offline   Reply With Quote
Old 20/02/2012, 01:08 PM   #5
TheArcher
High-roller
 
TheArcher's Avatar
 
Join Date: Dec 2009
Location: Home
Posts: 2,333
Reputation: 251
Default Re: Grenade launcher

Quote:
Originally Posted by Mike_Peterson View Post
Actually, my grenade's just fucked up, it moves to where i clicked the grenade launcher to, if it's on the ground, if i shoot it in the air, the explosion & grenade will simply be on the ground, and their positions are crap too, not where i am at.. so that's why i wonder how to improve aim position..
As the person said above, use MapAndreas (by Mauzen beacuse its more improved). Just stay a bit with that plugin to understand it functions, it becomes easy and powerful.
__________________
TheArcher is offline   Reply With Quote
Old 21/02/2012, 10:28 AM   #6
Mike_Peterson
Gangsta
 
Mike_Peterson's Avatar
 
Join Date: Apr 2009
Location: In a concrete(used to brick) house
Posts: 844
Reputation: 37
Default Re: Grenade launcher

But I am using MapAndreas -_-, so how do i create this 'fake' gravity with a grenade object?
__________________
I'm looking for some small-time paid work, no MySQL preferably.
Search before you post!

Got a problem? Debug your script (add prints to it).
If that doesn't help, use ******!
Still having issues? Create a thread on the SA-MP Forums.
If nothing helps, send me a PM.
And I'll try to figure it out with you.
Mike_Peterson is offline   Reply With Quote
Old 21/02/2012, 01:52 PM   #7
MP2
Godfather
 
MP2's Avatar
 
Join Date: Jan 2011
Location: England
Posts: 6,231
Reputation: 993
Default Re: Grenade launcher

To make it arch? Just move it down over time.
I don't see how you're going to do this though - you can't detect walls.
__________________
Click banner above for more info. View trailers here.
Enter referral code SAMPFORUM after registering for a $5000 starting bonus!
MP2 is offline   Reply With Quote
Old 21/02/2012, 03:12 PM   #8
Babul
High-roller
 
Babul's Avatar
 
Join Date: Sep 2009
Location: in a cement block
Posts: 1,783
Reputation: 251
Default Re: Grenade launcher

walls below a size of 1mē (meters or units, its the same in GTA) cant be detected by the mapandreas plugin, its resolution is too low, and it wont detect custom objects. if any object is bigger than that mē, like a house, sometimes a plant/tree, or simply a canyon, can be detected.
to apply the (fake) gravity can be easy:
pawn Code:
new Float:ZVelocity[NAX_GRENADES];
then, in a really short timer which loops through all grenades, increase the ZVelocity[grenade] about 0.01 and add this ZVelocity to the objects current position (even while its moving, the new speed will get applied to the grenade).
__________________
FireWorks

new sscanf2 custom specifiers available for Download, read the Release Topic
Babul is offline   Reply With Quote
Old 22/02/2012, 12:59 AM   #9
Mike_Peterson
Gangsta
 
Mike_Peterson's Avatar
 
Join Date: Apr 2009
Location: In a concrete(used to brick) house
Posts: 844
Reputation: 37
Default Re: Grenade launcher

[ame=http://www.youtube.com/watch?v=wvwkcYZn4Ts]Grenade launcher by Mauzen[/ame]

Now, this looks interesting.. Created by the awesome Mauzen, but unfortunately, there is no release of this script, anyway. Going to bed now.
__________________
I'm looking for some small-time paid work, no MySQL preferably.
Search before you post!

Got a problem? Debug your script (add prints to it).
If that doesn't help, use ******!
Still having issues? Create a thread on the SA-MP Forums.
If nothing helps, send me a PM.
And I'll try to figure it out with you.
Mike_Peterson is offline   Reply With Quote
Old 22/02/2012, 02:05 AM   #10
MP2
Godfather
 
MP2's Avatar
 
Join Date: Jan 2011
Location: England
Posts: 6,231
Reputation: 993
Default Re: Grenade launcher

Wow, that looks sweet.
__________________
Click banner above for more info. View trailers here.
Enter referral code SAMPFORUM after registering for a $5000 starting bonus!
MP2 is offline   Reply With Quote
Reply

Thread Tools
Display Modes

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


Similar Threads
Thread Thread Starter Forum Replies Last Post
[FilterScript] M4 Grenade Launcher Scarface Mobst3r Filterscripts 16 30/09/2014 07:54 PM
Grenade Position Infamous Scripting Help 4 14/11/2011 12:58 AM
Colored Smoke Grenade Dripac Everything and Nothing 14 06/11/2011 01:15 AM
[NPC] Jeff the Paranoid - Grenade Dealer Poke Help Archive 21 16/11/2009 09:26 PM


All times are GMT. The time now is 11:33 AM.


Powered by vBulletin® Version 3.8.6
Copyright ©2000 - 2019, Jelsoft Enterprises Ltd.