SA-MP Forums Archive
Grenade launcher - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: Grenade launcher (/showthread.php?tid=319649)



Grenade launcher - Mike_Peterson - 19.02.2012

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.


Re: Grenade launcher - Babul - 19.02.2012

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.


Re: Grenade launcher - TheArcher - 19.02.2012

Quote:
Originally Posted by Babul
Посмотреть сообщение
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.


Re: Grenade launcher - Mike_Peterson - 19.02.2012

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..


Re: Grenade launcher - TheArcher - 20.02.2012

Quote:
Originally Posted by Mike_Peterson
Посмотреть сообщение
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.


Re: Grenade launcher - Mike_Peterson - 21.02.2012

But I am using MapAndreas -_-, so how do i create this 'fake' gravity with a grenade object?


Re: Grenade launcher - MP2 - 21.02.2012

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.


Re: Grenade launcher - Babul - 21.02.2012

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 Код:
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).


Re: Grenade launcher - Mike_Peterson - 21.02.2012

[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.


Re: Grenade launcher - MP2 - 22.02.2012

Wow, that looks sweet.