ID:175953
 
How do i make a var equal a certain mob. Like i want the var test to equal /mob/orange but:

test = /mob/orange

doesnt work...Please help! Thanks in advance!

-Crio
Koolguy900095 wrote:
How do i make a var equal a certain mob. Like i want the var test to equal /mob/orange but:

test = /mob/orange

doesnt work...Please help! Thanks in advance!

It does work, if you want test to equal a type path. If you want it to equal a mob, then you have to pick which mob you want it to be. Use locate() or for(), or something along those lines.

Lummox JR
In response to Lummox JR
like:

mob
var
test = locate(/mob/orange)

?
In response to Koolguy900095
is thats what its supposed to be it doesnt work... i get the error:

main.dm:12:error:= :expected a constant expression

Im trying to make it so the game flicks an icon on the orange

all the coding:

mob
var
test = locate(/mob/orange)



verb
Orange()
flick("orange_eat",test)
In response to Koolguy900095
Your problem is that something set at runtime (mob/var/X = whatever) must be constant. Which means no variables, no procs. What you want is something more along the lines of:
mob
verb
Orange()
var/mob/M = locate(/mob/orange)
flick("orange_eat",test)

However, that will select the first orange in the world.contents list. If you want every mob/orange to flick, then use this:
mob
verb
Orange()
for(var/mob/orange/M in world)
flick("orange_eat",test)
In response to Garthor
how do i make flick longer than it is?
In response to Koolguy900095
You don't. flick() will play the animation once. If it's just a static frame, then you will probably want to set the icon, then spawn() it back to normal. Otherwise, just make the animation longer.