better way to make display verbs conditional??
ender
13 Aug 2011, 13:49In the game I'm working on I've got combat ... and so I have several different enemies ... then I've also got weapons that the player can get ... and I've got 'attack' as a display verb on my enemies ... HOWEVER ... what I want is for it to only be a display verb when the player has a weapon ...
what I've done is when the player gets a weapon, my script runs through all the objects in the game and if they are an enemy then it ads 'attack' to their display verb list ... and if the player drops the weapon, then it runs through them all and removes 'attack' from the display verb list.
This seems like a very inefficient way of doing things ... particularly as my game grows and I get more and more objects ... is there a better way to do this?
what I've done is when the player gets a weapon, my script runs through all the objects in the game and if they are an enemy then it ads 'attack' to their display verb list ... and if the player drops the weapon, then it runs through them all and removes 'attack' from the display verb list.
This seems like a very inefficient way of doing things ... particularly as my game grows and I get more and more objects ... is there a better way to do this?
ender
14 Aug 2011, 23:04I've improved my technique a little ... I created an object list of all the monsters in the game ... and I just have it cycle that list when the player picks up/drops a weapon instead of cycling ALL the objects in the game ... which seems a little better solution.