ID:166906
May 31 2006, 12:31 pm
|
|
Thanks to the people who helped me in the last topic. I have another question, I have spent hours tryin to figure out. I wanted to make the character shoot a ki blast and it does damage for those familiar with dbz. If not then imagine I am tryin to make a bullet that you can see flying at the target and make it do damage. Thanks
|
In response to PirateHead
|
|
That is what I did but the problem was the whole "collision detection" thing but now I got it thanks. Cuz i used missile() for firing it.
|
In response to Punkrocker2010
|
|
It didnt work, I need a whole code cuz i end up comin up with tons of errors
|
In response to Punkrocker2010
|
|
Please show us a snippet of your code and some of the errors
- GhostAnime |
In response to GhostAnime
|
|
here is the button being pressed
verb/x(mob/M in oview()) set hidden = 1 if(usr.ki > 0) ki_blast.domob(M) usr.ki -= usr.maxki*usr.kiinput if(usr.ki < 0) usr.ki = 0 missile(/obj/ki_blast,usr,M.loc) else usr << "You don't have enough energy to fire a ki blast!" verb/c() here is the object obj ki_blast icon = 'ki blast.dmi' density = 1 mob/M if(dist(src.x,src.y,M.x,M.y) == 1) var/dam = rand(1,2) dam = dam * usr.ki * usr.kiinput dam = dam - M.defense M.plevel -= dam usr << "bumped" if(M.plevel < 0) usr.exp += M.expheld world << "[usr] killed [M] with a ki blast." usr.expcheck() M.death() del(src) ..() proc domob(mob/N) set M = N dist(x1, y1, x2, y2) var/dx = (x2 - x1) var/dy = (y2 - y1) return sqrt( dx*dx + dy*dy ) here is errors, and after I take out the code that is above then it works fine Dragonball Z Fight for the Galaxy.dm:305:error:ki_blast.domob:undefined var objects.dm:6:error:src.x:duplicate definition objects.dm:6:error:src.y:duplicate definition objects.dm:6:error:M.x:duplicate definition objects.dm:6:error:M.y:duplicate definition objects.dm:6:error:dist:instruction not allowed here objects.dm:6:error::duplicate definition objects.dm:6:error:1:duplicate definition objects.dm:6:error:== :instruction not allowed here objects.dm:6:error::empty type name (indentation error?) objects.dm:7:error:= :expected a constant expression objects.dm:8:error:usr.ki:undefined var objects.dm:8:error:usr.kiinput:undefined var objects.dm:9:error:M.defense:undefined var objects.dm:10:error:M.plevel:duplicate definition objects.dm:10:error:dam:duplicate definition objects.dm:10:error:-= :instruction not allowed here objects.dm:11:error:usr:duplicate definition objects.dm:11:error:"bumped":duplicate definition objects.dm:11:error:<< :instruction not allowed here objects.dm:12:error:M.plevel:duplicate definition objects.dm:12:error:0:duplicate definition objects.dm:12:error:< :instruction not allowed here objects.dm:12:error::empty type name (indentation error?) objects.dm:13:error:usr.exp:duplicate definition objects.dm:13:error:M.expheld:duplicate definition objects.dm:13:error:+= :instruction not allowed here objects.dm:14:error:world:duplicate definition objects.dm:14:error:usr:value not allowed here objects.dm:14:error::duplicate definition objects.dm:14:error:M:value not allowed here objects.dm:14:error::duplicate definition objects.dm:14:error:text "[] killed [] with a ki blast.":value not allowed here objects.dm:14:error::duplicate definition objects.dm:14:error:<< :instruction not allowed here objects.dm:15:error:expcheck :undefined proc objects.dm:16:error:death :undefined proc objects.dm:13:error::empty type name (indentation error?) objects.dm:17:error:src:value not allowed here objects.dm:17:error:del :instruction not allowed here objects.dm:7:error::empty type name (indentation error?) objects.dm:21:error:M:undefined var Dragonball Z Fight for the Galaxy.dmb - 42 errors, 0 warnings (double-click on an error to jump to it) |
In response to Punkrocker2010
|
|
Shooting the beam should be a matter of making objects in a line. If you need to do collision detection, you can look at [link]
To damage the player, just subtract from HP a la whatever combat procedures you've already got going.
If you can't get your head around the beam thing, just think of it as a line of objects extending from the shooter to the target. Just draw them in one by one, and when you draw the last one, do the damage.
Is this triggering your creativity any?