59 | | work in progress... |
| 60 | ==== Using not-predefined pickups ==== |
| 61 | |
| 62 | Now let's assume you're not satisfied with the pickups that are provided by the two before mentioned file, but you're not much of a coder as well. Luckily there is a way for you. Pickups were created with a broad range of use in mind, which means that the pickups provided by the files are not all there is. |
| 63 | |
| 64 | There is no minimum requirement to use pickups in your level files, as long as they have been coded in C++. e.g. |
| 65 | |
| 66 | {{{ |
| 67 | <PickupSpawner position="-100,0,-100" respawnTime="30" maxSpawnedItems="10"> |
| 68 | <pickup> |
| 69 | <HealthPickup |
| 70 | health = 33 |
| 71 | healthType = "limited" |
| 72 | activationType = "immediate" |
| 73 | durationType = "once" |
| 74 | /> |
| 75 | </pickup> |
| 76 | </PickupSpawner> |
| 77 | }}} |
| 78 | |
| 79 | As you can see in the pickup_representation_templates.oxt file and the pickups.oxi file there is no representation defined for this pickup, so the default representation will be used. |
| 80 | |
| 81 | Now let us assume you want to create a representation for the inserted pickup above. This is done by creating a representation within the scene. |
| 82 | |
| 83 | {{{ |
| 84 | <PickupRepresentation |
| 85 | name = "My new health pickup" |
| 86 | description = "This is an awesome new health pickup." |
| 87 | spawnerTemplate = "newhealthpickupRepresentation" |
| 88 | > |
| 89 | <pickup> |
| 90 | <HealthPickup |
| 91 | health = 33 |
| 92 | healthType = "limited" |
| 93 | activationType = "immediate" |
| 94 | durationType = "once" |
| 95 | /> |
| 96 | </pickup> |
| 97 | </PickupRepresentation> |
| 98 | }}} |
| 99 | |
| 100 | As you maybe have noticed by now, we also have to define the template for the representation which is used in |
| 101 | |
| 102 | {{{ |
| 103 | spawnerTemplate = "newhealthpickupRepresentation" |
| 104 | }}} |
| 105 | |
| 106 | the template you need to create defines how the pickup (or actually the spawner) is displayed in your level. |
| 107 | |
| 108 | {{{ |
| 109 | <Template name=newhealthpickupRepresentation> |
| 110 | <PickupRepresentation> |
| 111 | <spawner-representation> |
| 112 | <StaticEntity> |
| 113 | <attached> |
| 114 | -- Here you can put all the objects which define the look of the spawner. -- |
| 115 | </attached> |
| 116 | </StaticEntity> |
| 117 | </spawner-representation> |
| 118 | </PickupRepresentation> |
| 119 | </Template> |
| 120 | }}} |
| 121 | |
| 122 | Your done. Now you have a new pickup type with an appropriate representation for your use. If you feel that it is useful in general please don't hesitate create a template for the pickup and add your pickup to the pickup_representation_templates.oxt file and the pickups.oxi file, so that anyone who wants to use kit can do so quite easily. |
| 123 | |
| 124 | Let's assume you're still not satisfied. I mean, come on, we just used a pickup that already existed and created a new type by changing some parameter values and adding a representation, that's not really anything new now, is it? |
| 125 | |
| 126 | Well I've got something for you. It's called a PickupCollection (in the following just referred to as collection). A collection is comprised of many different types of pickups and behaves just as if it were one pickup itself. This is how you create one: |
| 127 | |
| 128 | {{{ |
| 129 | <PickupCollection> |
| 130 | <pickupables> |
| 131 | -- some pickups you want th have in your collection, e.g. -- |
| 132 | <HealthPickup template=smallhealthpickup /> |
| 133 | <HealthPickup health=50 healthRate=5 durationType=continuous activationType=immediate healthType=limited /> |
| 134 | </pickupables> |
| 135 | </PickupCollection> |
| 136 | }}} |
| 137 | |
| 138 | That's it, there's nothing more to it. However if you have questions regarding any of the above please feel free to contact [wiki:DamianFrick|me]. |
| 139 | |
| 140 | === Creating a new pickup === |
| 141 | |