ID:146023
 
Code:
obj
lazer
icon = 'icons.dmi'
icon_state= "lazer"
if(usr.score>=450)
src.icon_state = "boom"


Problem description: Spaceinvaders.dm:102:error::empty type name (indentation error?)

Messing around with The Riddler's code file, changing some stuff, experimenting, etc.

Also
    eni

icon = 'icons.dmi'
icon_state= "eni"
Del()
usr.score+=450
if (usr.score>=500)
usr.icon_state = "super"
usr<<"You go into Super-Mode!"
if (src.loc==usr.loc)
del(usr)
..()


It keeps saying "You go into Super-Mode!" when you kill another opponent, how do you prevent the message form saying multiple times? (Since the score of 1 enemy is 30, maybe the best solution should be
if (usr.score>=500 <=530)

?

you don't need "src." there...

--Vito
In response to Vito Stolidus
Vito Stolidus wrote:
you don't need "src." there...

--Vito

obj
lazer
icon = 'icons.dmi'
icon_state= "lazer"
if(usr.score>=450)
icon_state = "boom"

Spaceinvaders.dm:101:error::empty type name (indentation error?)
Mysame wrote:
if (usr.score>=500 <=530)



Well for one, I don't believe arguements can just be placed like that, they'll need to look something more like this..
if (usr.score>=500||usr.score<=530)

If you want it to say you've went into Super Mode when the score is greater or equal to five hundred, OR less than and equal to 530. Gaining 450 points each kill(correct me if I'm wrong), your value is never going to land in between 500-530, meaning you will never go into Super mode. I would probably just keep the check for 500points how it was, and do it this way..
if (usr.score>=500 && usr.icon_state!="super")

I believe that would do it. It checks the usrs score, and the usrs icon state. If the users score is above 500, and the users icon state isnt "super", it will then put you in super mode. Otherwise, it won't do anything. I probably messed something up. =P Someone else will be along to correct it if I did.

In response to Detnom
Well, I raised the socre to test stuff out. And Thanks, I'll look into that! ^^
In response to Mysame
Mysame wrote:
obj
> lazer
> icon = 'icons.dmi'
> icon_state= "lazer"
> if(usr.score>=450)
> icon_state = "boom"

Spaceinvaders.dm:101:error::empty type name (indentation error?)


Errr... Uhhh... Um. you can't put an if() statement in an /obj definition!

I assume you want to it so if the obj's "score" is less than 450 its icon_state will become "boom"

You need to use New() in there:
obj
lazer
icon = 'icons.dmi'
icon_state= "lazer"
New() // when the obj is created
if(src.score>=450) src.icon_state = "boom" // checks if the obbj's "score" is more than 450,
return ..() //and if it is its icon state will become "boom"


Vito Stolidus wrote:
you don't need "src." there...

Please, when you don't know what you're talking about then you shouldn't be giving random advice (No offence), he does need 'src'. Please refer to the Usr lecture :).

O-matic
In response to O-matic
That isn't what he wants I think:

mob/verb/Laser()
new/obj/laser(src.loc,src)


obj/laser
New(mob/M)
..()
if(M.score>=400)
src.icon_state = "Boom"


That should work correctly now. You will need to edit it probably.
In response to N1ghtW1ng
Ty nightwing, gonna try that tommorow

@ O-matic, the lazer is the weapon of the ship, ship = player, the beam the ship fires needs to change when the player gets 450 points :) Thanks anyway
In response to Mysame
Mysame wrote:
@ O-matic, the lazer is the weapon of the ship, ship = player, the beam the ship fires needs to change when the player gets 450 points :) Thanks anyway


Oh, didn't knew.. sorry for being confusing, and thanks N1ghtw1ng for the correction.

O-matic
In response to O-matic
Well, the change in icon state on the lazer still has no effect, and I don't need the verb lazer, it's automatic when you press up

And now, even a freaking say verb doesnt work AND I have 10 other problems!!

var / xdir =1
var / movedown=0

world
proc
Mainloop()
while (world)
sleep(10)
for (var/mob/M as mob in world)
if (M.name=="eni")
M.x+=xdir
if (movedown==1)
M.y-=1
movedown=0
for (var/mob/M as mob in world)
if (M.name == "eni")
if (M.x==21)
xdir=-1
movedown=1
if (M.x==1)
xdir=1
movedown=1

New()
Mainloop()
..()
view = 10

turf
back
icon = 'icons.dmi'
icon_state= "back"

mob
verb
say(mesg in text)
world<<"[usr.key]: [mesg]"
var/fired = 0
var/score = 0
var/mobcount =0
proc
Checkall()
mobcount=0
for (var/mob/M as mob in world)
if (M.name=="eni")
mobcount+=1
if (mobcount==30)
usr.z+=1

me
icon = 'icons.dmi'
icon_state="me"
var/hp = 1
var/maxhp = 1
var/power = 50
var/exp = 0
var/maxexp = 100
var/level = 1


eni
icon = 'icons.dmi'
icon_state= "eni"
hp = 5
power = 1
maxhp = 5
level = 1
Del()
if (src.hp==0)
sleep(4)
src.icon_state="enidie"
del(src)
usr.score+=300
if (usr.score>=500 && usr.icon_state!="super")
usr.icon_state = "super"
usr<<"You go into Super-Mode!"
if (usr.score>=10000 && usr.icon_state!="super2")
usr.icon_state = "super2"
usr<<"You go into Ultra-Mode!"
..()

boss
icon = 'icons.dmi'
icon_state= "boss"
hp = 50
power = 5
maxhp = 50
level = 1
Del()
if (src.hp == 0)
src.icon_state="boss2spawn"
usr.score+=1000000
src.hp += 150
sleep(8)
src.icon_state="boss2"
if (usr.score>=10000 && usr.icon_state!="super2")
usr.icon_state = "super2"
usr<<"You go into Ultra-Mode!"
..()

Stat()
statpanel("Score")
stat("Score",usr.score)
stat("Level",usr.level)
stat("Experience",usr.exp / usr.maxexp)
stat("Health Points",usr.hp / usr.maxhp)
stat("Power",usr.power)

client
New()
world.mob = /mob/me
..()
North()
if (usr.fired==0)
usr.fired=1
var/obj/lazer/L = new(locate(usr.x,usr.y+1,usr.z))
spawn(0)
usr.fired=0

return 0
..()

Northwest()
return 0
..()
Northeast()
return 0
..()
South()
return 0
..()

obj
lazer
icon = 'icons.dmi'
icon_state= "lazer"
New()
while (src)
sleep(1)
src.y+=1
if (src.y==17)
del (src)
for (var/mob/M as mob in world)
if(src.loc==M.loc)
M.hp -= usr.power
if(usr.exp>=usr.maxexp)
usr.power += 2
usr.hp += 1
usr.level += 1
usr.maxexp += usr.exp + (usr.level*10)
del(src)
..()



1. Mob does NOT die
2. How do I make the "boss" move without making another loop, and without it going off the screen
3. I need something to change Lazer's icon_state to lazer2 when you have 500 points
4. Could someone check for others? :|
In response to Mysame
As far as changing the icon_state of the lazer, I misunderstood, thought it was changing the actual persons icon. what you might want to do is set it to a variable, something like this..

if (usr.score>=500 && usr.super==0)
usr.super=1//sets a variable (Which you'd need to define), called super, to 1
usr<<"You go into Super-Mode!"
if (usr.score>=10000 && usr.super==1)
usr.super=2//does the same as above for the next level of super
usr<<"You go into Ultra-Mode!"


And then you would do something like this.
North()
if (usr.fired==0)
usr.fired=1
var/obj/lazer/L = new(locate(usr.x,usr.y+1,usr.z))
if(usr.super==1)
L.icon_state="super"//changes the shots icon_state if you're super
if(usr.super==2)
L.icon_state="super2"//changes the shots icon_state if you're ultra
spawn(0)
usr.fired=0

return 0
..()

I'm honestly not quite sure about the L.icon_state thing there, but I would think it would work. =/
In response to Detnom
Northwest()
return 0
..()
Northeast()
return 0
..()
South()
return 0
..()


Spaceinvaders.dm:132:error: proc definition not allowed inside another proc

Spaceinvaders.dmb - 13 errors, 0 warnings (double-click on an error to jump to it)

:|
This 1 thing is REALLY messing up everything! Is it possible to set the lazer as a mob instead of an object? Maybe it would go better then? :s