ID:172255
 
i feel really bad because ive been asking a few questions here and i dont really wanna have to ask any 'gimme code' questions but im soooo stuck!

i dont know how to use the missile proc to create a grenade that will move x amount of tiles away from a mob before it explodes. the character will use a verb (like Throw_Grenade as was suggested in an earlier post) to 'throw' the projectile an amount of tiles depending on a strength value.

i can do the exploding and damaging part but i just cant seem to get the actual throwing part right...

if someone can help me i would be immensly thankful and would be more than happy to acknowledge them within my code. hell if anyone who is considering helping me feels like it would be too easy to just give me code, you could at least point mein the right direction

any help at all would be greatfully excepted
Well, you'll find some projectile demos in the demos section of the site pretty easily. Then the strength part shouldn't be too hard either. I don't really know the proportions of your strength skill (wether the average strength is 10 or 2000, for example), but this should work. When you've got the actual missile proc, replace the section defining the range with something like this:

if(usr.str >= 10)
usr.range = 5
else if(usr.str >= 9)
usr.range = 4
else if(blah blah blah)

str would be replaced with your strength var, and usr.range with whatever range var the demo uses. I know that uses alot of if and else, and there's an easier way to do it, and someone's probably going to come and correct me, but it should work until you can get a better system. However, if you plan on having a minimum range of 1 and a maximum of 20, that'll be a heck of a lot of if's and else's, so if that's your case then wait until someone more knowledgable of DM helps you o_o


In response to Rippy
thanks man this just had me stumped...
In response to Rippy
what exactly do i write for the location within the missile proc if i was going to make it stop after a while?

it looks like this so far

missile(/obj/grenade, usr, xxxxx)

xxxxx is the part i dont know what to do with. very frustrating form me...
In response to GunRunner
replace the xxxxxxx thing with usr.range, and define range like I showed you before.
In response to Rippy
ive done it and it reports no errors yet nothing happens when you click the throw verb...

obj/grenade
icon = 'grenade.dmi'
icon_state = "grenade"
density = 1

mob/verb/Throw()
missile(/obj/grenade,usr,usr.playRange)

back to basics now...

is this how it should look?
why wont it work?
this is driving me crazy and its 1:12 AM where i am...
In response to GunRunner
it may or may not change much, but replace missile(/obj/grenade,usr,usr.playRange) with missile(/obj/grenade,usr.loc,usr.playRange) . See if that does anything o_0 Cause what you were doing before is defining the start location as usr, which could be a number of things. usr.loc defines it as the location the usr is occupying. Wether or not this changes anything, it's probably a better way to code it.
In response to Rippy
it doesnt make a difference, that was what i actually had in the code but for some reason i must have accidentaly deleted it...

no more suggesitons?
In response to GunRunner
I'm out of ideas, sorry. But I haven't been using DM half as much as a lot of other people here. Maybe you should just get some rest and check it tomorrow o_0
In response to Rippy
probably a good idea (as for using DM, ive only been at it about a month and im writing a game called XenoPhobe based on the Aliens movies)

sleep would be good and thank you for your help
In response to GunRunner
lol, no problem.