Im trying to figure out a way I can store an obj in a variable and then use new() or new/ from somewhere else in my code to create that obj when I need it. How would I go about this? What Im doing is making attack icons for weapons. The weapons have a var called AIcon which is just var/AIcon and whatever weapon is being used is stored on the mob in CurrentWeapon. Now say I want AIcon to = /obj/blah/blah/blah and then somewhere completely different I want to use O = new(CurrentWeapon.AIcon) but when I try this it simply doesnt work. I think its the way I assign AIcon but Im not sure can someone help me out plz?
ID:174224
Sep 14 2003, 11:11 am
|
|
In response to Green Lime
|
|
AIcon is the attack icon of whatever weapon and its set in the weapon. In my mobs attack verb it would define O as a new instance of CurrentWeapon.AIcon and then display it to show the attack. I just cant actually get it to work. It works right now but regardless of what weapon your using its the same attack icon because O is actually defined in the attack as new/obj/Weapons/blah/blah and without incredibly lengthy if else statements I couldnt make it weapon specific. My goal is to have it display AIcon based on the weapon you used when you attacked alah CurrentWeapon. Therefore whatever AIcon is in CurrentWeapon should be assigned to O and a new one created AKA O = new(CurrentWeapon.AIcon) but how do I do that? Im lookin for the exact way I need to define AIcon as /obj/blah/blah and then the exact way I need to define O as a new instance of AIcon.
For example this is my code atm. in attack here is where O is defined. O = new(Attacker.CurrentWeapon:AIcon) in the weapon this is how AIcon is defined AIcon = /obj/Weapon/OneHandedSlash/sword_attack When I attack in the game nothing happens. No icon is shown and I dont get any errors. It just simply doesnt work. The attack finishs just fine and dmg is assigned and issued and everything as if nothing were wrong but I dont get an icon displayed for my attack. |
Design Tree
=mob=-var-'CurrentWeapon=Ref:obj/Weapon'
=obj==Weapon=-var-'AIcon'
mobsRef.CurrentWeapon.AIcon
So you want too asign AIcon with AIcon = /obj/blahetc...
Then latter in the code declare var/O = a new AIcon in CurrentWeapon. Whats the point of this? Umm please specifie more detail.