Day 4
Making things go boom is always fun! Just thought you'd like to know. Not that I've implemented it yet or anything...
Anyway, I called out for help because I needed a projectile icon. IanPeregrine was the first to reply, suggesting that I use the male symbol. Not a bad idea. Justin ran around like a chicken with his head cut off to get to my journal...and gave me the head. Ewww. Nonetheless, I took a look at it. Silk Wizard threatened to get me Byond-banned if I didn't give him credit, so I edited the icon a bit to disguise it. That means it's mine now, right? Ian then came back and replaced his suggestion with transparent male AND female icons. I didn't think it was fair for him to have more chances than anyone else, and since the icons were kiiiiinda similar I just made them overlap each other at the ring. I don't think it means anything now.
But what to choose? Every suggestion (with the exception of Popisfizzy's because like Shades said, they really were that bad) were excellent choices. Alas, I can only pick one.
Or can I? While browsing the Bwicki the other day, I noticed an entry about random number generators. If I apply that to icon states, I could use all of them at once!
var/num = rand(1,10)
Dang, that's a short piece of code. Now it's my short piece of code. I slip it under the projectile obj thingamajig...
obj
bullet
icon='projectile.dmi'
icon_state = var/num = rand(1,10)
loading Best Tutorials For a.dme
projectile.dm:4:error: =: expected end of statement
projectile.dm:4:error: missing left-hand argument to =.
Best Tutorials For a.dmb - 2 errors, 0 warnings (double-click on an error to jump to it)
Drat. I'm going to make this work! Somehow, I'll find a way around this.
Aha! If I call the random number line in the proc itself and then assign it to the icon state, that could do it! I add this to my verb.
verb
fire()
var/num = rand(1,4)
src.icon_state = "[num]"
usr.projectile(new/obj/projectile(usr.loc),usr.dir,40)
Did I shoot? Nope. In fact, my character vanished as I pushed the button. Then it dawned on me that when I said src.icon_state, I was telling the game to change MY icon state. Since I didn't have a 1, 2, 3 or 4 I turned blank. Oops. I put it here instead.
verb
fire()
usr.projectile(new/obj/projectile(usr.loc),usr.dir,40, icon_state = rand(1,4))
Compile, no errors! Woohoo! I run it and hit the verb and...
runtime error: bad arg name 'icon_state'
proc name: projectile (/mob/proc/projectile)
usr: Sarm (/mob)
src: Sarm (/mob)
call stack:
Sarm (/mob): projectile(the projectile (/obj/projectile), 1, 40)
Sarm (/mob): fire()
I tried putting it in "[ ]" instead. Same problem. I back it all out and think about it for a while. I pulled it off a year ago the last time I mucked about with Dream Maker but it's not available to me right now.
An hour later, I had just given up and started looking for something else, and then it hit me; the entire time I was never telling Dream Maker to change the icon of the projectile. When I saw a similar thing done in the Bwicki's DeathCheck page I realized how it had to be done.
proc
projectile(obj/projectile/O as obj,var/dir,var/delay)
O.icon_state = "[rand(1,4)]"
sleep(1)
walk(O,dir)
sleep(delay)
del(O)
I needed the O thingie to refer to the projectile. I tested it out, and it was golden! After that I had to make sure the projectile would actually cause damage, but switching keys in the pager is so boring that it would be easier to make the shot turn around instead. I'll make them reflect off of walls!
...Except I'm making the icon turn but still walk in the same direction. Feh. I'll pick it up tomorrow.
Edit: Oh yeah. Replaced the build I had up before. You can now click on two verbs instead of one.
ID:14494
Jun 29 2006, 4:11 pm (Edited on Jun 29 2006, 4:21 pm)
|
|
Jun 29 2006, 4:20 pm
|
|
Keep 'em coming!
|
dude, do you still have DWL file??? if so please host it, because theres no more good games on byond >:O
|
Sorry, I don't. The computer that DOES have the files is currently in another continent, and even if I did have them available I would wait for Tarq's permission first.
|