I'm using this code:
obj/Deck
icon='Deck.dmi'
layer=4
mob/Pirate2
Bump(Deck)
icon = 'Boat.dmi'
But when ever I bump into ANYthing I turn into Boat.dmi, I want it so I just change when I bump into Deck.dmi, any ideas?
Thanks
Gilser
ID:151136
![]() Mar 11 2001, 12:01 pm
|
|
It's sorta working...
obj/Human icon='platform.dmi' layer=4 density=1 obj/Booie icon='Booyie.dmi' layer=4 density=1 mob/Pirate2 Bump(obj/Human/O) if(istype(O)) icon = 'Char1.dmi' mob/Pirate2 Bump(obj/Booie/O) if(istype(O)) icon = 'Boat.dmi' But only the Booie works, when I try to Bump into the Human, I don't change! Anyone know why? Thanks Gilser |
On 3/11/01 3:56 pm Gilser wrote:
It's sorta working... You have two Bump procs for the same Pirate, and I assume the compiler uses the last one. You only need one, but you need to change the proc a bit when you have several objects you can bump into. When you define the O variable as obj/Booie, the compiler treats the O as a Booie. So when you check if O is of the same type as itself (a Booie) and it is a human, the if statement fails. So I suggest you use a switch statement with O.type and take proper action depending on that. Little example: mob/Pirate2 Bump(obj/O) switch(O.type) if(/obj/Booie) icon = 'Boat.dmi' if(/obj/Human) icon = 'Char1.dmi' /Andreas |
if(istype(O)) icon = 'Boat.dmi'